gcp_sdk_rpc/model.rs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148
// Copyright 2024 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
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR 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 sidekick. DO NOT EDIT.
#![allow(rustdoc::redundant_explicit_links)]
#![allow(rustdoc::broken_intra_doc_links)]
#![no_implicit_prelude]
extern crate bytes;
extern crate serde;
extern crate serde_with;
extern crate std;
extern crate wkt;
/// Describes the cause of the error with structured details.
///
/// Example of an error when contacting the "pubsub.googleapis.com" API when it
/// is not enabled:
///
/// ```norust
/// { "reason": "API_DISABLED"
///   "domain": "googleapis.com"
///   "metadata": {
///     "resource": "projects/123",
///     "service": "pubsub.googleapis.com"
///   }
/// }
/// ```
///
/// This response indicates that the pubsub.googleapis.com API is not enabled.
///
/// Example of an error that is returned when attempting to create a Spanner
/// instance in a region that is out of stock:
///
/// ```norust
/// { "reason": "STOCKOUT"
///   "domain": "spanner.googleapis.com",
///   "metadata": {
///     "availableRegions": "us-central1,us-east2"
///   }
/// }
/// ```
#[serde_with::serde_as]
#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct ErrorInfo {
    /// The reason of the error. This is a constant value that identifies the
    /// proximate cause of the error. Error reasons are unique within a particular
    /// domain of errors. This should be at most 63 characters and match a
    /// regular expression of `[A-Z][A-Z0-9_]+[A-Z0-9]`, which represents
    /// UPPER_SNAKE_CASE.
    #[serde(skip_serializing_if = "std::string::String::is_empty")]
    pub reason: std::string::String,
    /// The logical grouping to which the "reason" belongs. The error domain
    /// is typically the registered service name of the tool or product that
    /// generates the error. Example: "pubsub.googleapis.com". If the error is
    /// generated by some common infrastructure, the error domain must be a
    /// globally unique value that identifies the infrastructure. For Google API
    /// infrastructure, the error domain is "googleapis.com".
    #[serde(skip_serializing_if = "std::string::String::is_empty")]
    pub domain: std::string::String,
    /// Additional structured details about this error.
    ///
    /// Keys must match a regular expression of `[a-z][a-zA-Z0-9-_]+` but should
    /// ideally be lowerCamelCase. Also, they must be limited to 64 characters in
    /// length. When identifying the current value of an exceeded limit, the units
    /// should be contained in the key, not the value.  For example, rather than
    /// `{"instanceLimit": "100/request"}`, should be returned as,
    /// `{"instanceLimitPerRequest": "100"}`, if the client exceeds the number of
    /// instances that can be created in a single (batch) request.
    #[serde(skip_serializing_if = "std::collections::HashMap::is_empty")]
    pub metadata: std::collections::HashMap<std::string::String, std::string::String>,
}
impl ErrorInfo {
    /// Sets the value of [reason][crate::model::ErrorInfo::reason].
    pub fn set_reason<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.reason = v.into();
        self
    }
    /// Sets the value of [domain][crate::model::ErrorInfo::domain].
    pub fn set_domain<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.domain = v.into();
        self
    }
    /// Sets the value of [metadata][crate::model::ErrorInfo::metadata].
    pub fn set_metadata<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.metadata = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }
}
impl wkt::message::Message for ErrorInfo {
    fn typename() -> &'static str {
        "type.googleapis.com/google.rpc.ErrorInfo"
    }
}
/// Describes when the clients can retry a failed request. Clients could ignore
/// the recommendation here or retry when this information is missing from error
/// responses.
///
/// It's always recommended that clients should use exponential backoff when
/// retrying.
///
/// Clients should wait until `retry_delay` amount of time has passed since
/// receiving the error response before retrying.  If retrying requests also
/// fail, clients should use an exponential backoff scheme to gradually increase
/// the delay between retries based on `retry_delay`, until either a maximum
/// number of retries have been reached or a maximum retry delay cap has been
/// reached.
#[serde_with::serde_as]
#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct RetryInfo {
    /// Clients should wait at least this long between retrying the same request.
    #[serde(skip_serializing_if = "std::option::Option::is_none")]
    pub retry_delay: std::option::Option<wkt::Duration>,
}
impl RetryInfo {
    /// Sets the value of [retry_delay][crate::model::RetryInfo::retry_delay].
    pub fn set_retry_delay<T: std::convert::Into<std::option::Option<wkt::Duration>>>(
        mut self,
        v: T,
    ) -> Self {
        self.retry_delay = v.into();
        self
    }
}
impl wkt::message::Message for RetryInfo {
    fn typename() -> &'static str {
        "type.googleapis.com/google.rpc.RetryInfo"
    }
}
/// Describes additional debugging info.
#[serde_with::serde_as]
#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct DebugInfo {
    /// The stack trace entries indicating where the error occurred.
    #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
    pub stack_entries: std::vec::Vec<std::string::String>,
    /// Additional debugging information provided by the server.
    #[serde(skip_serializing_if = "std::string::String::is_empty")]
    pub detail: std::string::String,
}
impl DebugInfo {
    /// Sets the value of [detail][crate::model::DebugInfo::detail].
    pub fn set_detail<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.detail = v.into();
        self
    }
    /// Sets the value of [stack_entries][crate::model::DebugInfo::stack_entries].
    pub fn set_stack_entries<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.stack_entries = v.into_iter().map(|i| i.into()).collect();
        self
    }
}
impl wkt::message::Message for DebugInfo {
    fn typename() -> &'static str {
        "type.googleapis.com/google.rpc.DebugInfo"
    }
}
/// Describes how a quota check failed.
///
/// For example if a daily limit was exceeded for the calling project,
/// a service could respond with a QuotaFailure detail containing the project
/// id and the description of the quota limit that was exceeded.  If the
/// calling project hasn't enabled the service in the developer console, then
/// a service could respond with the project id and set `service_disabled`
/// to true.
///
/// Also see RetryInfo and Help types for other details about handling a
/// quota failure.
#[serde_with::serde_as]
#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct QuotaFailure {
    /// Describes all quota violations.
    #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
    pub violations: std::vec::Vec<crate::model::quota_failure::Violation>,
}
impl QuotaFailure {
    /// Sets the value of [violations][crate::model::QuotaFailure::violations].
    pub fn set_violations<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::quota_failure::Violation>,
    {
        use std::iter::Iterator;
        self.violations = v.into_iter().map(|i| i.into()).collect();
        self
    }
}
impl wkt::message::Message for QuotaFailure {
    fn typename() -> &'static str {
        "type.googleapis.com/google.rpc.QuotaFailure"
    }
}
/// Defines additional types related to QuotaFailure
pub mod quota_failure {
    #[allow(unused_imports)]
    use super::*;
    /// A message type used to describe a single quota violation.  For example, a
    /// daily quota or a custom quota that was exceeded.
    #[serde_with::serde_as]
    #[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
    #[serde(default, rename_all = "camelCase")]
    #[non_exhaustive]
    pub struct Violation {
        /// The subject on which the quota check failed.
        /// For example, "clientip:\<ip address of client\>" or "project:\<Google
        /// developer project id\>".
        #[serde(skip_serializing_if = "std::string::String::is_empty")]
        pub subject: std::string::String,
        /// A description of how the quota check failed. Clients can use this
        /// description to find more about the quota configuration in the service's
        /// public documentation, or find the relevant quota limit to adjust through
        /// developer console.
        ///
        /// For example: "Service disabled" or "Daily Limit for read operations
        /// exceeded".
        #[serde(skip_serializing_if = "std::string::String::is_empty")]
        pub description: std::string::String,
    }
    impl Violation {
        /// Sets the value of [subject][crate::model::quota_failure::Violation::subject].
        pub fn set_subject<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
            self.subject = v.into();
            self
        }
        /// Sets the value of [description][crate::model::quota_failure::Violation::description].
        pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
            self.description = v.into();
            self
        }
    }
    impl wkt::message::Message for Violation {
        fn typename() -> &'static str {
            "type.googleapis.com/google.rpc.QuotaFailure.Violation"
        }
    }
}
/// Describes what preconditions have failed.
///
/// For example, if an RPC failed because it required the Terms of Service to be
/// acknowledged, it could list the terms of service violation in the
/// PreconditionFailure message.
#[serde_with::serde_as]
#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct PreconditionFailure {
    /// Describes all precondition violations.
    #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
    pub violations: std::vec::Vec<crate::model::precondition_failure::Violation>,
}
impl PreconditionFailure {
    /// Sets the value of [violations][crate::model::PreconditionFailure::violations].
    pub fn set_violations<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::precondition_failure::Violation>,
    {
        use std::iter::Iterator;
        self.violations = v.into_iter().map(|i| i.into()).collect();
        self
    }
}
impl wkt::message::Message for PreconditionFailure {
    fn typename() -> &'static str {
        "type.googleapis.com/google.rpc.PreconditionFailure"
    }
}
/// Defines additional types related to PreconditionFailure
pub mod precondition_failure {
    #[allow(unused_imports)]
    use super::*;
    /// A message type used to describe a single precondition failure.
    #[serde_with::serde_as]
    #[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
    #[serde(default, rename_all = "camelCase")]
    #[non_exhaustive]
    pub struct Violation {
        /// The type of PreconditionFailure. We recommend using a service-specific
        /// enum type to define the supported precondition violation subjects. For
        /// example, "TOS" for "Terms of Service violation".
        #[serde(rename = "type")]
        #[serde(skip_serializing_if = "std::string::String::is_empty")]
        pub r#type: std::string::String,
        /// The subject, relative to the type, that failed.
        /// For example, "google.com/cloud" relative to the "TOS" type would indicate
        /// which terms of service is being referenced.
        #[serde(skip_serializing_if = "std::string::String::is_empty")]
        pub subject: std::string::String,
        /// A description of how the precondition failed. Developers can use this
        /// description to understand how to fix the failure.
        ///
        /// For example: "Terms of service not accepted".
        #[serde(skip_serializing_if = "std::string::String::is_empty")]
        pub description: std::string::String,
    }
    impl Violation {
        /// Sets the value of [r#type][crate::model::precondition_failure::Violation::type].
        pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
            self.r#type = v.into();
            self
        }
        /// Sets the value of [subject][crate::model::precondition_failure::Violation::subject].
        pub fn set_subject<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
            self.subject = v.into();
            self
        }
        /// Sets the value of [description][crate::model::precondition_failure::Violation::description].
        pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
            self.description = v.into();
            self
        }
    }
    impl wkt::message::Message for Violation {
        fn typename() -> &'static str {
            "type.googleapis.com/google.rpc.PreconditionFailure.Violation"
        }
    }
}
/// Describes violations in a client request. This error type focuses on the
/// syntactic aspects of the request.
#[serde_with::serde_as]
#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct BadRequest {
    /// Describes all violations in a client request.
    #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
    pub field_violations: std::vec::Vec<crate::model::bad_request::FieldViolation>,
}
impl BadRequest {
    /// Sets the value of [field_violations][crate::model::BadRequest::field_violations].
    pub fn set_field_violations<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::bad_request::FieldViolation>,
    {
        use std::iter::Iterator;
        self.field_violations = v.into_iter().map(|i| i.into()).collect();
        self
    }
}
impl wkt::message::Message for BadRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.rpc.BadRequest"
    }
}
/// Defines additional types related to BadRequest
pub mod bad_request {
    #[allow(unused_imports)]
    use super::*;
    /// A message type used to describe a single bad request field.
    #[serde_with::serde_as]
    #[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
    #[serde(default, rename_all = "camelCase")]
    #[non_exhaustive]
    pub struct FieldViolation {
        /// A path that leads to a field in the request body. The value will be a
        /// sequence of dot-separated identifiers that identify a protocol buffer
        /// field.
        ///
        /// Consider the following:
        ///
        /// ```norust
        /// message CreateContactRequest {
        ///   message EmailAddress {
        ///     enum Type {
        ///       TYPE_UNSPECIFIED = 0;
        ///       HOME = 1;
        ///       WORK = 2;
        ///     }
        ///
        ///     optional string email = 1;
        ///     repeated EmailType type = 2;
        ///   }
        ///
        ///   string full_name = 1;
        ///   repeated EmailAddress email_addresses = 2;
        /// }
        /// ```
        ///
        /// In this example, in proto `field` could take one of the following values:
        ///
        /// * `full_name` for a violation in the `full_name` value
        /// * `email_addresses[1].email` for a violation in the `email` field of the
        ///   first `email_addresses` message
        /// * `email_addresses[3].type[2]` for a violation in the second `type`
        ///   value in the third `email_addresses` message.
        ///
        /// In JSON, the same values are represented as:
        ///
        /// * `fullName` for a violation in the `fullName` value
        /// * `emailAddresses[1].email` for a violation in the `email` field of the
        ///   first `emailAddresses` message
        /// * `emailAddresses[3].type[2]` for a violation in the second `type`
        ///   value in the third `emailAddresses` message.
        #[serde(skip_serializing_if = "std::string::String::is_empty")]
        pub field: std::string::String,
        /// A description of why the request element is bad.
        #[serde(skip_serializing_if = "std::string::String::is_empty")]
        pub description: std::string::String,
        /// The reason of the field-level error. This is a constant value that
        /// identifies the proximate cause of the field-level error. It should
        /// uniquely identify the type of the FieldViolation within the scope of the
        /// google.rpc.ErrorInfo.domain. This should be at most 63
        /// characters and match a regular expression of `[A-Z][A-Z0-9_]+[A-Z0-9]`,
        /// which represents UPPER_SNAKE_CASE.
        #[serde(skip_serializing_if = "std::string::String::is_empty")]
        pub reason: std::string::String,
        /// Provides a localized error message for field-level errors that is safe to
        /// return to the API consumer.
        #[serde(skip_serializing_if = "std::option::Option::is_none")]
        pub localized_message: std::option::Option<crate::model::LocalizedMessage>,
    }
    impl FieldViolation {
        /// Sets the value of [field][crate::model::bad_request::FieldViolation::field].
        pub fn set_field<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
            self.field = v.into();
            self
        }
        /// Sets the value of [description][crate::model::bad_request::FieldViolation::description].
        pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
            self.description = v.into();
            self
        }
        /// Sets the value of [reason][crate::model::bad_request::FieldViolation::reason].
        pub fn set_reason<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
            self.reason = v.into();
            self
        }
        /// Sets the value of [localized_message][crate::model::bad_request::FieldViolation::localized_message].
        pub fn set_localized_message<
            T: std::convert::Into<std::option::Option<crate::model::LocalizedMessage>>,
        >(
            mut self,
            v: T,
        ) -> Self {
            self.localized_message = v.into();
            self
        }
    }
    impl wkt::message::Message for FieldViolation {
        fn typename() -> &'static str {
            "type.googleapis.com/google.rpc.BadRequest.FieldViolation"
        }
    }
}
/// Contains metadata about the request that clients can attach when filing a bug
/// or providing other forms of feedback.
#[serde_with::serde_as]
#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct RequestInfo {
    /// An opaque string that should only be interpreted by the service generating
    /// it. For example, it can be used to identify requests in the service's logs.
    #[serde(skip_serializing_if = "std::string::String::is_empty")]
    pub request_id: std::string::String,
    /// Any data that was used to serve this request. For example, an encrypted
    /// stack trace that can be sent back to the service provider for debugging.
    #[serde(skip_serializing_if = "std::string::String::is_empty")]
    pub serving_data: std::string::String,
}
impl RequestInfo {
    /// Sets the value of [request_id][crate::model::RequestInfo::request_id].
    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.request_id = v.into();
        self
    }
    /// Sets the value of [serving_data][crate::model::RequestInfo::serving_data].
    pub fn set_serving_data<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.serving_data = v.into();
        self
    }
}
impl wkt::message::Message for RequestInfo {
    fn typename() -> &'static str {
        "type.googleapis.com/google.rpc.RequestInfo"
    }
}
/// Describes the resource that is being accessed.
#[serde_with::serde_as]
#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct ResourceInfo {
    /// A name for the type of resource being accessed, e.g. "sql table",
    /// "cloud storage bucket", "file", "Google calendar"; or the type URL
    /// of the resource: e.g. "type.googleapis.com/google.pubsub.v1.Topic".
    #[serde(skip_serializing_if = "std::string::String::is_empty")]
    pub resource_type: std::string::String,
    /// The name of the resource being accessed.  For example, a shared calendar
    /// name: "example.com_4fghdhgsrgh@group.calendar.google.com", if the current
    /// error is
    /// [google.rpc.Code.PERMISSION_DENIED][google.rpc.Code.PERMISSION_DENIED].
    ///
    /// [google.rpc.Code.PERMISSION_DENIED]: crate::model::code::PERMISSION_DENIED
    #[serde(skip_serializing_if = "std::string::String::is_empty")]
    pub resource_name: std::string::String,
    /// The owner of the resource (optional).
    /// For example, "user:\<owner email\>" or "project:\<Google developer project
    /// id\>".
    #[serde(skip_serializing_if = "std::string::String::is_empty")]
    pub owner: std::string::String,
    /// Describes what error is encountered when accessing this resource.
    /// For example, updating a cloud project may require the `writer` permission
    /// on the developer console project.
    #[serde(skip_serializing_if = "std::string::String::is_empty")]
    pub description: std::string::String,
}
impl ResourceInfo {
    /// Sets the value of [resource_type][crate::model::ResourceInfo::resource_type].
    pub fn set_resource_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.resource_type = v.into();
        self
    }
    /// Sets the value of [resource_name][crate::model::ResourceInfo::resource_name].
    pub fn set_resource_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.resource_name = v.into();
        self
    }
    /// Sets the value of [owner][crate::model::ResourceInfo::owner].
    pub fn set_owner<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.owner = v.into();
        self
    }
    /// Sets the value of [description][crate::model::ResourceInfo::description].
    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.description = v.into();
        self
    }
}
impl wkt::message::Message for ResourceInfo {
    fn typename() -> &'static str {
        "type.googleapis.com/google.rpc.ResourceInfo"
    }
}
/// Provides links to documentation or for performing an out of band action.
///
/// For example, if a quota check failed with an error indicating the calling
/// project hasn't enabled the accessed service, this can contain a URL pointing
/// directly to the right place in the developer console to flip the bit.
#[serde_with::serde_as]
#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct Help {
    /// URL(s) pointing to additional information on handling the current error.
    #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
    pub links: std::vec::Vec<crate::model::help::Link>,
}
impl Help {
    /// Sets the value of [links][crate::model::Help::links].
    pub fn set_links<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::help::Link>,
    {
        use std::iter::Iterator;
        self.links = v.into_iter().map(|i| i.into()).collect();
        self
    }
}
impl wkt::message::Message for Help {
    fn typename() -> &'static str {
        "type.googleapis.com/google.rpc.Help"
    }
}
/// Defines additional types related to Help
pub mod help {
    #[allow(unused_imports)]
    use super::*;
    /// Describes a URL link.
    #[serde_with::serde_as]
    #[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
    #[serde(default, rename_all = "camelCase")]
    #[non_exhaustive]
    pub struct Link {
        /// Describes what the link offers.
        #[serde(skip_serializing_if = "std::string::String::is_empty")]
        pub description: std::string::String,
        /// The URL of the link.
        #[serde(skip_serializing_if = "std::string::String::is_empty")]
        pub url: std::string::String,
    }
    impl Link {
        /// Sets the value of [description][crate::model::help::Link::description].
        pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
            self.description = v.into();
            self
        }
        /// Sets the value of [url][crate::model::help::Link::url].
        pub fn set_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
            self.url = v.into();
            self
        }
    }
    impl wkt::message::Message for Link {
        fn typename() -> &'static str {
            "type.googleapis.com/google.rpc.Help.Link"
        }
    }
}
/// Provides a localized error message that is safe to return to the user
/// which can be attached to an RPC error.
#[serde_with::serde_as]
#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct LocalizedMessage {
    /// The locale used following the specification defined at
    /// <https://www.rfc-editor.org/rfc/bcp/bcp47.txt>.
    /// Examples are: "en-US", "fr-CH", "es-MX"
    #[serde(skip_serializing_if = "std::string::String::is_empty")]
    pub locale: std::string::String,
    /// The localized error message in the above locale.
    #[serde(skip_serializing_if = "std::string::String::is_empty")]
    pub message: std::string::String,
}
impl LocalizedMessage {
    /// Sets the value of [locale][crate::model::LocalizedMessage::locale].
    pub fn set_locale<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.locale = v.into();
        self
    }
    /// Sets the value of [message][crate::model::LocalizedMessage::message].
    pub fn set_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.message = v.into();
        self
    }
}
impl wkt::message::Message for LocalizedMessage {
    fn typename() -> &'static str {
        "type.googleapis.com/google.rpc.LocalizedMessage"
    }
}
/// Represents an HTTP request.
#[serde_with::serde_as]
#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct HttpRequest {
    /// The HTTP request method.
    #[serde(skip_serializing_if = "std::string::String::is_empty")]
    pub method: std::string::String,
    /// The HTTP request URI.
    #[serde(skip_serializing_if = "std::string::String::is_empty")]
    pub uri: std::string::String,
    /// The HTTP request headers. The ordering of the headers is significant.
    /// Multiple headers with the same key may present for the request.
    #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
    pub headers: std::vec::Vec<crate::model::HttpHeader>,
    /// The HTTP request body. If the body is not expected, it should be empty.
    #[serde(skip_serializing_if = "bytes::Bytes::is_empty")]
    #[serde_as(as = "serde_with::base64::Base64")]
    pub body: bytes::Bytes,
}
impl HttpRequest {
    /// Sets the value of [method][crate::model::HttpRequest::method].
    pub fn set_method<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.method = v.into();
        self
    }
    /// Sets the value of [uri][crate::model::HttpRequest::uri].
    pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.uri = v.into();
        self
    }
    /// Sets the value of [body][crate::model::HttpRequest::body].
    pub fn set_body<T: std::convert::Into<bytes::Bytes>>(mut self, v: T) -> Self {
        self.body = v.into();
        self
    }
    /// Sets the value of [headers][crate::model::HttpRequest::headers].
    pub fn set_headers<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::HttpHeader>,
    {
        use std::iter::Iterator;
        self.headers = v.into_iter().map(|i| i.into()).collect();
        self
    }
}
impl wkt::message::Message for HttpRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.rpc.HttpRequest"
    }
}
/// Represents an HTTP response.
#[serde_with::serde_as]
#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct HttpResponse {
    /// The HTTP status code, such as 200 or 404.
    pub status: i32,
    /// The HTTP reason phrase, such as "OK" or "Not Found".
    #[serde(skip_serializing_if = "std::string::String::is_empty")]
    pub reason: std::string::String,
    /// The HTTP response headers. The ordering of the headers is significant.
    /// Multiple headers with the same key may present for the response.
    #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
    pub headers: std::vec::Vec<crate::model::HttpHeader>,
    /// The HTTP response body. If the body is not expected, it should be empty.
    #[serde(skip_serializing_if = "bytes::Bytes::is_empty")]
    #[serde_as(as = "serde_with::base64::Base64")]
    pub body: bytes::Bytes,
}
impl HttpResponse {
    /// Sets the value of [status][crate::model::HttpResponse::status].
    pub fn set_status<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.status = v.into();
        self
    }
    /// Sets the value of [reason][crate::model::HttpResponse::reason].
    pub fn set_reason<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.reason = v.into();
        self
    }
    /// Sets the value of [body][crate::model::HttpResponse::body].
    pub fn set_body<T: std::convert::Into<bytes::Bytes>>(mut self, v: T) -> Self {
        self.body = v.into();
        self
    }
    /// Sets the value of [headers][crate::model::HttpResponse::headers].
    pub fn set_headers<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::HttpHeader>,
    {
        use std::iter::Iterator;
        self.headers = v.into_iter().map(|i| i.into()).collect();
        self
    }
}
impl wkt::message::Message for HttpResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.rpc.HttpResponse"
    }
}
/// Represents an HTTP header.
#[serde_with::serde_as]
#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct HttpHeader {
    /// The HTTP header key. It is case insensitive.
    #[serde(skip_serializing_if = "std::string::String::is_empty")]
    pub key: std::string::String,
    /// The HTTP header value.
    #[serde(skip_serializing_if = "std::string::String::is_empty")]
    pub value: std::string::String,
}
impl HttpHeader {
    /// Sets the value of [key][crate::model::HttpHeader::key].
    pub fn set_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.key = v.into();
        self
    }
    /// Sets the value of [value][crate::model::HttpHeader::value].
    pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.value = v.into();
        self
    }
}
impl wkt::message::Message for HttpHeader {
    fn typename() -> &'static str {
        "type.googleapis.com/google.rpc.HttpHeader"
    }
}
/// The `Status` type defines a logical error model that is suitable for
/// different programming environments, including REST APIs and RPC APIs. It is
/// used by [gRPC](https://github.com/grpc). Each `Status` message contains
/// three pieces of data: error code, error message, and error details.
///
/// You can find out more about this error model and how to work with it in the
/// [API Design Guide](https://cloud.google.com/apis/design/errors).
#[serde_with::serde_as]
#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct Status {
    /// The status code, which should be an enum value of
    /// [google.rpc.Code][google.rpc.Code].
    ///
    /// [google.rpc.Code]: crate::model::Code
    pub code: i32,
    /// A developer-facing error message, which should be in English. Any
    /// user-facing error message should be localized and sent in the
    /// [google.rpc.Status.details][google.rpc.Status.details] field, or localized
    /// by the client.
    ///
    /// [google.rpc.Status.details]: crate::model::Status::details
    #[serde(skip_serializing_if = "std::string::String::is_empty")]
    pub message: std::string::String,
    /// A list of messages that carry the error details.  There is a common set of
    /// message types for APIs to use.
    #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
    pub details: std::vec::Vec<wkt::Any>,
}
impl Status {
    /// Sets the value of [code][crate::model::Status::code].
    pub fn set_code<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.code = v.into();
        self
    }
    /// Sets the value of [message][crate::model::Status::message].
    pub fn set_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.message = v.into();
        self
    }
    /// Sets the value of [details][crate::model::Status::details].
    pub fn set_details<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<wkt::Any>,
    {
        use std::iter::Iterator;
        self.details = v.into_iter().map(|i| i.into()).collect();
        self
    }
}
impl wkt::message::Message for Status {
    fn typename() -> &'static str {
        "type.googleapis.com/google.rpc.Status"
    }
}
/// The canonical error codes for gRPC APIs.
///
/// Sometimes multiple error codes may apply.  Services should return
/// the most specific error code that applies.  For example, prefer
/// `OUT_OF_RANGE` over `FAILED_PRECONDITION` if both codes apply.
/// Similarly prefer `NOT_FOUND` or `ALREADY_EXISTS` over `FAILED_PRECONDITION`.
#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
pub struct Code(std::borrow::Cow<'static, str>);
impl Code {
    /// Creates a new Code instance.
    pub const fn new(v: &'static str) -> Self {
        Self(std::borrow::Cow::Borrowed(v))
    }
    /// Gets the enum value.
    pub fn value(&self) -> &str {
        &self.0
    }
}
/// Useful constants to work with [Code](Code)
pub mod code {
    use super::Code;
    /// Not an error; returned on success.
    ///
    /// HTTP Mapping: 200 OK
    pub const OK: Code = Code::new("OK");
    /// The operation was cancelled, typically by the caller.
    ///
    /// HTTP Mapping: 499 Client Closed Request
    pub const CANCELLED: Code = Code::new("CANCELLED");
    /// Unknown error.  For example, this error may be returned when
    /// a `Status` value received from another address space belongs to
    /// an error space that is not known in this address space.  Also
    /// errors raised by APIs that do not return enough error information
    /// may be converted to this error.
    ///
    /// HTTP Mapping: 500 Internal Server Error
    pub const UNKNOWN: Code = Code::new("UNKNOWN");
    /// The client specified an invalid argument.  Note that this differs
    /// from `FAILED_PRECONDITION`.  `INVALID_ARGUMENT` indicates arguments
    /// that are problematic regardless of the state of the system
    /// (e.g., a malformed file name).
    ///
    /// HTTP Mapping: 400 Bad Request
    pub const INVALID_ARGUMENT: Code = Code::new("INVALID_ARGUMENT");
    /// The deadline expired before the operation could complete. For operations
    /// that change the state of the system, this error may be returned
    /// even if the operation has completed successfully.  For example, a
    /// successful response from a server could have been delayed long
    /// enough for the deadline to expire.
    ///
    /// HTTP Mapping: 504 Gateway Timeout
    pub const DEADLINE_EXCEEDED: Code = Code::new("DEADLINE_EXCEEDED");
    /// Some requested entity (e.g., file or directory) was not found.
    ///
    /// Note to server developers: if a request is denied for an entire class
    /// of users, such as gradual feature rollout or undocumented allowlist,
    /// `NOT_FOUND` may be used. If a request is denied for some users within
    /// a class of users, such as user-based access control, `PERMISSION_DENIED`
    /// must be used.
    ///
    /// HTTP Mapping: 404 Not Found
    pub const NOT_FOUND: Code = Code::new("NOT_FOUND");
    /// The entity that a client attempted to create (e.g., file or directory)
    /// already exists.
    ///
    /// HTTP Mapping: 409 Conflict
    pub const ALREADY_EXISTS: Code = Code::new("ALREADY_EXISTS");
    /// The caller does not have permission to execute the specified
    /// operation. `PERMISSION_DENIED` must not be used for rejections
    /// caused by exhausting some resource (use `RESOURCE_EXHAUSTED`
    /// instead for those errors). `PERMISSION_DENIED` must not be
    /// used if the caller can not be identified (use `UNAUTHENTICATED`
    /// instead for those errors). This error code does not imply the
    /// request is valid or the requested entity exists or satisfies
    /// other pre-conditions.
    ///
    /// HTTP Mapping: 403 Forbidden
    pub const PERMISSION_DENIED: Code = Code::new("PERMISSION_DENIED");
    /// The request does not have valid authentication credentials for the
    /// operation.
    ///
    /// HTTP Mapping: 401 Unauthorized
    pub const UNAUTHENTICATED: Code = Code::new("UNAUTHENTICATED");
    /// Some resource has been exhausted, perhaps a per-user quota, or
    /// perhaps the entire file system is out of space.
    ///
    /// HTTP Mapping: 429 Too Many Requests
    pub const RESOURCE_EXHAUSTED: Code = Code::new("RESOURCE_EXHAUSTED");
    /// The operation was rejected because the system is not in a state
    /// required for the operation's execution.  For example, the directory
    /// to be deleted is non-empty, an rmdir operation is applied to
    /// a non-directory, etc.
    ///
    /// Service implementors can use the following guidelines to decide
    /// between `FAILED_PRECONDITION`, `ABORTED`, and `UNAVAILABLE`:
    /// (a) Use `UNAVAILABLE` if the client can retry just the failing call.
    /// (b) Use `ABORTED` if the client should retry at a higher level. For
    /// example, when a client-specified test-and-set fails, indicating the
    /// client should restart a read-modify-write sequence.
    /// (c) Use `FAILED_PRECONDITION` if the client should not retry until
    /// the system state has been explicitly fixed. For example, if an "rmdir"
    /// fails because the directory is non-empty, `FAILED_PRECONDITION`
    /// should be returned since the client should not retry unless
    /// the files are deleted from the directory.
    ///
    /// HTTP Mapping: 400 Bad Request
    pub const FAILED_PRECONDITION: Code = Code::new("FAILED_PRECONDITION");
    /// The operation was aborted, typically due to a concurrency issue such as
    /// a sequencer check failure or transaction abort.
    ///
    /// See the guidelines above for deciding between `FAILED_PRECONDITION`,
    /// `ABORTED`, and `UNAVAILABLE`.
    ///
    /// HTTP Mapping: 409 Conflict
    pub const ABORTED: Code = Code::new("ABORTED");
    /// The operation was attempted past the valid range.  E.g., seeking or
    /// reading past end-of-file.
    ///
    /// Unlike `INVALID_ARGUMENT`, this error indicates a problem that may
    /// be fixed if the system state changes. For example, a 32-bit file
    /// system will generate `INVALID_ARGUMENT` if asked to read at an
    /// offset that is not in the range [0,2^32-1], but it will generate
    /// `OUT_OF_RANGE` if asked to read from an offset past the current
    /// file size.
    ///
    /// There is a fair bit of overlap between `FAILED_PRECONDITION` and
    /// `OUT_OF_RANGE`.  We recommend using `OUT_OF_RANGE` (the more specific
    /// error) when it applies so that callers who are iterating through
    /// a space can easily look for an `OUT_OF_RANGE` error to detect when
    /// they are done.
    ///
    /// HTTP Mapping: 400 Bad Request
    pub const OUT_OF_RANGE: Code = Code::new("OUT_OF_RANGE");
    /// The operation is not implemented or is not supported/enabled in this
    /// service.
    ///
    /// HTTP Mapping: 501 Not Implemented
    pub const UNIMPLEMENTED: Code = Code::new("UNIMPLEMENTED");
    /// Internal errors.  This means that some invariants expected by the
    /// underlying system have been broken.  This error code is reserved
    /// for serious errors.
    ///
    /// HTTP Mapping: 500 Internal Server Error
    pub const INTERNAL: Code = Code::new("INTERNAL");
    /// The service is currently unavailable.  This is most likely a
    /// transient condition, which can be corrected by retrying with
    /// a backoff. Note that it is not always safe to retry
    /// non-idempotent operations.
    ///
    /// See the guidelines above for deciding between `FAILED_PRECONDITION`,
    /// `ABORTED`, and `UNAVAILABLE`.
    ///
    /// HTTP Mapping: 503 Service Unavailable
    pub const UNAVAILABLE: Code = Code::new("UNAVAILABLE");
    /// Unrecoverable data loss or corruption.
    ///
    /// HTTP Mapping: 500 Internal Server Error
    pub const DATA_LOSS: Code = Code::new("DATA_LOSS");
}
impl std::convert::From<std::string::String> for Code {
    fn from(value: std::string::String) -> Self {
        Self(std::borrow::Cow::Owned(value))
    }
}