Fastly/LoggingS3Api.pm untested

filter: Statementstmt 0.0% 0 / 314 Branchbran 0.0% 0 / 166 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 0.0% 0 / 15 Podpod 0.0% 0 / 6 totaltotal 0.0% 0 / 510 CC 84 SCAR 64.8
CC
84
Cov
0%
update_log_aws_s3
1056.0
create_log_aws_s3
930.0
delete_log_aws_s3
90.0
CRAP 650.3
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::LoggingS3Api;
19  
20 require 5.6.0;
21 use strict;
22 use warnings;
23 use utf8;
24 use Exporter;
25 use Carp qw( croak );
26 use Log::Any qw($log);
27  
28 use WebService::Fastly::ApiClient;
29  
30 use base "Class::Data::Inheritable";
31  
32 __PACKAGE__->mk_classdata('method_documentation' => {});
33  
34 sub new {
35 my $class = shift;
36 my $api_client;
37  
38 if ($_[0] && ref $_[0] && ref $_[0] eq 'WebService::Fastly::ApiClient' ) {
39 $api_client = $_[0];
40 } else {
41 $api_client = WebService::Fastly::ApiClient->new(@_);
42 }
43  
44 bless { api_client => $api_client }, $class;
45  
46 }
47  
48  
49 #
50 # create_log_aws_s3
51 #
52 # Create an AWS S3 log endpoint
53 #
54 # @param string $service_id Alphanumeric string identifying the service. (required)
55 # @param int $version_id Integer identifying a service version. (required)
56 # @param string $name The name for the real-time logging configuration. (optional)
57 # @param string $placement Where in the generated VCL the logging call should be placed. If not set, endpoints with `format_version` of 2 are placed in `vcl_log` and those with `format_version` of 1 are placed in `vcl_deliver`. (optional)
58 # @param string $response_condition The name of an existing condition in the configured endpoint, or leave blank to always execute. (optional)
59 # @param string $format A Fastly [log format string](https://www.fastly.com/documentation/guides/integrations/streaming-logs/custom-log-formats/). (optional, default to '%h %l %u %t "%r" %>s %b')
60 # @param string $log_processing_region The geographic region where the logs will be processed before streaming. Valid values are `us`, `eu`, and `none` for global. (optional, default to 'none')
61 # @param int $format_version The version of the custom logging format used for the configured endpoint. The logging call gets placed by default in `vcl_log` if `format_version` is set to `2` and in `vcl_deliver` if `format_version` is set to `1`. (optional, default to 2)
62 # @param string $message_type How the message should be formatted. (optional, default to 'blank')
63 # @param string $timestamp_format A timestamp format (optional)
64 # @param string $compression_codec The codec used for compressing your logs. Valid values are `zstd`, `snappy`, and `gzip`. Specifying both `compression_codec` and `gzip_level` in the same API request will result in an error. (optional)
65 # @param int $period How frequently log files are finalized so they can be available for reading (in seconds). (optional, default to 3600)
66 # @param int $gzip_level The level of gzip encoding when sending logs (default `0`, no compression). Specifying both `compression_codec` and `gzip_level` in the same API request will result in an error. (optional, default to 0)
67 # @param string $access_key The access key for your S3 account. Not required if `iam_role` is provided. (optional)
68 # @param string $acl The access control list (ACL) specific request header. See the AWS documentation for [Access Control List (ACL) Specific Request Headers](https://docs.aws.amazon.com/AmazonS3/latest/API/mpUploadInitiate.html#initiate-mpu-acl-specific-request-headers) for more information. (optional)
69 # @param string $bucket_name The bucket name for S3 account. (optional)
70 # @param string $domain The domain of the Amazon S3 endpoint. (optional)
71 # @param string $iam_role The Amazon Resource Name (ARN) for the IAM role granting Fastly access to S3. Not required if `access_key` and `secret_key` are provided. (optional)
72 # @param string $path The path to upload logs to. (optional, default to 'null')
73 # @param string $public_key A PGP public key that Fastly will use to encrypt your log files before writing them to disk. (optional, default to 'null')
74 # @param string $redundancy The S3 redundancy level. (optional, default to 'null')
75 # @param string $secret_key The secret key for your S3 account. Not required if `iam_role` is provided. (optional)
76 # @param string $server_side_encryption_kms_key_id Optional server-side KMS Key Id. Must be set if `server_side_encryption` is set to `aws:kms` or `AES256`. (optional, default to 'null')
77 # @param string $server_side_encryption Set this to `AES256` or `aws:kms` to enable S3 Server Side Encryption. (optional, default to 'null')
78 # @param int $file_max_bytes The maximum number of bytes for each uploaded file. A value of 0 can be used to indicate there is no limit on the size of uploaded files, otherwise the minimum value is 1048576 bytes (1 MiB.) (optional)
79 {
80 my $params = {
81 'service_id' => {
82 data_type => 'string',
83 description => 'Alphanumeric string identifying the service.',
84 required => '1',
85 },
86 'version_id' => {
87 data_type => 'int',
88 description => 'Integer identifying a service version.',
89 required => '1',
90 },
91 'name' => {
92 data_type => 'string',
93 description => 'The name for the real-time logging configuration.',
94 required => '0',
95 },
96 'placement' => {
97 data_type => 'string',
98 description => 'Where in the generated VCL the logging call should be placed. If not set, endpoints with `format_version` of 2 are placed in `vcl_log` and those with `format_version` of 1 are placed in `vcl_deliver`. ',
99 required => '0',
100 },
101 'response_condition' => {
102 data_type => 'string',
103 description => 'The name of an existing condition in the configured endpoint, or leave blank to always execute.',
104 required => '0',
105 },
106 'format' => {
107 data_type => 'string',
108 description => 'A Fastly [log format string](https://www.fastly.com/documentation/guides/integrations/streaming-logs/custom-log-formats/).',
109 required => '0',
110 },
111 'log_processing_region' => {
112 data_type => 'string',
113 description => 'The geographic region where the logs will be processed before streaming. Valid values are `us`, `eu`, and `none` for global.',
114 required => '0',
115 },
116 'format_version' => {
117 data_type => 'int',
118 description => 'The version of the custom logging format used for the configured endpoint. The logging call gets placed by default in `vcl_log` if `format_version` is set to `2` and in `vcl_deliver` if `format_version` is set to `1`. ',
119 required => '0',
120 },
121 'message_type' => {
122 data_type => 'string',
123 description => 'How the message should be formatted.',
124 required => '0',
125 },
126 'timestamp_format' => {
127 data_type => 'string',
128 description => 'A timestamp format',
129 required => '0',
130 },
131 'compression_codec' => {
132 data_type => 'string',
133 description => 'The codec used for compressing your logs. Valid values are `zstd`, `snappy`, and `gzip`. Specifying both `compression_codec` and `gzip_level` in the same API request will result in an error.',
134 required => '0',
135 },
136 'period' => {
137 data_type => 'int',
138 description => 'How frequently log files are finalized so they can be available for reading (in seconds).',
139 required => '0',
140 },
141 'gzip_level' => {
142 data_type => 'int',
143 description => 'The level of gzip encoding when sending logs (default `0`, no compression). Specifying both `compression_codec` and `gzip_level` in the same API request will result in an error.',
144 required => '0',
145 },
146 'access_key' => {
147 data_type => 'string',
148 description => 'The access key for your S3 account. Not required if `iam_role` is provided.',
149 required => '0',
150 },
151 'acl' => {
152 data_type => 'string',
153 description => 'The access control list (ACL) specific request header. See the AWS documentation for [Access Control List (ACL) Specific Request Headers](https://docs.aws.amazon.com/AmazonS3/latest/API/mpUploadInitiate.html#initiate-mpu-acl-specific-request-headers) for more information.',
154 required => '0',
155 },
156 'bucket_name' => {
157 data_type => 'string',
158 description => 'The bucket name for S3 account.',
159 required => '0',
160 },
161 'domain' => {
162 data_type => 'string',
163 description => 'The domain of the Amazon S3 endpoint.',
164 required => '0',
165 },
166 'iam_role' => {
167 data_type => 'string',
168 description => 'The Amazon Resource Name (ARN) for the IAM role granting Fastly access to S3. Not required if `access_key` and `secret_key` are provided.',
169 required => '0',
170 },
171 'path' => {
172 data_type => 'string',
173 description => 'The path to upload logs to.',
174 required => '0',
175 },
176 'public_key' => {
177 data_type => 'string',
178 description => 'A PGP public key that Fastly will use to encrypt your log files before writing them to disk.',
179 required => '0',
180 },
181 'redundancy' => {
182 data_type => 'string',
183 description => 'The S3 redundancy level.',
184 required => '0',
185 },
186 'secret_key' => {
187 data_type => 'string',
188 description => 'The secret key for your S3 account. Not required if `iam_role` is provided.',
189 required => '0',
190 },
191 'server_side_encryption_kms_key_id' => {
192 data_type => 'string',
193 description => 'Optional server-side KMS Key Id. Must be set if `server_side_encryption` is set to `aws:kms` or `AES256`.',
194 required => '0',
195 },
196 'server_side_encryption' => {
197 data_type => 'string',
198 description => 'Set this to `AES256` or `aws:kms` to enable S3 Server Side Encryption.',
199 required => '0',
200 },
201 'file_max_bytes' => {
202 data_type => 'int',
203 description => 'The maximum number of bytes for each uploaded file. A value of 0 can be used to indicate there is no limit on the size of uploaded files, otherwise the minimum value is 1048576 bytes (1 MiB.)',
204 required => '0',
205 },
206 };
207 __PACKAGE__->method_documentation->{ 'create_log_aws_s3' } = {
208 summary => 'Create an AWS S3 log endpoint',
209 params => $params,
210 returns => 'LoggingS3Response',
211 };
212 }
213 # @return LoggingS3Response
214 #
215 sub create_log_aws_s3 {
216 my ($self, %args) = @_;
217  
218 # verify the required parameter 'service_id' is set
219 unless (exists $args{'service_id'}) {
220 croak("Missing the required parameter 'service_id' when calling create_log_aws_s3");
221 }
222  
223 # verify the required parameter 'version_id' is set
224 unless (exists $args{'version_id'}) {
225 croak("Missing the required parameter 'version_id' when calling create_log_aws_s3");
226 }
227  
228 # parse inputs
229 my $_resource_path = '/service/{service_id}/version/{version_id}/logging/s3';
230  
231 my $_method = 'POST';
232 my $query_params = {};
233 my $header_params = {};
234 my $form_params = {};
235  
236 # 'Accept' and 'Content-Type' header
237 my $_header_accept = $self->{api_client}->select_header_accept('application/json');
238 if ($_header_accept) {
239 $header_params->{'Accept'} = $_header_accept;
240 }
241 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/x-www-form-urlencoded');
242  
243 # path params
244 if ( exists $args{'service_id'}) {
245 my $_base_variable = "{" . "service_id" . "}";
246 my $_base_value = $self->{api_client}->to_path_value($args{'service_id'});
247 $_resource_path =~ s/$_base_variable/$_base_value/g;
248 }
249  
250 # path params
251 if ( exists $args{'version_id'}) {
252 my $_base_variable = "{" . "version_id" . "}";
253 my $_base_value = $self->{api_client}->to_path_value($args{'version_id'});
254 $_resource_path =~ s/$_base_variable/$_base_value/g;
255 }
256  
257 # form params
258 if ( exists $args{'name'} ) {
259 $form_params->{'name'} = $self->{api_client}->to_form_value($args{'name'});
260 }
261  
262 # form params
263 if ( exists $args{'placement'} ) {
264 $form_params->{'placement'} = $self->{api_client}->to_form_value($args{'placement'});
265 }
266  
267 # form params
268 if ( exists $args{'response_condition'} ) {
269 $form_params->{'response_condition'} = $self->{api_client}->to_form_value($args{'response_condition'});
270 }
271  
272 # form params
273 if ( exists $args{'format'} ) {
274 $form_params->{'format'} = $self->{api_client}->to_form_value($args{'format'});
275 }
276  
277 # form params
278 if ( exists $args{'log_processing_region'} ) {
279 $form_params->{'log_processing_region'} = $self->{api_client}->to_form_value($args{'log_processing_region'});
280 }
281  
282 # form params
283 if ( exists $args{'format_version'} ) {
284 $form_params->{'format_version'} = $self->{api_client}->to_form_value($args{'format_version'});
285 }
286  
287 # form params
288 if ( exists $args{'message_type'} ) {
289 $form_params->{'message_type'} = $self->{api_client}->to_form_value($args{'message_type'});
290 }
291  
292 # form params
293 if ( exists $args{'timestamp_format'} ) {
294 $form_params->{'timestamp_format'} = $self->{api_client}->to_form_value($args{'timestamp_format'});
295 }
296  
297 # form params
298 if ( exists $args{'compression_codec'} ) {
299 $form_params->{'compression_codec'} = $self->{api_client}->to_form_value($args{'compression_codec'});
300 }
301  
302 # form params
303 if ( exists $args{'period'} ) {
304 $form_params->{'period'} = $self->{api_client}->to_form_value($args{'period'});
305 }
306  
307 # form params
308 if ( exists $args{'gzip_level'} ) {
309 $form_params->{'gzip_level'} = $self->{api_client}->to_form_value($args{'gzip_level'});
310 }
311  
312 # form params
313 if ( exists $args{'access_key'} ) {
314 $form_params->{'access_key'} = $self->{api_client}->to_form_value($args{'access_key'});
315 }
316  
317 # form params
318 if ( exists $args{'acl'} ) {
319 $form_params->{'acl'} = $self->{api_client}->to_form_value($args{'acl'});
320 }
321  
322 # form params
323 if ( exists $args{'bucket_name'} ) {
324 $form_params->{'bucket_name'} = $self->{api_client}->to_form_value($args{'bucket_name'});
325 }
326  
327 # form params
328 if ( exists $args{'domain'} ) {
329 $form_params->{'domain'} = $self->{api_client}->to_form_value($args{'domain'});
330 }
331  
332 # form params
333 if ( exists $args{'iam_role'} ) {
334 $form_params->{'iam_role'} = $self->{api_client}->to_form_value($args{'iam_role'});
335 }
336  
337 # form params
338 if ( exists $args{'path'} ) {
339 $form_params->{'path'} = $self->{api_client}->to_form_value($args{'path'});
340 }
341  
342 # form params
343 if ( exists $args{'public_key'} ) {
344 $form_params->{'public_key'} = $self->{api_client}->to_form_value($args{'public_key'});
345 }
346  
347 # form params
348 if ( exists $args{'redundancy'} ) {
349 $form_params->{'redundancy'} = $self->{api_client}->to_form_value($args{'redundancy'});
350 }
351  
352 # form params
353 if ( exists $args{'secret_key'} ) {
354 $form_params->{'secret_key'} = $self->{api_client}->to_form_value($args{'secret_key'});
355 }
356  
357 # form params
358 if ( exists $args{'server_side_encryption_kms_key_id'} ) {
359 $form_params->{'server_side_encryption_kms_key_id'} = $self->{api_client}->to_form_value($args{'server_side_encryption_kms_key_id'});
360 }
361  
362 # form params
363 if ( exists $args{'server_side_encryption'} ) {
364 $form_params->{'server_side_encryption'} = $self->{api_client}->to_form_value($args{'server_side_encryption'});
365 }
366  
367 # form params
368 if ( exists $args{'file_max_bytes'} ) {
369 $form_params->{'file_max_bytes'} = $self->{api_client}->to_form_value($args{'file_max_bytes'});
370 }
371  
372 my $_body_data;
373 # authentication setting, if any
374 my $auth_settings = [qw(token )];
375  
376 # make the API Call
377 my $response = $self->{api_client}->call_api($_resource_path, $_method,
378 $query_params, $form_params,
379 $header_params, $_body_data, $auth_settings);
380 if (!$response) {
381 return;
382 }
383 my $_response_object = $self->{api_client}->deserialize('LoggingS3Response', $response);
384 return $_response_object;
385 }
386  
387 #
388 # delete_log_aws_s3
389 #
390 # Delete an AWS S3 log endpoint
391 #
392 # @param string $service_id Alphanumeric string identifying the service. (required)
393 # @param int $version_id Integer identifying a service version. (required)
394 # @param string $logging_s3_name The name for the real-time logging configuration. (required)
395 {
396 my $params = {
397 'service_id' => {
398 data_type => 'string',
399 description => 'Alphanumeric string identifying the service.',
400 required => '1',
401 },
402 'version_id' => {
403 data_type => 'int',
404 description => 'Integer identifying a service version.',
405 required => '1',
406 },
407 'logging_s3_name' => {
408 data_type => 'string',
409 description => 'The name for the real-time logging configuration.',
410 required => '1',
411 },
412 };
413 __PACKAGE__->method_documentation->{ 'delete_log_aws_s3' } = {
414 summary => 'Delete an AWS S3 log endpoint',
415 params => $params,
416 returns => 'InlineResponse200',
417 };
418 }
419 # @return InlineResponse200
420 #
421 sub delete_log_aws_s3 {
422 my ($self, %args) = @_;
423  
424 # verify the required parameter 'service_id' is set
425 unless (exists $args{'service_id'}) {
426 croak("Missing the required parameter 'service_id' when calling delete_log_aws_s3");
427 }
428  
429 # verify the required parameter 'version_id' is set
430 unless (exists $args{'version_id'}) {
431 croak("Missing the required parameter 'version_id' when calling delete_log_aws_s3");
432 }
433  
434 # verify the required parameter 'logging_s3_name' is set
435 unless (exists $args{'logging_s3_name'}) {
436 croak("Missing the required parameter 'logging_s3_name' when calling delete_log_aws_s3");
437 }
438  
439 # parse inputs
440 my $_resource_path = '/service/{service_id}/version/{version_id}/logging/s3/{logging_s3_name}';
441  
442 my $_method = 'DELETE';
443 my $query_params = {};
444 my $header_params = {};
445 my $form_params = {};
446  
447 # 'Accept' and 'Content-Type' header
448 my $_header_accept = $self->{api_client}->select_header_accept('application/json');
449 if ($_header_accept) {
450 $header_params->{'Accept'} = $_header_accept;
451 }
452 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type();
453  
454 # path params
455 if ( exists $args{'service_id'}) {
456 my $_base_variable = "{" . "service_id" . "}";
457 my $_base_value = $self->{api_client}->to_path_value($args{'service_id'});
458 $_resource_path =~ s/$_base_variable/$_base_value/g;
459 }
460  
461 # path params
462 if ( exists $args{'version_id'}) {
463 my $_base_variable = "{" . "version_id" . "}";
464 my $_base_value = $self->{api_client}->to_path_value($args{'version_id'});
465 $_resource_path =~ s/$_base_variable/$_base_value/g;
466 }
467  
468 # path params
469 if ( exists $args{'logging_s3_name'}) {
470 my $_base_variable = "{" . "logging_s3_name" . "}";
471 my $_base_value = $self->{api_client}->to_path_value($args{'logging_s3_name'});
472 $_resource_path =~ s/$_base_variable/$_base_value/g;
473 }
474  
475 my $_body_data;
476 # authentication setting, if any
477 my $auth_settings = [qw(token )];
478  
479 # make the API Call
480 my $response = $self->{api_client}->call_api($_resource_path, $_method,
481 $query_params, $form_params,
482 $header_params, $_body_data, $auth_settings);
483 if (!$response) {
484 return;
485 }
486 my $_response_object = $self->{api_client}->deserialize('InlineResponse200', $response);
487 return $_response_object;
488 }
489  
490 #
491 # get_log_aws_s3
492 #
493 # Get an AWS S3 log endpoint
494 #
495 # @param string $service_id Alphanumeric string identifying the service. (required)
496 # @param int $version_id Integer identifying a service version. (required)
497 # @param string $logging_s3_name The name for the real-time logging configuration. (required)
498 {
499 my $params = {
500 'service_id' => {
501 data_type => 'string',
502 description => 'Alphanumeric string identifying the service.',
503 required => '1',
504 },
505 'version_id' => {
506 data_type => 'int',
507 description => 'Integer identifying a service version.',
508 required => '1',
509 },
510 'logging_s3_name' => {
511 data_type => 'string',
512 description => 'The name for the real-time logging configuration.',
513 required => '1',
514 },
515 };
516 __PACKAGE__->method_documentation->{ 'get_log_aws_s3' } = {
517 summary => 'Get an AWS S3 log endpoint',
518 params => $params,
519 returns => 'LoggingS3Response',
520 };
521 }
522 # @return LoggingS3Response
523 #
524 sub get_log_aws_s3 {
525 my ($self, %args) = @_;
526  
527 # verify the required parameter 'service_id' is set
528 unless (exists $args{'service_id'}) {
529 croak("Missing the required parameter 'service_id' when calling get_log_aws_s3");
530 }
531  
532 # verify the required parameter 'version_id' is set
533 unless (exists $args{'version_id'}) {
534 croak("Missing the required parameter 'version_id' when calling get_log_aws_s3");
535 }
536  
537 # verify the required parameter 'logging_s3_name' is set
538 unless (exists $args{'logging_s3_name'}) {
539 croak("Missing the required parameter 'logging_s3_name' when calling get_log_aws_s3");
540 }
541  
542 # parse inputs
543 my $_resource_path = '/service/{service_id}/version/{version_id}/logging/s3/{logging_s3_name}';
544  
545 my $_method = 'GET';
546 my $query_params = {};
547 my $header_params = {};
548 my $form_params = {};
549  
550 # 'Accept' and 'Content-Type' header
551 my $_header_accept = $self->{api_client}->select_header_accept('application/json');
552 if ($_header_accept) {
553 $header_params->{'Accept'} = $_header_accept;
554 }
555 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type();
556  
557 # path params
558 if ( exists $args{'service_id'}) {
559 my $_base_variable = "{" . "service_id" . "}";
560 my $_base_value = $self->{api_client}->to_path_value($args{'service_id'});
561 $_resource_path =~ s/$_base_variable/$_base_value/g;
562 }
563  
564 # path params
565 if ( exists $args{'version_id'}) {
566 my $_base_variable = "{" . "version_id" . "}";
567 my $_base_value = $self->{api_client}->to_path_value($args{'version_id'});
568 $_resource_path =~ s/$_base_variable/$_base_value/g;
569 }
570  
571 # path params
572 if ( exists $args{'logging_s3_name'}) {
573 my $_base_variable = "{" . "logging_s3_name" . "}";
574 my $_base_value = $self->{api_client}->to_path_value($args{'logging_s3_name'});
575 $_resource_path =~ s/$_base_variable/$_base_value/g;
576 }
577  
578 my $_body_data;
579 # authentication setting, if any
580 my $auth_settings = [qw(token )];
581  
582 # make the API Call
583 my $response = $self->{api_client}->call_api($_resource_path, $_method,
584 $query_params, $form_params,
585 $header_params, $_body_data, $auth_settings);
586 if (!$response) {
587 return;
588 }
589 my $_response_object = $self->{api_client}->deserialize('LoggingS3Response', $response);
590 return $_response_object;
591 }
592  
593 #
594 # list_log_aws_s3
595 #
596 # List AWS S3 log endpoints
597 #
598 # @param string $service_id Alphanumeric string identifying the service. (required)
599 # @param int $version_id Integer identifying a service version. (required)
600 {
601 my $params = {
602 'service_id' => {
603 data_type => 'string',
604 description => 'Alphanumeric string identifying the service.',
605 required => '1',
606 },
607 'version_id' => {
608 data_type => 'int',
609 description => 'Integer identifying a service version.',
610 required => '1',
611 },
612 };
613 __PACKAGE__->method_documentation->{ 'list_log_aws_s3' } = {
614 summary => 'List AWS S3 log endpoints',
615 params => $params,
616 returns => 'ARRAY[LoggingS3Response]',
617 };
618 }
619 # @return ARRAY[LoggingS3Response]
620 #
621 sub list_log_aws_s3 {
622 my ($self, %args) = @_;
623  
624 # verify the required parameter 'service_id' is set
625 unless (exists $args{'service_id'}) {
626 croak("Missing the required parameter 'service_id' when calling list_log_aws_s3");
627 }
628  
629 # verify the required parameter 'version_id' is set
630 unless (exists $args{'version_id'}) {
631 croak("Missing the required parameter 'version_id' when calling list_log_aws_s3");
632 }
633  
634 # parse inputs
635 my $_resource_path = '/service/{service_id}/version/{version_id}/logging/s3';
636  
637 my $_method = 'GET';
638 my $query_params = {};
639 my $header_params = {};
640 my $form_params = {};
641  
642 # 'Accept' and 'Content-Type' header
643 my $_header_accept = $self->{api_client}->select_header_accept('application/json');
644 if ($_header_accept) {
645 $header_params->{'Accept'} = $_header_accept;
646 }
647 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type();
648  
649 # path params
650 if ( exists $args{'service_id'}) {
651 my $_base_variable = "{" . "service_id" . "}";
652 my $_base_value = $self->{api_client}->to_path_value($args{'service_id'});
653 $_resource_path =~ s/$_base_variable/$_base_value/g;
654 }
655  
656 # path params
657 if ( exists $args{'version_id'}) {
658 my $_base_variable = "{" . "version_id" . "}";
659 my $_base_value = $self->{api_client}->to_path_value($args{'version_id'});
660 $_resource_path =~ s/$_base_variable/$_base_value/g;
661 }
662  
663 my $_body_data;
664 # authentication setting, if any
665 my $auth_settings = [qw(token )];
666  
667 # make the API Call
668 my $response = $self->{api_client}->call_api($_resource_path, $_method,
669 $query_params, $form_params,
670 $header_params, $_body_data, $auth_settings);
671 if (!$response) {
672 return;
673 }
674 my $_response_object = $self->{api_client}->deserialize('ARRAY[LoggingS3Response]', $response);
675 return $_response_object;
676 }
677  
678 #
679 # update_log_aws_s3
680 #
681 # Update an AWS S3 log endpoint
682 #
683 # @param string $service_id Alphanumeric string identifying the service. (required)
684 # @param int $version_id Integer identifying a service version. (required)
685 # @param string $logging_s3_name The name for the real-time logging configuration. (required)
686 # @param string $name The name for the real-time logging configuration. (optional)
687 # @param string $placement Where in the generated VCL the logging call should be placed. If not set, endpoints with `format_version` of 2 are placed in `vcl_log` and those with `format_version` of 1 are placed in `vcl_deliver`. (optional)
688 # @param string $response_condition The name of an existing condition in the configured endpoint, or leave blank to always execute. (optional)
689 # @param string $format A Fastly [log format string](https://www.fastly.com/documentation/guides/integrations/streaming-logs/custom-log-formats/). (optional, default to '%h %l %u %t "%r" %>s %b')
690 # @param string $log_processing_region The geographic region where the logs will be processed before streaming. Valid values are `us`, `eu`, and `none` for global. (optional, default to 'none')
691 # @param int $format_version The version of the custom logging format used for the configured endpoint. The logging call gets placed by default in `vcl_log` if `format_version` is set to `2` and in `vcl_deliver` if `format_version` is set to `1`. (optional, default to 2)
692 # @param string $message_type How the message should be formatted. (optional, default to 'blank')
693 # @param string $timestamp_format A timestamp format (optional)
694 # @param string $compression_codec The codec used for compressing your logs. Valid values are `zstd`, `snappy`, and `gzip`. Specifying both `compression_codec` and `gzip_level` in the same API request will result in an error. (optional)
695 # @param int $period How frequently log files are finalized so they can be available for reading (in seconds). (optional, default to 3600)
696 # @param int $gzip_level The level of gzip encoding when sending logs (default `0`, no compression). Specifying both `compression_codec` and `gzip_level` in the same API request will result in an error. (optional, default to 0)
697 # @param string $access_key The access key for your S3 account. Not required if `iam_role` is provided. (optional)
698 # @param string $acl The access control list (ACL) specific request header. See the AWS documentation for [Access Control List (ACL) Specific Request Headers](https://docs.aws.amazon.com/AmazonS3/latest/API/mpUploadInitiate.html#initiate-mpu-acl-specific-request-headers) for more information. (optional)
699 # @param string $bucket_name The bucket name for S3 account. (optional)
700 # @param string $domain The domain of the Amazon S3 endpoint. (optional)
701 # @param string $iam_role The Amazon Resource Name (ARN) for the IAM role granting Fastly access to S3. Not required if `access_key` and `secret_key` are provided. (optional)
702 # @param string $path The path to upload logs to. (optional, default to 'null')
703 # @param string $public_key A PGP public key that Fastly will use to encrypt your log files before writing them to disk. (optional, default to 'null')
704 # @param string $redundancy The S3 redundancy level. (optional, default to 'null')
705 # @param string $secret_key The secret key for your S3 account. Not required if `iam_role` is provided. (optional)
706 # @param string $server_side_encryption_kms_key_id Optional server-side KMS Key Id. Must be set if `server_side_encryption` is set to `aws:kms` or `AES256`. (optional, default to 'null')
707 # @param string $server_side_encryption Set this to `AES256` or `aws:kms` to enable S3 Server Side Encryption. (optional, default to 'null')
708 # @param int $file_max_bytes The maximum number of bytes for each uploaded file. A value of 0 can be used to indicate there is no limit on the size of uploaded files, otherwise the minimum value is 1048576 bytes (1 MiB.) (optional)
709 {
710 my $params = {
711 'service_id' => {
712 data_type => 'string',
713 description => 'Alphanumeric string identifying the service.',
714 required => '1',
715 },
716 'version_id' => {
717 data_type => 'int',
718 description => 'Integer identifying a service version.',
719 required => '1',
720 },
721 'logging_s3_name' => {
722 data_type => 'string',
723 description => 'The name for the real-time logging configuration.',
724 required => '1',
725 },
726 'name' => {
727 data_type => 'string',
728 description => 'The name for the real-time logging configuration.',
729 required => '0',
730 },
731 'placement' => {
732 data_type => 'string',
733 description => 'Where in the generated VCL the logging call should be placed. If not set, endpoints with `format_version` of 2 are placed in `vcl_log` and those with `format_version` of 1 are placed in `vcl_deliver`. ',
734 required => '0',
735 },
736 'response_condition' => {
737 data_type => 'string',
738 description => 'The name of an existing condition in the configured endpoint, or leave blank to always execute.',
739 required => '0',
740 },
741 'format' => {
742 data_type => 'string',
743 description => 'A Fastly [log format string](https://www.fastly.com/documentation/guides/integrations/streaming-logs/custom-log-formats/).',
744 required => '0',
745 },
746 'log_processing_region' => {
747 data_type => 'string',
748 description => 'The geographic region where the logs will be processed before streaming. Valid values are `us`, `eu`, and `none` for global.',
749 required => '0',
750 },
751 'format_version' => {
752 data_type => 'int',
753 description => 'The version of the custom logging format used for the configured endpoint. The logging call gets placed by default in `vcl_log` if `format_version` is set to `2` and in `vcl_deliver` if `format_version` is set to `1`. ',
754 required => '0',
755 },
756 'message_type' => {
757 data_type => 'string',
758 description => 'How the message should be formatted.',
759 required => '0',
760 },
761 'timestamp_format' => {
762 data_type => 'string',
763 description => 'A timestamp format',
764 required => '0',
765 },
766 'compression_codec' => {
767 data_type => 'string',
768 description => 'The codec used for compressing your logs. Valid values are `zstd`, `snappy`, and `gzip`. Specifying both `compression_codec` and `gzip_level` in the same API request will result in an error.',
769 required => '0',
770 },
771 'period' => {
772 data_type => 'int',
773 description => 'How frequently log files are finalized so they can be available for reading (in seconds).',
774 required => '0',
775 },
776 'gzip_level' => {
777 data_type => 'int',
778 description => 'The level of gzip encoding when sending logs (default `0`, no compression). Specifying both `compression_codec` and `gzip_level` in the same API request will result in an error.',
779 required => '0',
780 },
781 'access_key' => {
782 data_type => 'string',
783 description => 'The access key for your S3 account. Not required if `iam_role` is provided.',
784 required => '0',
785 },
786 'acl' => {
787 data_type => 'string',
788 description => 'The access control list (ACL) specific request header. See the AWS documentation for [Access Control List (ACL) Specific Request Headers](https://docs.aws.amazon.com/AmazonS3/latest/API/mpUploadInitiate.html#initiate-mpu-acl-specific-request-headers) for more information.',
789 required => '0',
790 },
791 'bucket_name' => {
792 data_type => 'string',
793 description => 'The bucket name for S3 account.',
794 required => '0',
795 },
796 'domain' => {
797 data_type => 'string',
798 description => 'The domain of the Amazon S3 endpoint.',
799 required => '0',
800 },
801 'iam_role' => {
802 data_type => 'string',
803 description => 'The Amazon Resource Name (ARN) for the IAM role granting Fastly access to S3. Not required if `access_key` and `secret_key` are provided.',
804 required => '0',
805 },
806 'path' => {
807 data_type => 'string',
808 description => 'The path to upload logs to.',
809 required => '0',
810 },
811 'public_key' => {
812 data_type => 'string',
813 description => 'A PGP public key that Fastly will use to encrypt your log files before writing them to disk.',
814 required => '0',
815 },
816 'redundancy' => {
817 data_type => 'string',
818 description => 'The S3 redundancy level.',
819 required => '0',
820 },
821 'secret_key' => {
822 data_type => 'string',
823 description => 'The secret key for your S3 account. Not required if `iam_role` is provided.',
824 required => '0',
825 },
826 'server_side_encryption_kms_key_id' => {
827 data_type => 'string',
828 description => 'Optional server-side KMS Key Id. Must be set if `server_side_encryption` is set to `aws:kms` or `AES256`.',
829 required => '0',
830 },
831 'server_side_encryption' => {
832 data_type => 'string',
833 description => 'Set this to `AES256` or `aws:kms` to enable S3 Server Side Encryption.',
834 required => '0',
835 },
836 'file_max_bytes' => {
837 data_type => 'int',
838 description => 'The maximum number of bytes for each uploaded file. A value of 0 can be used to indicate there is no limit on the size of uploaded files, otherwise the minimum value is 1048576 bytes (1 MiB.)',
839 required => '0',
840 },
841 };
842 __PACKAGE__->method_documentation->{ 'update_log_aws_s3' } = {
843 summary => 'Update an AWS S3 log endpoint',
844 params => $params,
845 returns => 'LoggingS3Response',
846 };
847 }
848 # @return LoggingS3Response
849 #
850 sub update_log_aws_s3 {
851 my ($self, %args) = @_;
852  
853 # verify the required parameter 'service_id' is set
854 unless (exists $args{'service_id'}) {
855 croak("Missing the required parameter 'service_id' when calling update_log_aws_s3");
856 }
857  
858 # verify the required parameter 'version_id' is set
859 unless (exists $args{'version_id'}) {
860 croak("Missing the required parameter 'version_id' when calling update_log_aws_s3");
861 }
862  
863 # verify the required parameter 'logging_s3_name' is set
864 unless (exists $args{'logging_s3_name'}) {
865 croak("Missing the required parameter 'logging_s3_name' when calling update_log_aws_s3");
866 }
867  
868 # parse inputs
869 my $_resource_path = '/service/{service_id}/version/{version_id}/logging/s3/{logging_s3_name}';
870  
871 my $_method = 'PUT';
872 my $query_params = {};
873 my $header_params = {};
874 my $form_params = {};
875  
876 # 'Accept' and 'Content-Type' header
877 my $_header_accept = $self->{api_client}->select_header_accept('application/json');
878 if ($_header_accept) {
879 $header_params->{'Accept'} = $_header_accept;
880 }
881 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/x-www-form-urlencoded');
882  
883 # path params
884 if ( exists $args{'service_id'}) {
885 my $_base_variable = "{" . "service_id" . "}";
886 my $_base_value = $self->{api_client}->to_path_value($args{'service_id'});
887 $_resource_path =~ s/$_base_variable/$_base_value/g;
888 }
889  
890 # path params
891 if ( exists $args{'version_id'}) {
892 my $_base_variable = "{" . "version_id" . "}";
893 my $_base_value = $self->{api_client}->to_path_value($args{'version_id'});
894 $_resource_path =~ s/$_base_variable/$_base_value/g;
895 }
896  
897 # path params
898 if ( exists $args{'logging_s3_name'}) {
899 my $_base_variable = "{" . "logging_s3_name" . "}";
900 my $_base_value = $self->{api_client}->to_path_value($args{'logging_s3_name'});
901 $_resource_path =~ s/$_base_variable/$_base_value/g;
902 }
903  
904 # form params
905 if ( exists $args{'name'} ) {
906 $form_params->{'name'} = $self->{api_client}->to_form_value($args{'name'});
907 }
908  
909 # form params
910 if ( exists $args{'placement'} ) {
911 $form_params->{'placement'} = $self->{api_client}->to_form_value($args{'placement'});
912 }
913  
914 # form params
915 if ( exists $args{'response_condition'} ) {
916 $form_params->{'response_condition'} = $self->{api_client}->to_form_value($args{'response_condition'});
917 }
918  
919 # form params
920 if ( exists $args{'format'} ) {
921 $form_params->{'format'} = $self->{api_client}->to_form_value($args{'format'});
922 }
923  
924 # form params
925 if ( exists $args{'log_processing_region'} ) {
926 $form_params->{'log_processing_region'} = $self->{api_client}->to_form_value($args{'log_processing_region'});
927 }
928  
929 # form params
930 if ( exists $args{'format_version'} ) {
931 $form_params->{'format_version'} = $self->{api_client}->to_form_value($args{'format_version'});
932 }
933  
934 # form params
935 if ( exists $args{'message_type'} ) {
936 $form_params->{'message_type'} = $self->{api_client}->to_form_value($args{'message_type'});
937 }
938  
939 # form params
940 if ( exists $args{'timestamp_format'} ) {
941 $form_params->{'timestamp_format'} = $self->{api_client}->to_form_value($args{'timestamp_format'});
942 }
943  
944 # form params
945 if ( exists $args{'compression_codec'} ) {
946 $form_params->{'compression_codec'} = $self->{api_client}->to_form_value($args{'compression_codec'});
947 }
948  
949 # form params
950 if ( exists $args{'period'} ) {
951 $form_params->{'period'} = $self->{api_client}->to_form_value($args{'period'});
952 }
953  
954 # form params
955 if ( exists $args{'gzip_level'} ) {
956 $form_params->{'gzip_level'} = $self->{api_client}->to_form_value($args{'gzip_level'});
957 }
958  
959 # form params
960 if ( exists $args{'access_key'} ) {
961 $form_params->{'access_key'} = $self->{api_client}->to_form_value($args{'access_key'});
962 }
963  
964 # form params
965 if ( exists $args{'acl'} ) {
966 $form_params->{'acl'} = $self->{api_client}->to_form_value($args{'acl'});
967 }
968  
969 # form params
970 if ( exists $args{'bucket_name'} ) {
971 $form_params->{'bucket_name'} = $self->{api_client}->to_form_value($args{'bucket_name'});
972 }
973  
974 # form params
975 if ( exists $args{'domain'} ) {
976 $form_params->{'domain'} = $self->{api_client}->to_form_value($args{'domain'});
977 }
978  
979 # form params
980 if ( exists $args{'iam_role'} ) {
981 $form_params->{'iam_role'} = $self->{api_client}->to_form_value($args{'iam_role'});
982 }
983  
984 # form params
985 if ( exists $args{'path'} ) {
986 $form_params->{'path'} = $self->{api_client}->to_form_value($args{'path'});
987 }
988  
989 # form params
990 if ( exists $args{'public_key'} ) {
991 $form_params->{'public_key'} = $self->{api_client}->to_form_value($args{'public_key'});
992 }
993  
994 # form params
995 if ( exists $args{'redundancy'} ) {
996 $form_params->{'redundancy'} = $self->{api_client}->to_form_value($args{'redundancy'});
997 }
998  
999 # form params
1000 if ( exists $args{'secret_key'} ) {
1001 $form_params->{'secret_key'} = $self->{api_client}->to_form_value($args{'secret_key'});
1002 }
1003  
1004 # form params
1005 if ( exists $args{'server_side_encryption_kms_key_id'} ) {
1006 $form_params->{'server_side_encryption_kms_key_id'} = $self->{api_client}->to_form_value($args{'server_side_encryption_kms_key_id'});
1007 }
1008  
1009 # form params
1010 if ( exists $args{'server_side_encryption'} ) {
1011 $form_params->{'server_side_encryption'} = $self->{api_client}->to_form_value($args{'server_side_encryption'});
1012 }
1013  
1014 # form params
1015 if ( exists $args{'file_max_bytes'} ) {
1016 $form_params->{'file_max_bytes'} = $self->{api_client}->to_form_value($args{'file_max_bytes'});
1017 }
1018  
1019 my $_body_data;
1020 # authentication setting, if any
1021 my $auth_settings = [qw(token )];
1022  
1023 # make the API Call
1024 my $response = $self->{api_client}->call_api($_resource_path, $_method,
1025 $query_params, $form_params,
1026 $header_params, $_body_data, $auth_settings);
1027 if (!$response) {
1028 return;
1029 }
1030 my $_response_object = $self->{api_client}->deserialize('LoggingS3Response', $response);
1031 return $_response_object;
1032 }
1033  
1034 1;