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