Skip to content

Commit ba36be8

Browse files
committed
feat(storage): Add few abstractmethod in the base class
1 parent 90d5105 commit ba36be8

File tree

1 file changed

+89
-1
lines changed

1 file changed

+89
-1
lines changed

google/cloud/storage/abstracts/base_client.py

Lines changed: 89 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
from google.cloud.client import ClientWithProject
2424
from google.cloud._helpers import _LocalStack
2525
from google.auth.transport import mtls
26-
from abc import ABC
26+
from abc import ABC, abstractmethod
2727

2828
import os
2929
import google.api_core.client_options
@@ -291,3 +291,91 @@ def current_batch(self):
291291
:returns: The batch at the top of the batch stack.
292292
"""
293293
return self._batch_stack.top
294+
295+
@abstractmethod
296+
def bucket(self, bucket_name, user_project=None, generation=None):
297+
raise NotImplementedError("This method needs to be implemented.")
298+
299+
@abstractmethod
300+
def _get_resource(
301+
self,
302+
path,
303+
query_params=None,
304+
headers=None,
305+
timeout=None,
306+
retry=None,
307+
_target_object=None,
308+
):
309+
"""Helper for bucket / blob methods making API 'GET' calls."""
310+
raise NotImplementedError("This should be implemented via the child class")
311+
312+
@abstractmethod
313+
def _list_resource(
314+
self,
315+
path,
316+
item_to_value,
317+
page_token=None,
318+
max_results=None,
319+
extra_params=None,
320+
page_start=None,
321+
page_size=None,
322+
timeout=None,
323+
retry=None,
324+
):
325+
"""Helper for bucket / blob methods making API 'GET' calls."""
326+
raise NotImplementedError("This should be implemented via the child class")
327+
328+
@abstractmethod
329+
def _patch_resource(
330+
self,
331+
path,
332+
data,
333+
query_params=None,
334+
headers=None,
335+
timeout=None,
336+
retry=None,
337+
_target_object=None,
338+
):
339+
"""Helper for bucket / blob methods making API 'PATCH' calls."""
340+
raise NotImplementedError("This should be implemented via the child class")
341+
342+
@abstractmethod
343+
def _put_resource(
344+
self,
345+
path,
346+
data,
347+
query_params=None,
348+
headers=None,
349+
timeout=None,
350+
retry=None,
351+
_target_object=None,
352+
):
353+
"""Helper for bucket / blob methods making API 'PUT' calls."""
354+
raise NotImplementedError("This should be implemented via the child class")
355+
356+
@abstractmethod
357+
def _post_resource(
358+
self,
359+
path,
360+
data,
361+
query_params=None,
362+
headers=None,
363+
timeout=None,
364+
retry=None,
365+
_target_object=None,
366+
):
367+
"""Helper for bucket / blob methods making API 'POST' calls."""
368+
raise NotImplementedError("This should be implemented via the child class")
369+
370+
@abstractmethod
371+
def _delete_resource(
372+
self,
373+
path,
374+
query_params=None,
375+
headers=None,
376+
timeout=None,
377+
retry=None,
378+
_target_object=None,
379+
):
380+
"""Helper for bucket / blob methods making API 'DELETE' calls."""
381+
raise NotImplementedError("This should be implemented via the child class")

0 commit comments

Comments
 (0)