diff options
author | Nathan Dench <ndenc2@gmail.com> | 2019-05-24 15:16:44 +1000 |
---|---|---|
committer | Nathan Dench <ndenc2@gmail.com> | 2019-05-24 15:16:44 +1000 |
commit | 107c1cdb09c575aa2f61d97f48d8587eb6bada4c (patch) | |
tree | ca7d008643efc555c388baeaf1d986e0b6b3e28c /vendor/google.golang.org/grpc/codes | |
parent | 844b5a68d8af4791755b8f0ad293cc99f5959183 (diff) | |
download | terraform-provider-statuscake-107c1cdb09c575aa2f61d97f48d8587eb6bada4c.tar.gz terraform-provider-statuscake-107c1cdb09c575aa2f61d97f48d8587eb6bada4c.tar.zst terraform-provider-statuscake-107c1cdb09c575aa2f61d97f48d8587eb6bada4c.zip |
Upgrade to 0.12
Diffstat (limited to 'vendor/google.golang.org/grpc/codes')
-rw-r--r-- | vendor/google.golang.org/grpc/codes/code_string.go | 66 | ||||
-rw-r--r-- | vendor/google.golang.org/grpc/codes/codes.go | 79 |
2 files changed, 122 insertions, 23 deletions
diff --git a/vendor/google.golang.org/grpc/codes/code_string.go b/vendor/google.golang.org/grpc/codes/code_string.go index e6762d0..0b206a5 100644 --- a/vendor/google.golang.org/grpc/codes/code_string.go +++ b/vendor/google.golang.org/grpc/codes/code_string.go | |||
@@ -1,16 +1,62 @@ | |||
1 | // generated by stringer -type=Code; DO NOT EDIT | 1 | /* |
2 | * | ||
3 | * Copyright 2017 gRPC authors. | ||
4 | * | ||
5 | * Licensed under the Apache License, Version 2.0 (the "License"); | ||
6 | * you may not use this file except in compliance with the License. | ||
7 | * You may obtain a copy of the License at | ||
8 | * | ||
9 | * http://www.apache.org/licenses/LICENSE-2.0 | ||
10 | * | ||
11 | * Unless required by applicable law or agreed to in writing, software | ||
12 | * distributed under the License is distributed on an "AS IS" BASIS, | ||
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
14 | * See the License for the specific language governing permissions and | ||
15 | * limitations under the License. | ||
16 | * | ||
17 | */ | ||
2 | 18 | ||
3 | package codes | 19 | package codes |
4 | 20 | ||
5 | import "fmt" | 21 | import "strconv" |
6 | 22 | ||
7 | const _Code_name = "OKCanceledUnknownInvalidArgumentDeadlineExceededNotFoundAlreadyExistsPermissionDeniedResourceExhaustedFailedPreconditionAbortedOutOfRangeUnimplementedInternalUnavailableDataLossUnauthenticated" | 23 | func (c Code) String() string { |
8 | 24 | switch c { | |
9 | var _Code_index = [...]uint8{0, 2, 10, 17, 32, 48, 56, 69, 85, 102, 120, 127, 137, 150, 158, 169, 177, 192} | 25 | case OK: |
10 | 26 | return "OK" | |
11 | func (i Code) String() string { | 27 | case Canceled: |
12 | if i+1 >= Code(len(_Code_index)) { | 28 | return "Canceled" |
13 | return fmt.Sprintf("Code(%d)", i) | 29 | case Unknown: |
30 | return "Unknown" | ||
31 | case InvalidArgument: | ||
32 | return "InvalidArgument" | ||
33 | case DeadlineExceeded: | ||
34 | return "DeadlineExceeded" | ||
35 | case NotFound: | ||
36 | return "NotFound" | ||
37 | case AlreadyExists: | ||
38 | return "AlreadyExists" | ||
39 | case PermissionDenied: | ||
40 | return "PermissionDenied" | ||
41 | case ResourceExhausted: | ||
42 | return "ResourceExhausted" | ||
43 | case FailedPrecondition: | ||
44 | return "FailedPrecondition" | ||
45 | case Aborted: | ||
46 | return "Aborted" | ||
47 | case OutOfRange: | ||
48 | return "OutOfRange" | ||
49 | case Unimplemented: | ||
50 | return "Unimplemented" | ||
51 | case Internal: | ||
52 | return "Internal" | ||
53 | case Unavailable: | ||
54 | return "Unavailable" | ||
55 | case DataLoss: | ||
56 | return "DataLoss" | ||
57 | case Unauthenticated: | ||
58 | return "Unauthenticated" | ||
59 | default: | ||
60 | return "Code(" + strconv.FormatInt(int64(c), 10) + ")" | ||
14 | } | 61 | } |
15 | return _Code_name[_Code_index[i]:_Code_index[i+1]] | ||
16 | } | 62 | } |
diff --git a/vendor/google.golang.org/grpc/codes/codes.go b/vendor/google.golang.org/grpc/codes/codes.go index 21e7733..d9b9d57 100644 --- a/vendor/google.golang.org/grpc/codes/codes.go +++ b/vendor/google.golang.org/grpc/codes/codes.go | |||
@@ -20,11 +20,14 @@ | |||
20 | // consistent across various languages. | 20 | // consistent across various languages. |
21 | package codes // import "google.golang.org/grpc/codes" | 21 | package codes // import "google.golang.org/grpc/codes" |
22 | 22 | ||
23 | import ( | ||
24 | "fmt" | ||
25 | "strconv" | ||
26 | ) | ||
27 | |||
23 | // A Code is an unsigned 32-bit error code as defined in the gRPC spec. | 28 | // A Code is an unsigned 32-bit error code as defined in the gRPC spec. |
24 | type Code uint32 | 29 | type Code uint32 |
25 | 30 | ||
26 | //go:generate stringer -type=Code | ||
27 | |||
28 | const ( | 31 | const ( |
29 | // OK is returned on success. | 32 | // OK is returned on success. |
30 | OK Code = 0 | 33 | OK Code = 0 |
@@ -32,9 +35,9 @@ const ( | |||
32 | // Canceled indicates the operation was canceled (typically by the caller). | 35 | // Canceled indicates the operation was canceled (typically by the caller). |
33 | Canceled Code = 1 | 36 | Canceled Code = 1 |
34 | 37 | ||
35 | // Unknown error. An example of where this error may be returned is | 38 | // Unknown error. An example of where this error may be returned is |
36 | // if a Status value received from another address space belongs to | 39 | // if a Status value received from another address space belongs to |
37 | // an error-space that is not known in this address space. Also | 40 | // an error-space that is not known in this address space. Also |
38 | // errors raised by APIs that do not return enough error information | 41 | // errors raised by APIs that do not return enough error information |
39 | // may be converted to this error. | 42 | // may be converted to this error. |
40 | Unknown Code = 2 | 43 | Unknown Code = 2 |
@@ -63,15 +66,11 @@ const ( | |||
63 | // PermissionDenied indicates the caller does not have permission to | 66 | // PermissionDenied indicates the caller does not have permission to |
64 | // execute the specified operation. It must not be used for rejections | 67 | // execute the specified operation. It must not be used for rejections |
65 | // caused by exhausting some resource (use ResourceExhausted | 68 | // caused by exhausting some resource (use ResourceExhausted |
66 | // instead for those errors). It must not be | 69 | // instead for those errors). It must not be |
67 | // used if the caller cannot be identified (use Unauthenticated | 70 | // used if the caller cannot be identified (use Unauthenticated |
68 | // instead for those errors). | 71 | // instead for those errors). |
69 | PermissionDenied Code = 7 | 72 | PermissionDenied Code = 7 |
70 | 73 | ||
71 | // Unauthenticated indicates the request does not have valid | ||
72 | // authentication credentials for the operation. | ||
73 | Unauthenticated Code = 16 | ||
74 | |||
75 | // ResourceExhausted indicates some resource has been exhausted, perhaps | 74 | // ResourceExhausted indicates some resource has been exhausted, perhaps |
76 | // a per-user quota, or perhaps the entire file system is out of space. | 75 | // a per-user quota, or perhaps the entire file system is out of space. |
77 | ResourceExhausted Code = 8 | 76 | ResourceExhausted Code = 8 |
@@ -87,7 +86,7 @@ const ( | |||
87 | // (b) Use Aborted if the client should retry at a higher-level | 86 | // (b) Use Aborted if the client should retry at a higher-level |
88 | // (e.g., restarting a read-modify-write sequence). | 87 | // (e.g., restarting a read-modify-write sequence). |
89 | // (c) Use FailedPrecondition if the client should not retry until | 88 | // (c) Use FailedPrecondition if the client should not retry until |
90 | // the system state has been explicitly fixed. E.g., if an "rmdir" | 89 | // the system state has been explicitly fixed. E.g., if an "rmdir" |
91 | // fails because the directory is non-empty, FailedPrecondition | 90 | // fails because the directory is non-empty, FailedPrecondition |
92 | // should be returned since the client should not retry unless | 91 | // should be returned since the client should not retry unless |
93 | // they have first fixed up the directory by deleting files from it. | 92 | // they have first fixed up the directory by deleting files from it. |
@@ -116,7 +115,7 @@ const ( | |||
116 | // file size. | 115 | // file size. |
117 | // | 116 | // |
118 | // There is a fair bit of overlap between FailedPrecondition and | 117 | // There is a fair bit of overlap between FailedPrecondition and |
119 | // OutOfRange. We recommend using OutOfRange (the more specific | 118 | // OutOfRange. We recommend using OutOfRange (the more specific |
120 | // error) when it applies so that callers who are iterating through | 119 | // error) when it applies so that callers who are iterating through |
121 | // a space can easily look for an OutOfRange error to detect when | 120 | // a space can easily look for an OutOfRange error to detect when |
122 | // they are done. | 121 | // they are done. |
@@ -126,8 +125,8 @@ const ( | |||
126 | // supported/enabled in this service. | 125 | // supported/enabled in this service. |
127 | Unimplemented Code = 12 | 126 | Unimplemented Code = 12 |
128 | 127 | ||
129 | // Internal errors. Means some invariants expected by underlying | 128 | // Internal errors. Means some invariants expected by underlying |
130 | // system has been broken. If you see one of these errors, | 129 | // system has been broken. If you see one of these errors, |
131 | // something is very broken. | 130 | // something is very broken. |
132 | Internal Code = 13 | 131 | Internal Code = 13 |
133 | 132 | ||
@@ -141,4 +140,58 @@ const ( | |||
141 | 140 | ||
142 | // DataLoss indicates unrecoverable data loss or corruption. | 141 | // DataLoss indicates unrecoverable data loss or corruption. |
143 | DataLoss Code = 15 | 142 | DataLoss Code = 15 |
143 | |||
144 | // Unauthenticated indicates the request does not have valid | ||
145 | // authentication credentials for the operation. | ||
146 | Unauthenticated Code = 16 | ||
147 | |||
148 | _maxCode = 17 | ||
144 | ) | 149 | ) |
150 | |||
151 | var strToCode = map[string]Code{ | ||
152 | `"OK"`: OK, | ||
153 | `"CANCELLED"`:/* [sic] */ Canceled, | ||
154 | `"UNKNOWN"`: Unknown, | ||
155 | `"INVALID_ARGUMENT"`: InvalidArgument, | ||
156 | `"DEADLINE_EXCEEDED"`: DeadlineExceeded, | ||
157 | `"NOT_FOUND"`: NotFound, | ||
158 | `"ALREADY_EXISTS"`: AlreadyExists, | ||
159 | `"PERMISSION_DENIED"`: PermissionDenied, | ||
160 | `"RESOURCE_EXHAUSTED"`: ResourceExhausted, | ||
161 | `"FAILED_PRECONDITION"`: FailedPrecondition, | ||
162 | `"ABORTED"`: Aborted, | ||
163 | `"OUT_OF_RANGE"`: OutOfRange, | ||
164 | `"UNIMPLEMENTED"`: Unimplemented, | ||
165 | `"INTERNAL"`: Internal, | ||
166 | `"UNAVAILABLE"`: Unavailable, | ||
167 | `"DATA_LOSS"`: DataLoss, | ||
168 | `"UNAUTHENTICATED"`: Unauthenticated, | ||
169 | } | ||
170 | |||
171 | // UnmarshalJSON unmarshals b into the Code. | ||
172 | func (c *Code) UnmarshalJSON(b []byte) error { | ||
173 | // From json.Unmarshaler: By convention, to approximate the behavior of | ||
174 | // Unmarshal itself, Unmarshalers implement UnmarshalJSON([]byte("null")) as | ||
175 | // a no-op. | ||
176 | if string(b) == "null" { | ||
177 | return nil | ||
178 | } | ||
179 | if c == nil { | ||
180 | return fmt.Errorf("nil receiver passed to UnmarshalJSON") | ||
181 | } | ||
182 | |||
183 | if ci, err := strconv.ParseUint(string(b), 10, 32); err == nil { | ||
184 | if ci >= _maxCode { | ||
185 | return fmt.Errorf("invalid code: %q", ci) | ||
186 | } | ||
187 | |||
188 | *c = Code(ci) | ||
189 | return nil | ||
190 | } | ||
191 | |||
192 | if jc, ok := strToCode[string(b)]; ok { | ||
193 | *c = jc | ||
194 | return nil | ||
195 | } | ||
196 | return fmt.Errorf("invalid code: %q", string(b)) | ||
197 | } | ||