| 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::ObservabilityCustomDashboardsApi; | ||
| 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_dashboard | ||
| 51 | # | ||
| 52 | # Create a new dashboard | ||
| 53 | # | ||
| 54 | # @param CreateDashboardRequest $create_dashboard_request (optional) | ||
| 55 | { | ||
| 56 | my $params = { | ||
| 57 | 'create_dashboard_request' => { | ||
| 58 | data_type => 'CreateDashboardRequest', | ||
| 59 | description => '', | ||
| 60 | required => '0', | ||
| 61 | }, | ||
| 62 | }; | ||
| 63 | __PACKAGE__->method_documentation->{ 'create_dashboard' } = { | ||
| 64 | summary => 'Create a new dashboard', | ||
| 65 | params => $params, | ||
| 66 | returns => 'Dashboard', | ||
| 67 | }; | ||
| 68 | } | ||
| 69 | # @return Dashboard | ||
| 70 | # | ||
| 71 | sub create_dashboard { | ||
| 72 | my ($self, %args) = @_; | ||
| 73 | |||
| 74 | # parse inputs | ||
| 75 | my $_resource_path = '/observability/dashboards'; | ||
| 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'); | ||
| 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{'create_dashboard_request'}) { | ||
| 92 | $_body_data = $args{'create_dashboard_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('Dashboard', $response); | ||
| 106 | return $_response_object; | ||
| 107 | } | ||
| 108 | |||
| 109 | # | ||
| 110 | # delete_dashboard | ||
| 111 | # | ||
| 112 | # Delete an existing dashboard | ||
| 113 | # | ||
| 114 | # @param string $dashboard_id (required) | ||
| 115 | { | ||
| 116 | my $params = { | ||
| 117 | 'dashboard_id' => { | ||
| 118 | data_type => 'string', | ||
| 119 | description => '', | ||
| 120 | required => '1', | ||
| 121 | }, | ||
| 122 | }; | ||
| 123 | __PACKAGE__->method_documentation->{ 'delete_dashboard' } = { | ||
| 124 | summary => 'Delete an existing dashboard', | ||
| 125 | params => $params, | ||
| 126 | returns => undef, | ||
| 127 | }; | ||
| 128 | } | ||
| 129 | # @return void | ||
| 130 | # | ||
| 131 | sub delete_dashboard { | ||
| 132 | my ($self, %args) = @_; | ||
| 133 | |||
| 134 | # verify the required parameter 'dashboard_id' is set | ||
| 135 | unless (exists $args{'dashboard_id'}) { | ||
| 136 | croak("Missing the required parameter 'dashboard_id' when calling delete_dashboard"); | ||
| 137 | } | ||
| 138 | |||
| 139 | # parse inputs | ||
| 140 | my $_resource_path = '/observability/dashboards/{dashboard_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{'dashboard_id'}) { | ||
| 156 | my $_base_variable = "{" . "dashboard_id" . "}"; | ||
| 157 | my $_base_value = $self->{api_client}->to_path_value($args{'dashboard_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_dashboard | ||
| 174 | # | ||
| 175 | # Retrieve a dashboard by ID | ||
| 176 | # | ||
| 177 | # @param string $dashboard_id (required) | ||
| 178 | { | ||
| 179 | my $params = { | ||
| 180 | 'dashboard_id' => { | ||
| 181 | data_type => 'string', | ||
| 182 | description => '', | ||
| 183 | required => '1', | ||
| 184 | }, | ||
| 185 | }; | ||
| 186 | __PACKAGE__->method_documentation->{ 'get_dashboard' } = { | ||
| 187 | summary => 'Retrieve a dashboard by ID', | ||
| 188 | params => $params, | ||
| 189 | returns => 'Dashboard', | ||
| 190 | }; | ||
| 191 | } | ||
| 192 | # @return Dashboard | ||
| 193 | # | ||
| 194 | sub get_dashboard { | ||
| 195 | my ($self, %args) = @_; | ||
| 196 | |||
| 197 | # verify the required parameter 'dashboard_id' is set | ||
| 198 | unless (exists $args{'dashboard_id'}) { | ||
| 199 | croak("Missing the required parameter 'dashboard_id' when calling get_dashboard"); | ||
| 200 | } | ||
| 201 | |||
| 202 | # parse inputs | ||
| 203 | my $_resource_path = '/observability/dashboards/{dashboard_id}'; | ||
| 204 | |||
| 205 | my $_method = 'GET'; | ||
| 206 | my $query_params = {}; | ||
| 207 | my $header_params = {}; | ||
| 208 | my $form_params = {}; | ||
| 209 | |||
| 210 | # 'Accept' and 'Content-Type' header | ||
| 211 | my $_header_accept = $self->{api_client}->select_header_accept('application/json'); | ||
| 212 | if ($_header_accept) { | ||
| 213 | $header_params->{'Accept'} = $_header_accept; | ||
| 214 | } | ||
| 215 | $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type(); | ||
| 216 | |||
| 217 | # path params | ||
| 218 | if ( exists $args{'dashboard_id'}) { | ||
| 219 | my $_base_variable = "{" . "dashboard_id" . "}"; | ||
| 220 | my $_base_value = $self->{api_client}->to_path_value($args{'dashboard_id'}); | ||
| 221 | $_resource_path =~ s/$_base_variable/$_base_value/g; | ||
| 222 | } | ||
| 223 | |||
| 224 | my $_body_data; | ||
| 225 | # authentication setting, if any | ||
| 226 | my $auth_settings = [qw(token )]; | ||
| 227 | |||
| 228 | # make the API Call | ||
| 229 | my $response = $self->{api_client}->call_api($_resource_path, $_method, | ||
| 230 | $query_params, $form_params, | ||
| 231 | $header_params, $_body_data, $auth_settings); | ||
| 232 | if (!$response) { | ||
| 233 | return; | ||
| 234 | } | ||
| 235 | my $_response_object = $self->{api_client}->deserialize('Dashboard', $response); | ||
| 236 | return $_response_object; | ||
| 237 | } | ||
| 238 | |||
| 239 | # | ||
| 240 | # list_dashboards | ||
| 241 | # | ||
| 242 | # List all custom dashboards | ||
| 243 | # | ||
| 244 | { | ||
| 245 | my $params = { | ||
| 246 | }; | ||
| 247 | __PACKAGE__->method_documentation->{ 'list_dashboards' } = { | ||
| 248 | summary => 'List all custom dashboards', | ||
| 249 | params => $params, | ||
| 250 | returns => 'ListDashboardsResponse', | ||
| 251 | }; | ||
| 252 | } | ||
| 253 | # @return ListDashboardsResponse | ||
| 254 | # | ||
| 255 | sub list_dashboards { | ||
| 256 | my ($self, %args) = @_; | ||
| 257 | |||
| 258 | # parse inputs | ||
| 259 | my $_resource_path = '/observability/dashboards'; | ||
| 260 | |||
| 261 | my $_method = 'GET'; | ||
| 262 | my $query_params = {}; | ||
| 263 | my $header_params = {}; | ||
| 264 | my $form_params = {}; | ||
| 265 | |||
| 266 | # 'Accept' and 'Content-Type' header | ||
| 267 | my $_header_accept = $self->{api_client}->select_header_accept('application/json'); | ||
| 268 | if ($_header_accept) { | ||
| 269 | $header_params->{'Accept'} = $_header_accept; | ||
| 270 | } | ||
| 271 | $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type(); | ||
| 272 | |||
| 273 | my $_body_data; | ||
| 274 | # authentication setting, if any | ||
| 275 | my $auth_settings = [qw(token )]; | ||
| 276 | |||
| 277 | # make the API Call | ||
| 278 | my $response = $self->{api_client}->call_api($_resource_path, $_method, | ||
| 279 | $query_params, $form_params, | ||
| 280 | $header_params, $_body_data, $auth_settings); | ||
| 281 | if (!$response) { | ||
| 282 | return; | ||
| 283 | } | ||
| 284 | my $_response_object = $self->{api_client}->deserialize('ListDashboardsResponse', $response); | ||
| 285 | return $_response_object; | ||
| 286 | } | ||
| 287 | |||
| 288 | # | ||
| 289 | # update_dashboard | ||
| 290 | # | ||
| 291 | # Update an existing dashboard | ||
| 292 | # | ||
| 293 | # @param string $dashboard_id (required) | ||
| 294 | # @param UpdateDashboardRequest $update_dashboard_request (optional) | ||
| 295 | { | ||
| 296 | my $params = { | ||
| 297 | 'dashboard_id' => { | ||
| 298 | data_type => 'string', | ||
| 299 | description => '', | ||
| 300 | required => '1', | ||
| 301 | }, | ||
| 302 | 'update_dashboard_request' => { | ||
| 303 | data_type => 'UpdateDashboardRequest', | ||
| 304 | description => '', | ||
| 305 | required => '0', | ||
| 306 | }, | ||
| 307 | }; | ||
| 308 | __PACKAGE__->method_documentation->{ 'update_dashboard' } = { | ||
| 309 | summary => 'Update an existing dashboard', | ||
| 310 | params => $params, | ||
| 311 | returns => 'Dashboard', | ||
| 312 | }; | ||
| 313 | } | ||
| 314 | # @return Dashboard | ||
| 315 | # | ||
| 316 | sub update_dashboard { | ||
| 317 | my ($self, %args) = @_; | ||
| 318 | |||
| 319 | # verify the required parameter 'dashboard_id' is set | ||
| 320 | unless (exists $args{'dashboard_id'}) { | ||
| 321 | croak("Missing the required parameter 'dashboard_id' when calling update_dashboard"); | ||
| 322 | } | ||
| 323 | |||
| 324 | # parse inputs | ||
| 325 | my $_resource_path = '/observability/dashboards/{dashboard_id}'; | ||
| 326 | |||
| 327 | my $_method = 'PATCH'; | ||
| 328 | my $query_params = {}; | ||
| 329 | my $header_params = {}; | ||
| 330 | my $form_params = {}; | ||
| 331 | |||
| 332 | # 'Accept' and 'Content-Type' header | ||
| 333 | my $_header_accept = $self->{api_client}->select_header_accept('application/json'); | ||
| 334 | if ($_header_accept) { | ||
| 335 | $header_params->{'Accept'} = $_header_accept; | ||
| 336 | } | ||
| 337 | $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/json'); | ||
| 338 | |||
| 339 | # path params | ||
| 340 | if ( exists $args{'dashboard_id'}) { | ||
| 341 | my $_base_variable = "{" . "dashboard_id" . "}"; | ||
| 342 | my $_base_value = $self->{api_client}->to_path_value($args{'dashboard_id'}); | ||
| 343 | $_resource_path =~ s/$_base_variable/$_base_value/g; | ||
| 344 | } | ||
| 345 | |||
| 346 | my $_body_data; | ||
| 347 | # body params | ||
| 348 | if ( exists $args{'update_dashboard_request'}) { | ||
| 349 | $_body_data = $args{'update_dashboard_request'}; | ||
| 350 | } | ||
| 351 | |||
| 352 | # authentication setting, if any | ||
| 353 | my $auth_settings = [qw(token )]; | ||
| 354 | |||
| 355 | # make the API Call | ||
| 356 | my $response = $self->{api_client}->call_api($_resource_path, $_method, | ||
| 357 | $query_params, $form_params, | ||
| 358 | $header_params, $_body_data, $auth_settings); | ||
| 359 | if (!$response) { | ||
| 360 | return; | ||
| 361 | } | ||
| 362 | my $_response_object = $self->{api_client}->deserialize('Dashboard', $response); | ||
| 363 | return $_response_object; | ||
| 364 | } | ||
| 365 | |||
| 366 | 1; |