|
| 1 | +# Copyright 2026 Google LLC |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | +"""The abstract for python-storage Blob.""" |
| 15 | + |
| 16 | +import abc |
| 17 | + |
| 18 | + |
| 19 | +class BaseBlob(abc.ABC): |
| 20 | + """The abstract for python-storage Blob""" |
| 21 | + |
| 22 | + @property |
| 23 | + @abc.abstractmethod |
| 24 | + def encryption_key(self): |
| 25 | + """Retrieve the customer-supplied encryption key for the object.""" |
| 26 | + raise NotImplementedError("Not Yet Implemented") |
| 27 | + |
| 28 | + @encryption_key.setter |
| 29 | + @abc.abstractmethod |
| 30 | + def encryption_key(self, value): |
| 31 | + """Set the blob's encryption key.""" |
| 32 | + raise NotImplementedError("Not Yet Implemented") |
| 33 | + |
| 34 | + @property |
| 35 | + @abc.abstractmethod |
| 36 | + def chunk_size(self): |
| 37 | + """Get the blob's default chunk size.""" |
| 38 | + raise NotImplementedError("Not Yet Implemented") |
| 39 | + |
| 40 | + @chunk_size.setter |
| 41 | + @abc.abstractmethod |
| 42 | + def chunk_size(self, value): |
| 43 | + """Set the blob's default chunk size.""" |
| 44 | + raise NotImplementedError("Not Yet Implemented") |
| 45 | + |
| 46 | + @property |
| 47 | + @abc.abstractmethod |
| 48 | + def metadata(self): |
| 49 | + """Retrieve arbitrary/application specific metadata for the object.""" |
| 50 | + raise NotImplementedError("Not Yet Implemented") |
| 51 | + |
| 52 | + @metadata.setter |
| 53 | + @abc.abstractmethod |
| 54 | + def metadata(self, value): |
| 55 | + """Update arbitrary/application specific metadata for the object.""" |
| 56 | + raise NotImplementedError("Not Yet Implemented") |
| 57 | + |
| 58 | + @property |
| 59 | + @abc.abstractmethod |
| 60 | + def kms_key_name(self): |
| 61 | + """Resource name of Cloud KMS key used to encrypt the blob's contents.""" |
| 62 | + raise NotImplementedError("Not Yet Implemented") |
| 63 | + |
| 64 | + @kms_key_name.setter |
| 65 | + @abc.abstractmethod |
| 66 | + def kms_key_name(self, value): |
| 67 | + """Set KMS encryption key for object.""" |
| 68 | + raise NotImplementedError("Not Yet Implemented") |
| 69 | + |
| 70 | + @property |
| 71 | + @abc.abstractmethod |
| 72 | + def custom_time(self): |
| 73 | + """Retrieve the custom time for the object.""" |
| 74 | + raise NotImplementedError("Not Yet Implemented") |
| 75 | + |
| 76 | + @custom_time.setter |
| 77 | + @abc.abstractmethod |
| 78 | + def custom_time(self, value): |
| 79 | + """Set the custom time for the object.""" |
| 80 | + raise NotImplementedError("Not Yet Implemented") |
| 81 | + |
| 82 | + @property |
| 83 | + @abc.abstractmethod |
| 84 | + def bucket(self): |
| 85 | + """Bucket which contains the object.""" |
| 86 | + raise NotImplementedError("Not Yet Implemented") |
| 87 | + |
| 88 | + @property |
| 89 | + @abc.abstractmethod |
| 90 | + def acl(self): |
| 91 | + """Create our ACL on demand.""" |
| 92 | + raise NotImplementedError("Not Yet Implemented") |
| 93 | + |
| 94 | + @property |
| 95 | + @abc.abstractmethod |
| 96 | + def path(self): |
| 97 | + """Getter property for the URL path to this Blob.""" |
| 98 | + raise NotImplementedError("Not Yet Implemented") |
| 99 | + |
| 100 | + @property |
| 101 | + @abc.abstractmethod |
| 102 | + def client(self): |
| 103 | + """The client bound to this blob.""" |
| 104 | + raise NotImplementedError("Not Yet Implemented") |
| 105 | + |
| 106 | + @property |
| 107 | + @abc.abstractmethod |
| 108 | + def user_project(self): |
| 109 | + """Project ID billed for API requests made via this blob.""" |
| 110 | + raise NotImplementedError("Not Yet Implemented") |
| 111 | + |
| 112 | + @property |
| 113 | + @abc.abstractmethod |
| 114 | + def public_url(self): |
| 115 | + """The public URL for this blob.""" |
| 116 | + raise NotImplementedError("Not Yet Implemented") |
| 117 | + |
| 118 | + @property |
| 119 | + @abc.abstractmethod |
| 120 | + def component_count(self): |
| 121 | + """Number of underlying components that make up this object.""" |
| 122 | + raise NotImplementedError("Not Yet Implemented") |
| 123 | + |
| 124 | + @property |
| 125 | + @abc.abstractmethod |
| 126 | + def etag(self): |
| 127 | + """Retrieve the ETag for the object.""" |
| 128 | + raise NotImplementedError("Not Yet Implemented") |
| 129 | + |
| 130 | + @property |
| 131 | + @abc.abstractmethod |
| 132 | + def generation(self): |
| 133 | + """Retrieve the generation for the object.""" |
| 134 | + raise NotImplementedError("Not Yet Implemented") |
| 135 | + |
| 136 | + @property |
| 137 | + @abc.abstractmethod |
| 138 | + def id(self): |
| 139 | + """Retrieve the ID for the object.""" |
| 140 | + raise NotImplementedError("Not Yet Implemented") |
| 141 | + |
| 142 | + @property |
| 143 | + @abc.abstractmethod |
| 144 | + def media_link(self): |
| 145 | + """Retrieve the media download URI for the object.""" |
| 146 | + raise NotImplementedError("Not Yet Implemented") |
| 147 | + |
| 148 | + @property |
| 149 | + @abc.abstractmethod |
| 150 | + def metageneration(self): |
| 151 | + """Retrieve the metageneration for the object.""" |
| 152 | + raise NotImplementedError("Not Yet Implemented") |
| 153 | + |
| 154 | + @property |
| 155 | + @abc.abstractmethod |
| 156 | + def owner(self): |
| 157 | + """Retrieve info about the owner of the object.""" |
| 158 | + raise NotImplementedError("Not Yet Implemented") |
| 159 | + |
| 160 | + @property |
| 161 | + @abc.abstractmethod |
| 162 | + def retention_expiration_time(self): |
| 163 | + """Retrieve timestamp at which the object's retention period expires.""" |
| 164 | + raise NotImplementedError("Not Yet Implemented") |
| 165 | + |
| 166 | + @property |
| 167 | + @abc.abstractmethod |
| 168 | + def self_link(self): |
| 169 | + """Retrieve the URI for the object.""" |
| 170 | + raise NotImplementedError("Not Yet Implemented") |
| 171 | + |
| 172 | + @property |
| 173 | + @abc.abstractmethod |
| 174 | + def size(self): |
| 175 | + """Size of the object, in bytes.""" |
| 176 | + raise NotImplementedError("Not Yet Implemented") |
| 177 | + |
| 178 | + @property |
| 179 | + @abc.abstractmethod |
| 180 | + def time_deleted(self): |
| 181 | + """Retrieve the timestamp at which the object was deleted.""" |
| 182 | + raise NotImplementedError("Not Yet Implemented") |
| 183 | + |
| 184 | + @property |
| 185 | + @abc.abstractmethod |
| 186 | + def time_created(self): |
| 187 | + """Retrieve the timestamp at which the object was created.""" |
| 188 | + raise NotImplementedError("Not Yet Implemented") |
| 189 | + |
| 190 | + @property |
| 191 | + @abc.abstractmethod |
| 192 | + def updated(self): |
| 193 | + """Retrieve the timestamp at which the object was updated.""" |
| 194 | + raise NotImplementedError("Not Yet Implemented") |
| 195 | + |
| 196 | + @property |
| 197 | + @abc.abstractmethod |
| 198 | + def retention(self): |
| 199 | + """Retrieve the retention configuration for this object.""" |
| 200 | + raise NotImplementedError("Not Yet Implemented") |
| 201 | + |
| 202 | + @property |
| 203 | + @abc.abstractmethod |
| 204 | + def soft_delete_time(self): |
| 205 | + """If this object has been soft-deleted, returns the time at which it became soft-deleted.""" |
| 206 | + raise NotImplementedError("Not Yet Implemented") |
| 207 | + |
| 208 | + @property |
| 209 | + @abc.abstractmethod |
| 210 | + def hard_delete_time(self): |
| 211 | + """If this object has been soft-deleted, returns the time at which it will be permanently deleted.""" |
| 212 | + raise NotImplementedError("Not Yet Implemented") |
| 213 | + |
| 214 | + @abc.abstractmethod |
| 215 | + def reload( |
| 216 | + self, |
| 217 | + client=None, |
| 218 | + projection="noAcl", |
| 219 | + if_etag_match=None, |
| 220 | + if_etag_not_match=None, |
| 221 | + if_generation_match=None, |
| 222 | + if_generation_not_match=None, |
| 223 | + if_metageneration_match=None, |
| 224 | + if_metageneration_not_match=None, |
| 225 | + timeout=None, |
| 226 | + retry=None, |
| 227 | + soft_deleted=None, |
| 228 | + ): |
| 229 | + raise NotImplementedError("Not Yet Implemented.") |
| 230 | + |
| 231 | + @abc.abstractmethod |
| 232 | + def open( |
| 233 | + self, |
| 234 | + mode="r", |
| 235 | + chunk_size=None, |
| 236 | + ignore_flush=None, |
| 237 | + encoding=None, |
| 238 | + errors=None, |
| 239 | + newline=None, |
| 240 | + **kwargs, |
| 241 | + ): |
| 242 | + """Create a file handler for file-like I/O to or from this blob.""" |
| 243 | + raise NotImplementedError("Not Yet Implemented") |
0 commit comments