| 1 | =begin comment | ||
| 2 | |||
| 3 | Fastly API | ||
| 4 | |||
| 5 | Via the Fastly API you can perform any of the operations that are possible within the management console, including creating services, domains, and backends, configuring rules or uploading your own application code, as well as account operations such as user administration and billing reports. The API is organized into collections of endpoints that allow manipulation of objects related to Fastly services and accounts. For the most accurate and up-to-date API reference content, visit our [Developer Hub](https://www.fastly.com/documentation/reference/api/) | ||
| 6 | |||
| 7 | The version of the API Spec document: 1.0.0 | ||
| 8 | Contact: oss@fastly.com | ||
| 9 | |||
| 10 | =end comment | ||
| 11 | |||
| 12 | =cut | ||
| 13 | |||
| 14 | # | ||
| 15 | # NOTE: This class is auto generated. | ||
| 16 | # Do not edit the class manually. | ||
| 17 | # | ||
| 18 | package WebService::Fastly::Object::ArcVirtualKeyListItemResponseExtra; | ||
| 19 | |||
| 20 | require 5.6.0; | ||
| 21 | use strict; | ||
| 22 | use warnings; | ||
| 23 | use utf8; | ||
| 24 | use JSON::MaybeXS qw(decode_json); | ||
| 25 | use Data::Dumper; | ||
| 26 | use Module::Runtime qw(use_module); | ||
| 27 | use Log::Any qw($log); | ||
| 28 | use Date::Parse; | ||
| 29 | use DateTime; | ||
| 30 | |||
| 31 | |||
| 32 | use base ("Class::Accessor", "Class::Data::Inheritable"); | ||
| 33 | |||
| 34 | # | ||
| 35 | # | ||
| 36 | # | ||
| 37 | # NOTE: This class is auto generated. Do not edit the class manually. | ||
| 38 | # | ||
| 39 | |||
| 40 | =begin comment | ||
| 41 | |||
| 42 | Fastly API | ||
| 43 | |||
| 44 | Via the Fastly API you can perform any of the operations that are possible within the management console, including creating services, domains, and backends, configuring rules or uploading your own application code, as well as account operations such as user administration and billing reports. The API is organized into collections of endpoints that allow manipulation of objects related to Fastly services and accounts. For the most accurate and up-to-date API reference content, visit our [Developer Hub](https://www.fastly.com/documentation/reference/api/) | ||
| 45 | |||
| 46 | The version of the API Spec document: 1.0.0 | ||
| 47 | Contact: oss@fastly.com | ||
| 48 | |||
| 49 | =end comment | ||
| 50 | |||
| 51 | =cut | ||
| 52 | |||
| 53 | # | ||
| 54 | # NOTE: This class is auto generated. | ||
| 55 | # Do not edit the class manually. | ||
| 56 | # | ||
| 57 | __PACKAGE__->mk_classdata('attribute_map' => {}); | ||
| 58 | __PACKAGE__->mk_classdata('openapi_types' => {}); | ||
| 59 | __PACKAGE__->mk_classdata('method_documentation' => {}); | ||
| 60 | __PACKAGE__->mk_classdata('class_documentation' => {}); | ||
| 61 | __PACKAGE__->mk_classdata('openapi_nullable' => {}); | ||
| 62 | |||
| 63 | # new plain object | ||
| 64 | sub new { | ||
| 65 | my ($class, %args) = @_; | ||
| 66 | |||
| 67 | my $self = bless {}, $class; | ||
| 68 | |||
| 69 | $self->init(%args); | ||
| 70 | |||
| 71 | return $self; | ||
| 72 | } | ||
| 73 | |||
| 74 | # initialize the object | ||
| 75 | sub init | ||
| 76 | { | ||
| 77 | my ($self, %args) = @_; | ||
| 78 | |||
| 79 | foreach my $attribute (keys %{$self->attribute_map}) { | ||
| 80 | my $args_key = $self->attribute_map->{$attribute}; | ||
| 81 | $self->$attribute( $args{ $args_key } ); | ||
| 82 | } | ||
| 83 | } | ||
| 84 | |||
| 85 | # return perl hash | ||
| 86 | sub to_hash { | ||
| 87 | my $self = shift; | ||
| 88 | my $_hash = decode_json(JSON()->new->allow_blessed->convert_blessed->encode($self)); | ||
| 89 | |||
| 90 | return $_hash; | ||
| 91 | } | ||
| 92 | |||
| 93 | # used by JSON for serialization | ||
| 94 | sub TO_JSON { | ||
| 95 | my $self = shift; | ||
| 96 | my $_data = {}; | ||
| 97 | foreach my $_key (keys %{$self->attribute_map}) { | ||
| 98 | $_data->{$self->attribute_map->{$_key}} = $self->{$_key}; | ||
| 99 | } | ||
| 100 | |||
| 101 | return $_data; | ||
| 102 | } | ||
| 103 | |||
| 104 | # from Perl hashref | ||
| 105 | sub from_hash { | ||
| 106 | my ($self, $hash) = @_; | ||
| 107 | |||
| 108 | # loop through attributes and use openapi_types to deserialize the data | ||
| 109 | while ( my ($_key, $_type) = each %{$self->openapi_types} ) { | ||
| 110 | my $_json_attribute = $self->attribute_map->{$_key}; | ||
| 111 | my $_is_nullable = ($self->openapi_nullable->{$_key} || 'false') eq 'true'; | ||
| 112 | if ($_type =~ /^array\[(.+)\]$/i) { # array | ||
| 113 | my $_subclass = $1; | ||
| 114 | my @_array = (); | ||
| 115 | foreach my $_element (@{$hash->{$_json_attribute}}) { | ||
| 116 | push @_array, $self->_deserialize($_subclass, $_element, $_is_nullable); | ||
| 117 | } | ||
| 118 | $self->{$_key} = \@_array; | ||
| 119 | } elsif ($_type =~ /^hash\[string,(.+)\]$/i) { # hash | ||
| 120 | my $_subclass = $1; | ||
| 121 | my %_hash = (); | ||
| 122 | while (my($_key, $_element) = each %{$hash->{$_json_attribute}}) { | ||
| 123 | $_hash{$_key} = $self->_deserialize($_subclass, $_element, $_is_nullable); | ||
| 124 | } | ||
| 125 | $self->{$_key} = \%_hash; | ||
| 126 | } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime | ||
| 127 | $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}, $_is_nullable); | ||
| 128 | } else { | ||
| 129 | $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); | ||
| 130 | } | ||
| 131 | } | ||
| 132 | |||
| 133 | return $self; | ||
| 134 | } | ||
| 135 | |||
| 136 | # deserialize non-array data | ||
| 137 | sub _deserialize { | ||
| 138 | my ($self, $type, $data, $is_nullable) = @_; | ||
| 139 | $log->debugf("deserializing %s with %s",Dumper($data), $type); | ||
| 140 | |||
| 141 | if (!(defined $data) && $is_nullable) { | ||
| 142 | return undef; | ||
| 143 | } | ||
| 144 | if ($type eq 'DateTime') { | ||
| 145 | return DateTime->from_epoch(epoch => str2time($data)); | ||
| 146 | } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { | ||
| 147 | return $data; | ||
| 148 | } else { # hash(model) | ||
| 149 | my $_instance = eval "WebService::Fastly::Object::$type->new()"; | ||
| 150 | return $_instance->from_hash($data); | ||
| 151 | } | ||
| 152 | } | ||
| 153 | |||
| 154 | |||
| 155 | __PACKAGE__->class_documentation({description => '', | ||
| 156 | class => 'ArcVirtualKeyListItemResponseExtra', | ||
| 157 | required => [], # TODO | ||
| 158 | } ); | ||
| 159 | |||
| 160 | __PACKAGE__->method_documentation({ | ||
| 161 | 'id' => { | ||
| 162 | datatype => 'string', | ||
| 163 | base_name => 'id', | ||
| 164 | description => 'The unique identifier of the virtual key.', | ||
| 165 | format => '', | ||
| 166 | read_only => 'true', | ||
| 167 | }, | ||
| 168 | 'customer_id' => { | ||
| 169 | datatype => 'string', | ||
| 170 | base_name => 'customer_id', | ||
| 171 | description => 'The ID of the customer account that owns the key.', | ||
| 172 | format => '', | ||
| 173 | read_only => 'true', | ||
| 174 | }, | ||
| 175 | 'type' => { | ||
| 176 | datatype => 'string', | ||
| 177 | base_name => 'type', | ||
| 178 | description => 'The type of the resource.', | ||
| 179 | format => '', | ||
| 180 | read_only => 'true', | ||
| 181 | }, | ||
| 182 | 'user_id' => { | ||
| 183 | datatype => 'string', | ||
| 184 | base_name => 'user_id', | ||
| 185 | description => 'The ID of the user who created the key.', | ||
| 186 | format => '', | ||
| 187 | read_only => 'true', | ||
| 188 | }, | ||
| 189 | 'user_name' => { | ||
| 190 | datatype => 'string', | ||
| 191 | base_name => 'user_name', | ||
| 192 | description => 'The display name of the user who created the key.', | ||
| 193 | format => '', | ||
| 194 | read_only => 'true', | ||
| 195 | }, | ||
| 196 | 'last_used_at' => { | ||
| 197 | datatype => 'DateTime', | ||
| 198 | base_name => 'last_used_at', | ||
| 199 | description => 'The date and time the key was last used to make a request, in RFC 3339 format. `null` if the key has never been used.', | ||
| 200 | format => 'date-time', | ||
| 201 | read_only => 'true', | ||
| 202 | }, | ||
| 203 | 'deleted_at' => { | ||
| 204 | datatype => 'DateTime', | ||
| 205 | base_name => 'deleted_at', | ||
| 206 | description => 'The date and time the key was deleted, in RFC 3339 format. `null` unless the key was deleted and `include_deleted` was used to retrieve it.', | ||
| 207 | format => 'date-time', | ||
| 208 | read_only => 'true', | ||
| 209 | }, | ||
| 210 | 'created_at' => { | ||
| 211 | datatype => 'DateTime', | ||
| 212 | base_name => 'created_at', | ||
| 213 | description => 'The date and time the key was created, in RFC 3339 format.', | ||
| 214 | format => 'date-time', | ||
| 215 | read_only => 'true', | ||
| 216 | }, | ||
| 217 | 'updated_at' => { | ||
| 218 | datatype => 'DateTime', | ||
| 219 | base_name => 'updated_at', | ||
| 220 | description => 'The date and time the key was last updated, in RFC 3339 format.', | ||
| 221 | format => 'date-time', | ||
| 222 | read_only => 'true', | ||
| 223 | }, | ||
| 224 | 'spend_limit_enabled' => { | ||
| 225 | datatype => 'boolean', | ||
| 226 | base_name => 'spend_limit_enabled', | ||
| 227 | description => 'Whether a spend limit is enabled for this key.', | ||
| 228 | format => '', | ||
| 229 | read_only => 'true', | ||
| 230 | }, | ||
| 231 | 'spend_limit_enabled_on' => { | ||
| 232 | datatype => 'DateTime', | ||
| 233 | base_name => 'spend_limit_enabled_on', | ||
| 234 | description => 'The date and time `spend_limit_enabled` was last set to `true`, in RFC 3339 format. `null` if the spend limit has never been enabled. This timestamp is not cleared when `spend_limit_enabled` is later set back to `false`, so it can be non-null even when the spend limit is currently disabled. ', | ||
| 235 | format => 'date-time', | ||
| 236 | read_only => 'true', | ||
| 237 | }, | ||
| 238 | }); | ||
| 239 | |||
| 240 | __PACKAGE__->openapi_types( { | ||
| 241 | 'id' => 'string', | ||
| 242 | 'customer_id' => 'string', | ||
| 243 | 'type' => 'string', | ||
| 244 | 'user_id' => 'string', | ||
| 245 | 'user_name' => 'string', | ||
| 246 | 'last_used_at' => 'DateTime', | ||
| 247 | 'deleted_at' => 'DateTime', | ||
| 248 | 'created_at' => 'DateTime', | ||
| 249 | 'updated_at' => 'DateTime', | ||
| 250 | 'spend_limit_enabled' => 'boolean', | ||
| 251 | 'spend_limit_enabled_on' => 'DateTime' | ||
| 252 | } ); | ||
| 253 | |||
| 254 | __PACKAGE__->attribute_map( { | ||
| 255 | 'id' => 'id', | ||
| 256 | 'customer_id' => 'customer_id', | ||
| 257 | 'type' => 'type', | ||
| 258 | 'user_id' => 'user_id', | ||
| 259 | 'user_name' => 'user_name', | ||
| 260 | 'last_used_at' => 'last_used_at', | ||
| 261 | 'deleted_at' => 'deleted_at', | ||
| 262 | 'created_at' => 'created_at', | ||
| 263 | 'updated_at' => 'updated_at', | ||
| 264 | 'spend_limit_enabled' => 'spend_limit_enabled', | ||
| 265 | 'spend_limit_enabled_on' => 'spend_limit_enabled_on' | ||
| 266 | } ); | ||
| 267 | |||
| 268 | __PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map}); | ||
| 269 | |||
| 270 | __PACKAGE__->openapi_nullable( { | ||
| 271 | 'last_used_at' => 'true', | ||
| 272 | 'deleted_at' => 'true', | ||
| 273 | 'spend_limit_enabled_on' => 'true', | ||
| 274 | } ); | ||
| 275 | |||
| 276 | |||
| 277 | 1; |