Skip to content

Commit

Permalink
Remove status code property from snapshot object.
Browse files Browse the repository at this point in the history
  • Loading branch information
albertofori committed Jul 13, 2023
1 parent 0cc2d35 commit 71fb2de
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ def _snapshot_output_format_group(item):
('RETENTION PERIOD', _get_value_by_names(item, ['retentionPeriod', 'retention_period'])),
('SIZE', _get_value(item, 'size')),
('STATUS', _get_value(item, 'status')),
('STATUS CODE', _get_value_by_names(item, ['statusCode', 'status_code'])),
('ITEMS COUNT', _get_value_by_names(item, ['itemsCount', 'items_count'])),
('TAGS', _get_value(item, 'tags')),
])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def load_arguments(self, _):
nargs='+',
help='Customize output fields for Snapshots',
validator=validate_snapshot_query_fields,
arg_type=get_enum_type(['name', 'etag', 'status_code', 'retention_period', 'filters', 'status', 'created', 'expires', 'size', 'items_count', 'composition_type', 'tags'])
arg_type=get_enum_type(['name', 'etag', 'retention_period', 'filters', 'status', 'created', 'expires', 'size', 'items_count', 'composition_type', 'tags'])
)
filter_parameters_arg_type = CLIArgumentType(
validator=validate_filter_parameters,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,9 @@ class SnapshotQueryFields(Enum):
SIZE = 0x0040
ITEMS_COUNT = 0x0080
TAGS = 0x0100
STATUS_CODE = 0x0200
ETAG = 0x0200
RETENTION_PERIOD = 0x0400
ETAG = 0x0800
ALL = NAME | STATUS | FILTERS | COMPOSITION_TYPE | CREATED | EXPIRES | SIZE | ITEMS_COUNT | TAGS | RETENTION_PERIOD | ETAG | STATUS_CODE
ALL = NAME | STATUS | FILTERS | COMPOSITION_TYPE | CREATED | EXPIRES | SIZE | ITEMS_COUNT | TAGS | ETAG | RETENTION_PERIOD


class Snapshot:
Expand Down Expand Up @@ -53,16 +52,13 @@ class Snapshot:
Dictionary of tags of the snapshot.
:ivar int retention_period:
Number of seconds for which an archived snapshot will be kept before being deleted.
:ivar int status_code:
The status code returned during the snapshot creation process.
'''

def __init__(self,
name,
status,
filters,
etag=None,
status_code=None,
composition_type=None,
created=None,
expires=None,
Expand All @@ -75,7 +71,6 @@ def __init__(self,
self.name = name
self.status = status
self.filters = filters
self.status_code = status_code
self.etag = etag
self.composition_type = composition_type
self.created = created.isoformat() if isinstance(created, datetime) else str(created)
Expand All @@ -96,8 +91,7 @@ def __str__(self):
"\nSize: " + str(self.size) + \
"\nItem count: " + str(self.items_count) + \
"\nTags: " + (str(self.tags) if self.tags else '{}') + \
"\nRetention Period: " + str(self.retention_period) + \
"\nStatus Code: " + str(self.status_code)
"\nRetention Period: " + str(self.retention_period)

@classmethod
def from_json(cls, data_dict):
Expand All @@ -112,8 +106,7 @@ def from_json(cls, data_dict):
size=data_dict.get("size", None),
items_count=data_dict.get("items_count", None),
tags=data_dict.get("tags", None),
retention_period=data_dict.get("retention_period", None),
status_code=data_dict.get("status_code", None)
retention_period=data_dict.get("retention_period", None)
)


Expand Down

0 comments on commit 71fb2de

Please sign in to comment.