| 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::AutomationTokensApi; | ||
| 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_automation_token | ||
| 51 | # | ||
| 52 | # Create Automation Token | ||
| 53 | # | ||
| 54 | # @param AutomationTokenCreateRequest $automation_token_create_request (optional) | ||
| 55 | { | ||
| 56 | my $params = { | ||
| 57 | 'automation_token_create_request' => { | ||
| 58 | data_type => 'AutomationTokenCreateRequest', | ||
| 59 | description => '', | ||
| 60 | required => '0', | ||
| 61 | }, | ||
| 62 | }; | ||
| 63 | __PACKAGE__->method_documentation->{ 'create_automation_token' } = { | ||
| 64 | summary => 'Create Automation Token', | ||
| 65 | params => $params, | ||
| 66 | returns => 'AutomationTokenCreateResponse', | ||
| 67 | }; | ||
| 68 | } | ||
| 69 | # @return AutomationTokenCreateResponse | ||
| 70 | # | ||
| 71 | sub create_automation_token { | ||
| 72 | my ($self, %args) = @_; | ||
| 73 | |||
| 74 | # parse inputs | ||
| 75 | my $_resource_path = '/automation-tokens'; | ||
| 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/json', 'application/problem+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/json'); | ||
| 88 | |||
| 89 | my $_body_data; | ||
| 90 | # body params | ||
| 91 | if ( exists $args{'automation_token_create_request'}) { | ||
| 92 | $_body_data = $args{'automation_token_create_request'}; | ||
| 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('AutomationTokenCreateResponse', $response); | ||
| 106 | return $_response_object; | ||
| 107 | } | ||
| 108 | |||
| 109 | # | ||
| 110 | # get_automation_token_id | ||
| 111 | # | ||
| 112 | # Retrieve an Automation Token by ID | ||
| 113 | # | ||
| 114 | # @param string $id (required) | ||
| 115 | { | ||
| 116 | my $params = { | ||
| 117 | 'id' => { | ||
| 118 | data_type => 'string', | ||
| 119 | description => '', | ||
| 120 | required => '1', | ||
| 121 | }, | ||
| 122 | }; | ||
| 123 | __PACKAGE__->method_documentation->{ 'get_automation_token_id' } = { | ||
| 124 | summary => 'Retrieve an Automation Token by ID', | ||
| 125 | params => $params, | ||
| 126 | returns => 'AutomationTokenResponse', | ||
| 127 | }; | ||
| 128 | } | ||
| 129 | # @return AutomationTokenResponse | ||
| 130 | # | ||
| 131 | sub get_automation_token_id { | ||
| 132 | my ($self, %args) = @_; | ||
| 133 | |||
| 134 | # verify the required parameter 'id' is set | ||
| 135 | unless (exists $args{'id'}) { | ||
| 136 | croak("Missing the required parameter 'id' when calling get_automation_token_id"); | ||
| 137 | } | ||
| 138 | |||
| 139 | # parse inputs | ||
| 140 | my $_resource_path = '/automation-tokens/{id}'; | ||
| 141 | |||
| 142 | my $_method = 'GET'; | ||
| 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('application/json', 'application/problem+json'); | ||
| 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{'id'}) { | ||
| 156 | my $_base_variable = "{" . "id" . "}"; | ||
| 157 | my $_base_value = $self->{api_client}->to_path_value($args{'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 | my $response = $self->{api_client}->call_api($_resource_path, $_method, | ||
| 167 | $query_params, $form_params, | ||
| 168 | $header_params, $_body_data, $auth_settings); | ||
| 169 | if (!$response) { | ||
| 170 | return; | ||
| 171 | } | ||
| 172 | my $_response_object = $self->{api_client}->deserialize('AutomationTokenResponse', $response); | ||
| 173 | return $_response_object; | ||
| 174 | } | ||
| 175 | |||
| 176 | # | ||
| 177 | # get_automation_tokens_id_services | ||
| 178 | # | ||
| 179 | # List Automation Token Services | ||
| 180 | # | ||
| 181 | # @param string $id (required) | ||
| 182 | # @param int $per_page (optional) | ||
| 183 | # @param int $page (optional) | ||
| 184 | { | ||
| 185 | my $params = { | ||
| 186 | 'id' => { | ||
| 187 | data_type => 'string', | ||
| 188 | description => '', | ||
| 189 | required => '1', | ||
| 190 | }, | ||
| 191 | 'per_page' => { | ||
| 192 | data_type => 'int', | ||
| 193 | description => '', | ||
| 194 | required => '0', | ||
| 195 | }, | ||
| 196 | 'page' => { | ||
| 197 | data_type => 'int', | ||
| 198 | description => '', | ||
| 199 | required => '0', | ||
| 200 | }, | ||
| 201 | }; | ||
| 202 | __PACKAGE__->method_documentation->{ 'get_automation_tokens_id_services' } = { | ||
| 203 | summary => 'List Automation Token Services', | ||
| 204 | params => $params, | ||
| 205 | returns => 'InlineResponse2004', | ||
| 206 | }; | ||
| 207 | } | ||
| 208 | # @return InlineResponse2004 | ||
| 209 | # | ||
| 210 | sub get_automation_tokens_id_services { | ||
| 211 | my ($self, %args) = @_; | ||
| 212 | |||
| 213 | # verify the required parameter 'id' is set | ||
| 214 | unless (exists $args{'id'}) { | ||
| 215 | croak("Missing the required parameter 'id' when calling get_automation_tokens_id_services"); | ||
| 216 | } | ||
| 217 | |||
| 218 | # parse inputs | ||
| 219 | my $_resource_path = '/automation-tokens/{id}/services'; | ||
| 220 | |||
| 221 | my $_method = 'GET'; | ||
| 222 | my $query_params = {}; | ||
| 223 | my $header_params = {}; | ||
| 224 | my $form_params = {}; | ||
| 225 | |||
| 226 | # 'Accept' and 'Content-Type' header | ||
| 227 | my $_header_accept = $self->{api_client}->select_header_accept('application/json', 'application/problem+json'); | ||
| 228 | if ($_header_accept) { | ||
| 229 | $header_params->{'Accept'} = $_header_accept; | ||
| 230 | } | ||
| 231 | $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type(); | ||
| 232 | |||
| 233 | # query params | ||
| 234 | if ( exists $args{'per_page'}) { | ||
| 235 | $query_params->{'per_page'} = $self->{api_client}->to_query_value($args{'per_page'}); | ||
| 236 | } | ||
| 237 | |||
| 238 | # query params | ||
| 239 | if ( exists $args{'page'}) { | ||
| 240 | $query_params->{'page'} = $self->{api_client}->to_query_value($args{'page'}); | ||
| 241 | } | ||
| 242 | |||
| 243 | # path params | ||
| 244 | if ( exists $args{'id'}) { | ||
| 245 | my $_base_variable = "{" . "id" . "}"; | ||
| 246 | my $_base_value = $self->{api_client}->to_path_value($args{'id'}); | ||
| 247 | $_resource_path =~ s/$_base_variable/$_base_value/g; | ||
| 248 | } | ||
| 249 | |||
| 250 | my $_body_data; | ||
| 251 | # authentication setting, if any | ||
| 252 | my $auth_settings = [qw(token )]; | ||
| 253 | |||
| 254 | # make the API Call | ||
| 255 | my $response = $self->{api_client}->call_api($_resource_path, $_method, | ||
| 256 | $query_params, $form_params, | ||
| 257 | $header_params, $_body_data, $auth_settings); | ||
| 258 | if (!$response) { | ||
| 259 | return; | ||
| 260 | } | ||
| 261 | my $_response_object = $self->{api_client}->deserialize('InlineResponse2004', $response); | ||
| 262 | return $_response_object; | ||
| 263 | } | ||
| 264 | |||
| 265 | # | ||
| 266 | # get_automation_tokens_id_workspaces | ||
| 267 | # | ||
| 268 | # List Automation Token Workspaces | ||
| 269 | # | ||
| 270 | # @param string $id The alphanumeric string identifying the automation token. (required) | ||
| 271 | # @param int $limit Maximum number of workspaces to return per page. (optional, default to 20) | ||
| 272 | # @param string $cursor Pagination cursor from a previous response. Pass the `next_cursor` value to retrieve the next page, or `previous_cursor` to go back. (optional) | ||
| 273 | { | ||
| 274 | my $params = { | ||
| 275 | 'id' => { | ||
| 276 | data_type => 'string', | ||
| 277 | description => 'The alphanumeric string identifying the automation token.', | ||
| 278 | required => '1', | ||
| 279 | }, | ||
| 280 | 'limit' => { | ||
| 281 | data_type => 'int', | ||
| 282 | description => 'Maximum number of workspaces to return per page.', | ||
| 283 | required => '0', | ||
| 284 | }, | ||
| 285 | 'cursor' => { | ||
| 286 | data_type => 'string', | ||
| 287 | description => 'Pagination cursor from a previous response. Pass the `next_cursor` value to retrieve the next page, or `previous_cursor` to go back.', | ||
| 288 | required => '0', | ||
| 289 | }, | ||
| 290 | }; | ||
| 291 | __PACKAGE__->method_documentation->{ 'get_automation_tokens_id_workspaces' } = { | ||
| 292 | summary => 'List Automation Token Workspaces', | ||
| 293 | params => $params, | ||
| 294 | returns => 'AutomationTokenWorkspacesResponse', | ||
| 295 | }; | ||
| 296 | } | ||
| 297 | # @return AutomationTokenWorkspacesResponse | ||
| 298 | # | ||
| 299 | sub get_automation_tokens_id_workspaces { | ||
| 300 | my ($self, %args) = @_; | ||
| 301 | |||
| 302 | # verify the required parameter 'id' is set | ||
| 303 | unless (exists $args{'id'}) { | ||
| 304 | croak("Missing the required parameter 'id' when calling get_automation_tokens_id_workspaces"); | ||
| 305 | } | ||
| 306 | |||
| 307 | # parse inputs | ||
| 308 | my $_resource_path = '/automation-tokens/{id}/workspaces'; | ||
| 309 | |||
| 310 | my $_method = 'GET'; | ||
| 311 | my $query_params = {}; | ||
| 312 | my $header_params = {}; | ||
| 313 | my $form_params = {}; | ||
| 314 | |||
| 315 | # 'Accept' and 'Content-Type' header | ||
| 316 | my $_header_accept = $self->{api_client}->select_header_accept('application/json', 'application/problem+json'); | ||
| 317 | if ($_header_accept) { | ||
| 318 | $header_params->{'Accept'} = $_header_accept; | ||
| 319 | } | ||
| 320 | $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type(); | ||
| 321 | |||
| 322 | # query params | ||
| 323 | if ( exists $args{'limit'}) { | ||
| 324 | $query_params->{'limit'} = $self->{api_client}->to_query_value($args{'limit'}); | ||
| 325 | } | ||
| 326 | |||
| 327 | # query params | ||
| 328 | if ( exists $args{'cursor'}) { | ||
| 329 | $query_params->{'cursor'} = $self->{api_client}->to_query_value($args{'cursor'}); | ||
| 330 | } | ||
| 331 | |||
| 332 | # path params | ||
| 333 | if ( exists $args{'id'}) { | ||
| 334 | my $_base_variable = "{" . "id" . "}"; | ||
| 335 | my $_base_value = $self->{api_client}->to_path_value($args{'id'}); | ||
| 336 | $_resource_path =~ s/$_base_variable/$_base_value/g; | ||
| 337 | } | ||
| 338 | |||
| 339 | my $_body_data; | ||
| 340 | # authentication setting, if any | ||
| 341 | my $auth_settings = [qw(token )]; | ||
| 342 | |||
| 343 | # make the API Call | ||
| 344 | my $response = $self->{api_client}->call_api($_resource_path, $_method, | ||
| 345 | $query_params, $form_params, | ||
| 346 | $header_params, $_body_data, $auth_settings); | ||
| 347 | if (!$response) { | ||
| 348 | return; | ||
| 349 | } | ||
| 350 | my $_response_object = $self->{api_client}->deserialize('AutomationTokenWorkspacesResponse', $response); | ||
| 351 | return $_response_object; | ||
| 352 | } | ||
| 353 | |||
| 354 | # | ||
| 355 | # list_automation_tokens | ||
| 356 | # | ||
| 357 | # List Customer Automation Tokens | ||
| 358 | # | ||
| 359 | # @param int $per_page (optional) | ||
| 360 | # @param int $page (optional) | ||
| 361 | { | ||
| 362 | my $params = { | ||
| 363 | 'per_page' => { | ||
| 364 | data_type => 'int', | ||
| 365 | description => '', | ||
| 366 | required => '0', | ||
| 367 | }, | ||
| 368 | 'page' => { | ||
| 369 | data_type => 'int', | ||
| 370 | description => '', | ||
| 371 | required => '0', | ||
| 372 | }, | ||
| 373 | }; | ||
| 374 | __PACKAGE__->method_documentation->{ 'list_automation_tokens' } = { | ||
| 375 | summary => 'List Customer Automation Tokens', | ||
| 376 | params => $params, | ||
| 377 | returns => 'ARRAY[AutomationTokenResponse]', | ||
| 378 | }; | ||
| 379 | } | ||
| 380 | # @return ARRAY[AutomationTokenResponse] | ||
| 381 | # | ||
| 382 | sub list_automation_tokens { | ||
| 383 | my ($self, %args) = @_; | ||
| 384 | |||
| 385 | # parse inputs | ||
| 386 | my $_resource_path = '/automation-tokens'; | ||
| 387 | |||
| 388 | my $_method = 'GET'; | ||
| 389 | my $query_params = {}; | ||
| 390 | my $header_params = {}; | ||
| 391 | my $form_params = {}; | ||
| 392 | |||
| 393 | # 'Accept' and 'Content-Type' header | ||
| 394 | my $_header_accept = $self->{api_client}->select_header_accept('application/json', 'application/problem+json'); | ||
| 395 | if ($_header_accept) { | ||
| 396 | $header_params->{'Accept'} = $_header_accept; | ||
| 397 | } | ||
| 398 | $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type(); | ||
| 399 | |||
| 400 | # query params | ||
| 401 | if ( exists $args{'per_page'}) { | ||
| 402 | $query_params->{'per_page'} = $self->{api_client}->to_query_value($args{'per_page'}); | ||
| 403 | } | ||
| 404 | |||
| 405 | # query params | ||
| 406 | if ( exists $args{'page'}) { | ||
| 407 | $query_params->{'page'} = $self->{api_client}->to_query_value($args{'page'}); | ||
| 408 | } | ||
| 409 | |||
| 410 | my $_body_data; | ||
| 411 | # authentication setting, if any | ||
| 412 | my $auth_settings = [qw(token )]; | ||
| 413 | |||
| 414 | # make the API Call | ||
| 415 | my $response = $self->{api_client}->call_api($_resource_path, $_method, | ||
| 416 | $query_params, $form_params, | ||
| 417 | $header_params, $_body_data, $auth_settings); | ||
| 418 | if (!$response) { | ||
| 419 | return; | ||
| 420 | } | ||
| 421 | my $_response_object = $self->{api_client}->deserialize('ARRAY[AutomationTokenResponse]', $response); | ||
| 422 | return $_response_object; | ||
| 423 | } | ||
| 424 | |||
| 425 | # | ||
| 426 | # revoke_automation_token_id | ||
| 427 | # | ||
| 428 | # Revoke an Automation Token by ID | ||
| 429 | # | ||
| 430 | # @param string $id (required) | ||
| 431 | { | ||
| 432 | my $params = { | ||
| 433 | 'id' => { | ||
| 434 | data_type => 'string', | ||
| 435 | description => '', | ||
| 436 | required => '1', | ||
| 437 | }, | ||
| 438 | }; | ||
| 439 | __PACKAGE__->method_documentation->{ 'revoke_automation_token_id' } = { | ||
| 440 | summary => 'Revoke an Automation Token by ID', | ||
| 441 | params => $params, | ||
| 442 | returns => 'AutomationTokenErrorResponse', | ||
| 443 | }; | ||
| 444 | } | ||
| 445 | # @return AutomationTokenErrorResponse | ||
| 446 | # | ||
| 447 | sub revoke_automation_token_id { | ||
| 448 | my ($self, %args) = @_; | ||
| 449 | |||
| 450 | # verify the required parameter 'id' is set | ||
| 451 | unless (exists $args{'id'}) { | ||
| 452 | croak("Missing the required parameter 'id' when calling revoke_automation_token_id"); | ||
| 453 | } | ||
| 454 | |||
| 455 | # parse inputs | ||
| 456 | my $_resource_path = '/automation-tokens/{id}'; | ||
| 457 | |||
| 458 | my $_method = 'DELETE'; | ||
| 459 | my $query_params = {}; | ||
| 460 | my $header_params = {}; | ||
| 461 | my $form_params = {}; | ||
| 462 | |||
| 463 | # 'Accept' and 'Content-Type' header | ||
| 464 | my $_header_accept = $self->{api_client}->select_header_accept('application/json', 'application/problem+json'); | ||
| 465 | if ($_header_accept) { | ||
| 466 | $header_params->{'Accept'} = $_header_accept; | ||
| 467 | } | ||
| 468 | $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type(); | ||
| 469 | |||
| 470 | # path params | ||
| 471 | if ( exists $args{'id'}) { | ||
| 472 | my $_base_variable = "{" . "id" . "}"; | ||
| 473 | my $_base_value = $self->{api_client}->to_path_value($args{'id'}); | ||
| 474 | $_resource_path =~ s/$_base_variable/$_base_value/g; | ||
| 475 | } | ||
| 476 | |||
| 477 | my $_body_data; | ||
| 478 | # authentication setting, if any | ||
| 479 | my $auth_settings = [qw(token )]; | ||
| 480 | |||
| 481 | # make the API Call | ||
| 482 | my $response = $self->{api_client}->call_api($_resource_path, $_method, | ||
| 483 | $query_params, $form_params, | ||
| 484 | $header_params, $_body_data, $auth_settings); | ||
| 485 | if (!$response) { | ||
| 486 | return; | ||
| 487 | } | ||
| 488 | my $_response_object = $self->{api_client}->deserialize('AutomationTokenErrorResponse', $response); | ||
| 489 | return $_response_object; | ||
| 490 | } | ||
| 491 | |||
| 492 | 1; |