| 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::TlsBulkCertificatesApi; | ||
| 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 | # delete_bulk_tls_cert | ||
| 51 | # | ||
| 52 | # Delete a certificate | ||
| 53 | # | ||
| 54 | # @param string $certificate_id Alphanumeric string identifying a TLS bulk certificate. (required) | ||
| 55 | { | ||
| 56 | my $params = { | ||
| 57 | 'certificate_id' => { | ||
| 58 | data_type => 'string', | ||
| 59 | description => 'Alphanumeric string identifying a TLS bulk certificate.', | ||
| 60 | required => '1', | ||
| 61 | }, | ||
| 62 | }; | ||
| 63 | __PACKAGE__->method_documentation->{ 'delete_bulk_tls_cert' } = { | ||
| 64 | summary => 'Delete a certificate', | ||
| 65 | params => $params, | ||
| 66 | returns => undef, | ||
| 67 | }; | ||
| 68 | } | ||
| 69 | # @return void | ||
| 70 | # | ||
| 71 | sub delete_bulk_tls_cert { | ||
| 72 | my ($self, %args) = @_; | ||
| 73 | |||
| 74 | # verify the required parameter 'certificate_id' is set | ||
| 75 | unless (exists $args{'certificate_id'}) { | ||
| 76 | croak("Missing the required parameter 'certificate_id' when calling delete_bulk_tls_cert"); | ||
| 77 | } | ||
| 78 | |||
| 79 | # parse inputs | ||
| 80 | my $_resource_path = '/tls/bulk/certificates/{certificate_id}'; | ||
| 81 | |||
| 82 | my $_method = 'DELETE'; | ||
| 83 | my $query_params = {}; | ||
| 84 | my $header_params = {}; | ||
| 85 | my $form_params = {}; | ||
| 86 | |||
| 87 | # 'Accept' and 'Content-Type' header | ||
| 88 | my $_header_accept = $self->{api_client}->select_header_accept(); | ||
| 89 | if ($_header_accept) { | ||
| 90 | $header_params->{'Accept'} = $_header_accept; | ||
| 91 | } | ||
| 92 | $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type(); | ||
| 93 | |||
| 94 | # path params | ||
| 95 | if ( exists $args{'certificate_id'}) { | ||
| 96 | my $_base_variable = "{" . "certificate_id" . "}"; | ||
| 97 | my $_base_value = $self->{api_client}->to_path_value($args{'certificate_id'}); | ||
| 98 | $_resource_path =~ s/$_base_variable/$_base_value/g; | ||
| 99 | } | ||
| 100 | |||
| 101 | my $_body_data; | ||
| 102 | # authentication setting, if any | ||
| 103 | my $auth_settings = [qw(token )]; | ||
| 104 | |||
| 105 | # make the API Call | ||
| 106 | $self->{api_client}->call_api($_resource_path, $_method, | ||
| 107 | $query_params, $form_params, | ||
| 108 | $header_params, $_body_data, $auth_settings); | ||
| 109 | return; | ||
| 110 | } | ||
| 111 | |||
| 112 | # | ||
| 113 | # get_tls_bulk_cert | ||
| 114 | # | ||
| 115 | # Get a certificate | ||
| 116 | # | ||
| 117 | # @param string $certificate_id Alphanumeric string identifying a TLS bulk certificate. (required) | ||
| 118 | { | ||
| 119 | my $params = { | ||
| 120 | 'certificate_id' => { | ||
| 121 | data_type => 'string', | ||
| 122 | description => 'Alphanumeric string identifying a TLS bulk certificate.', | ||
| 123 | required => '1', | ||
| 124 | }, | ||
| 125 | }; | ||
| 126 | __PACKAGE__->method_documentation->{ 'get_tls_bulk_cert' } = { | ||
| 127 | summary => 'Get a certificate', | ||
| 128 | params => $params, | ||
| 129 | returns => 'TlsBulkCertificateResponse', | ||
| 130 | }; | ||
| 131 | } | ||
| 132 | # @return TlsBulkCertificateResponse | ||
| 133 | # | ||
| 134 | sub get_tls_bulk_cert { | ||
| 135 | my ($self, %args) = @_; | ||
| 136 | |||
| 137 | # verify the required parameter 'certificate_id' is set | ||
| 138 | unless (exists $args{'certificate_id'}) { | ||
| 139 | croak("Missing the required parameter 'certificate_id' when calling get_tls_bulk_cert"); | ||
| 140 | } | ||
| 141 | |||
| 142 | # parse inputs | ||
| 143 | my $_resource_path = '/tls/bulk/certificates/{certificate_id}'; | ||
| 144 | |||
| 145 | my $_method = 'GET'; | ||
| 146 | my $query_params = {}; | ||
| 147 | my $header_params = {}; | ||
| 148 | my $form_params = {}; | ||
| 149 | |||
| 150 | # 'Accept' and 'Content-Type' header | ||
| 151 | my $_header_accept = $self->{api_client}->select_header_accept('application/vnd.api+json'); | ||
| 152 | if ($_header_accept) { | ||
| 153 | $header_params->{'Accept'} = $_header_accept; | ||
| 154 | } | ||
| 155 | $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type(); | ||
| 156 | |||
| 157 | # path params | ||
| 158 | if ( exists $args{'certificate_id'}) { | ||
| 159 | my $_base_variable = "{" . "certificate_id" . "}"; | ||
| 160 | my $_base_value = $self->{api_client}->to_path_value($args{'certificate_id'}); | ||
| 161 | $_resource_path =~ s/$_base_variable/$_base_value/g; | ||
| 162 | } | ||
| 163 | |||
| 164 | my $_body_data; | ||
| 165 | # authentication setting, if any | ||
| 166 | my $auth_settings = [qw(token )]; | ||
| 167 | |||
| 168 | # make the API Call | ||
| 169 | my $response = $self->{api_client}->call_api($_resource_path, $_method, | ||
| 170 | $query_params, $form_params, | ||
| 171 | $header_params, $_body_data, $auth_settings); | ||
| 172 | if (!$response) { | ||
| 173 | return; | ||
| 174 | } | ||
| 175 | my $_response_object = $self->{api_client}->deserialize('TlsBulkCertificateResponse', $response); | ||
| 176 | return $_response_object; | ||
| 177 | } | ||
| 178 | |||
| 179 | # | ||
| 180 | # list_tls_bulk_certs | ||
| 181 | # | ||
| 182 | # List certificates | ||
| 183 | # | ||
| 184 | # @param string $filter[tls_domain/id] Filter certificates by their matching, fully-qualified domain name. (optional) | ||
| 185 | # @param string $filter[not_before] Filter the returned certificates by not_before date in UTC. Accepts parameters: lt, lte, gt, gte (e.g., filter[not_before][gte]=2020-05-05). (optional) | ||
| 186 | # @param string $filter[not_after] Filter the returned certificates by expiry date in UTC. Accepts parameters: lt, lte, gt, gte (e.g., filter[not_after][lte]=2020-05-05). (optional) | ||
| 187 | # @param int $page[number] Current page. (optional) | ||
| 188 | # @param int $page[size] Number of records per page. (optional, default to 20) | ||
| 189 | # @param string $sort The order in which to list the results by creation date. (optional, default to 'created_at') | ||
| 190 | { | ||
| 191 | my $params = { | ||
| 192 | 'filter[tls_domain/id]' => { | ||
| 193 | data_type => 'string', | ||
| 194 | description => 'Filter certificates by their matching, fully-qualified domain name.', | ||
| 195 | required => '0', | ||
| 196 | }, | ||
| 197 | 'filter[not_before]' => { | ||
| 198 | data_type => 'string', | ||
| 199 | description => 'Filter the returned certificates by not_before date in UTC. Accepts parameters: lt, lte, gt, gte (e.g., filter[not_before][gte]=2020-05-05). ', | ||
| 200 | required => '0', | ||
| 201 | }, | ||
| 202 | 'filter[not_after]' => { | ||
| 203 | data_type => 'string', | ||
| 204 | description => 'Filter the returned certificates by expiry date in UTC. Accepts parameters: lt, lte, gt, gte (e.g., filter[not_after][lte]=2020-05-05). ', | ||
| 205 | required => '0', | ||
| 206 | }, | ||
| 207 | 'page[number]' => { | ||
| 208 | data_type => 'int', | ||
| 209 | description => 'Current page.', | ||
| 210 | required => '0', | ||
| 211 | }, | ||
| 212 | 'page[size]' => { | ||
| 213 | data_type => 'int', | ||
| 214 | description => 'Number of records per page.', | ||
| 215 | required => '0', | ||
| 216 | }, | ||
| 217 | 'sort' => { | ||
| 218 | data_type => 'string', | ||
| 219 | description => 'The order in which to list the results by creation date.', | ||
| 220 | required => '0', | ||
| 221 | }, | ||
| 222 | }; | ||
| 223 | __PACKAGE__->method_documentation->{ 'list_tls_bulk_certs' } = { | ||
| 224 | summary => 'List certificates', | ||
| 225 | params => $params, | ||
| 226 | returns => 'TlsBulkCertificatesResponse', | ||
| 227 | }; | ||
| 228 | } | ||
| 229 | # @return TlsBulkCertificatesResponse | ||
| 230 | # | ||
| 231 | sub list_tls_bulk_certs { | ||
| 232 | my ($self, %args) = @_; | ||
| 233 | |||
| 234 | # parse inputs | ||
| 235 | my $_resource_path = '/tls/bulk/certificates'; | ||
| 236 | |||
| 237 | my $_method = 'GET'; | ||
| 238 | my $query_params = {}; | ||
| 239 | my $header_params = {}; | ||
| 240 | my $form_params = {}; | ||
| 241 | |||
| 242 | # 'Accept' and 'Content-Type' header | ||
| 243 | my $_header_accept = $self->{api_client}->select_header_accept('application/vnd.api+json'); | ||
| 244 | if ($_header_accept) { | ||
| 245 | $header_params->{'Accept'} = $_header_accept; | ||
| 246 | } | ||
| 247 | $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type(); | ||
| 248 | |||
| 249 | # query params | ||
| 250 | if ( exists $args{'filter[tls_domain/id]'}) { | ||
| 251 | $query_params->{'filter[tls_domain.id]'} = $self->{api_client}->to_query_value($args{'filter[tls_domain/id]'}); | ||
| 252 | } | ||
| 253 | |||
| 254 | # query params | ||
| 255 | if ( exists $args{'filter[not_before]'}) { | ||
| 256 | $query_params->{'filter[not_before]'} = $self->{api_client}->to_query_value($args{'filter[not_before]'}); | ||
| 257 | } | ||
| 258 | |||
| 259 | # query params | ||
| 260 | if ( exists $args{'filter[not_after]'}) { | ||
| 261 | $query_params->{'filter[not_after]'} = $self->{api_client}->to_query_value($args{'filter[not_after]'}); | ||
| 262 | } | ||
| 263 | |||
| 264 | # query params | ||
| 265 | if ( exists $args{'page[number]'}) { | ||
| 266 | $query_params->{'page[number]'} = $self->{api_client}->to_query_value($args{'page[number]'}); | ||
| 267 | } | ||
| 268 | |||
| 269 | # query params | ||
| 270 | if ( exists $args{'page[size]'}) { | ||
| 271 | $query_params->{'page[size]'} = $self->{api_client}->to_query_value($args{'page[size]'}); | ||
| 272 | } | ||
| 273 | |||
| 274 | # query params | ||
| 275 | if ( exists $args{'sort'}) { | ||
| 276 | $query_params->{'sort'} = $self->{api_client}->to_query_value($args{'sort'}); | ||
| 277 | } | ||
| 278 | |||
| 279 | my $_body_data; | ||
| 280 | # authentication setting, if any | ||
| 281 | my $auth_settings = [qw(token )]; | ||
| 282 | |||
| 283 | # make the API Call | ||
| 284 | my $response = $self->{api_client}->call_api($_resource_path, $_method, | ||
| 285 | $query_params, $form_params, | ||
| 286 | $header_params, $_body_data, $auth_settings); | ||
| 287 | if (!$response) { | ||
| 288 | return; | ||
| 289 | } | ||
| 290 | my $_response_object = $self->{api_client}->deserialize('TlsBulkCertificatesResponse', $response); | ||
| 291 | return $_response_object; | ||
| 292 | } | ||
| 293 | |||
| 294 | # | ||
| 295 | # update_bulk_tls_cert | ||
| 296 | # | ||
| 297 | # Update a certificate | ||
| 298 | # | ||
| 299 | # @param string $certificate_id Alphanumeric string identifying a TLS bulk certificate. (required) | ||
| 300 | # @param TlsBulkCertificate $tls_bulk_certificate (optional) | ||
| 301 | { | ||
| 302 | my $params = { | ||
| 303 | 'certificate_id' => { | ||
| 304 | data_type => 'string', | ||
| 305 | description => 'Alphanumeric string identifying a TLS bulk certificate.', | ||
| 306 | required => '1', | ||
| 307 | }, | ||
| 308 | 'tls_bulk_certificate' => { | ||
| 309 | data_type => 'TlsBulkCertificate', | ||
| 310 | description => '', | ||
| 311 | required => '0', | ||
| 312 | }, | ||
| 313 | }; | ||
| 314 | __PACKAGE__->method_documentation->{ 'update_bulk_tls_cert' } = { | ||
| 315 | summary => 'Update a certificate', | ||
| 316 | params => $params, | ||
| 317 | returns => 'TlsBulkCertificateResponse', | ||
| 318 | }; | ||
| 319 | } | ||
| 320 | # @return TlsBulkCertificateResponse | ||
| 321 | # | ||
| 322 | sub update_bulk_tls_cert { | ||
| 323 | my ($self, %args) = @_; | ||
| 324 | |||
| 325 | # verify the required parameter 'certificate_id' is set | ||
| 326 | unless (exists $args{'certificate_id'}) { | ||
| 327 | croak("Missing the required parameter 'certificate_id' when calling update_bulk_tls_cert"); | ||
| 328 | } | ||
| 329 | |||
| 330 | # parse inputs | ||
| 331 | my $_resource_path = '/tls/bulk/certificates/{certificate_id}'; | ||
| 332 | |||
| 333 | my $_method = 'PATCH'; | ||
| 334 | my $query_params = {}; | ||
| 335 | my $header_params = {}; | ||
| 336 | my $form_params = {}; | ||
| 337 | |||
| 338 | # 'Accept' and 'Content-Type' header | ||
| 339 | my $_header_accept = $self->{api_client}->select_header_accept('application/vnd.api+json'); | ||
| 340 | if ($_header_accept) { | ||
| 341 | $header_params->{'Accept'} = $_header_accept; | ||
| 342 | } | ||
| 343 | $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/vnd.api+json'); | ||
| 344 | |||
| 345 | # path params | ||
| 346 | if ( exists $args{'certificate_id'}) { | ||
| 347 | my $_base_variable = "{" . "certificate_id" . "}"; | ||
| 348 | my $_base_value = $self->{api_client}->to_path_value($args{'certificate_id'}); | ||
| 349 | $_resource_path =~ s/$_base_variable/$_base_value/g; | ||
| 350 | } | ||
| 351 | |||
| 352 | my $_body_data; | ||
| 353 | # body params | ||
| 354 | if ( exists $args{'tls_bulk_certificate'}) { | ||
| 355 | $_body_data = $args{'tls_bulk_certificate'}; | ||
| 356 | } | ||
| 357 | |||
| 358 | # authentication setting, if any | ||
| 359 | my $auth_settings = [qw(token )]; | ||
| 360 | |||
| 361 | # make the API Call | ||
| 362 | my $response = $self->{api_client}->call_api($_resource_path, $_method, | ||
| 363 | $query_params, $form_params, | ||
| 364 | $header_params, $_body_data, $auth_settings); | ||
| 365 | if (!$response) { | ||
| 366 | return; | ||
| 367 | } | ||
| 368 | my $_response_object = $self->{api_client}->deserialize('TlsBulkCertificateResponse', $response); | ||
| 369 | return $_response_object; | ||
| 370 | } | ||
| 371 | |||
| 372 | # | ||
| 373 | # upload_tls_bulk_cert | ||
| 374 | # | ||
| 375 | # Upload a certificate | ||
| 376 | # | ||
| 377 | # @param TlsBulkCertificate $tls_bulk_certificate (optional) | ||
| 378 | { | ||
| 379 | my $params = { | ||
| 380 | 'tls_bulk_certificate' => { | ||
| 381 | data_type => 'TlsBulkCertificate', | ||
| 382 | description => '', | ||
| 383 | required => '0', | ||
| 384 | }, | ||
| 385 | }; | ||
| 386 | __PACKAGE__->method_documentation->{ 'upload_tls_bulk_cert' } = { | ||
| 387 | summary => 'Upload a certificate', | ||
| 388 | params => $params, | ||
| 389 | returns => 'TlsBulkCertificateResponse', | ||
| 390 | }; | ||
| 391 | } | ||
| 392 | # @return TlsBulkCertificateResponse | ||
| 393 | # | ||
| 394 | sub upload_tls_bulk_cert { | ||
| 395 | my ($self, %args) = @_; | ||
| 396 | |||
| 397 | # parse inputs | ||
| 398 | my $_resource_path = '/tls/bulk/certificates'; | ||
| 399 | |||
| 400 | my $_method = 'POST'; | ||
| 401 | my $query_params = {}; | ||
| 402 | my $header_params = {}; | ||
| 403 | my $form_params = {}; | ||
| 404 | |||
| 405 | # 'Accept' and 'Content-Type' header | ||
| 406 | my $_header_accept = $self->{api_client}->select_header_accept('application/vnd.api+json'); | ||
| 407 | if ($_header_accept) { | ||
| 408 | $header_params->{'Accept'} = $_header_accept; | ||
| 409 | } | ||
| 410 | $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/vnd.api+json'); | ||
| 411 | |||
| 412 | my $_body_data; | ||
| 413 | # body params | ||
| 414 | if ( exists $args{'tls_bulk_certificate'}) { | ||
| 415 | $_body_data = $args{'tls_bulk_certificate'}; | ||
| 416 | } | ||
| 417 | |||
| 418 | # authentication setting, if any | ||
| 419 | my $auth_settings = [qw(token )]; | ||
| 420 | |||
| 421 | # make the API Call | ||
| 422 | my $response = $self->{api_client}->call_api($_resource_path, $_method, | ||
| 423 | $query_params, $form_params, | ||
| 424 | $header_params, $_body_data, $auth_settings); | ||
| 425 | if (!$response) { | ||
| 426 | return; | ||
| 427 | } | ||
| 428 | my $_response_object = $self->{api_client}->deserialize('TlsBulkCertificateResponse', $response); | ||
| 429 | return $_response_object; | ||
| 430 | } | ||
| 431 | |||
| 432 | 1; |