Hide Show 12 lines of Pod
require
5.6.0;
__PACKAGE__->mk_classdata(
'method_documentation'
=> {});
sub
new {
my
$class
=
shift
;
my
$api_client
;
if
(
$_
[0] &&
ref
$_
[0] &&
ref
$_
[0] eq
'WebService::Fastly::ApiClient'
) {
$api_client
=
$_
[0];
}
else
{
$api_client
= WebService::Fastly::ApiClient->new(
@_
);
}
bless
{
api_client
=>
$api_client
},
$class
;
}
{
my
$params
= {
'service_id'
=> {
data_type
=>
'string'
,
description
=>
'Alphanumeric string identifying the service.'
,
required
=>
'1'
,
},
'version_id'
=> {
data_type
=>
'int'
,
description
=>
'Integer identifying a service version.'
,
required
=>
'1'
,
},
'check_interval'
=> {
data_type
=>
'int'
,
description
=>
'How often to run the health check in milliseconds.'
,
required
=>
'0'
,
},
'comment'
=> {
data_type
=>
'string'
,
description
=>
'A freeform descriptive note.'
,
required
=>
'0'
,
},
'expected_response'
=> {
data_type
=>
'int'
,
description
=>
'The status code expected from the host.'
,
required
=>
'0'
,
},
'headers'
=> {
data_type
=>
'ARRAY[string]'
,
description
=>
'Array of custom headers that will be added to the health check probes.'
,
required
=>
'0'
,
},
'host'
=> {
data_type
=>
'string'
,
description
=>
'Which host to check.'
,
required
=>
'0'
,
},
'http_version'
=> {
data_type
=>
'string'
,
description
=>
'Whether to use version 1.0 or 1.1 HTTP.'
,
required
=>
'0'
,
},
'initial'
=> {
data_type
=>
'int'
,
description
=>
'When loading a config, the initial number of probes to be seen as OK.'
,
required
=>
'0'
,
},
'method'
=> {
data_type
=>
'string'
,
description
=>
'Which HTTP method to use.'
,
required
=>
'0'
,
},
'name'
=> {
data_type
=>
'string'
,
description
=>
'The name of the health check.'
,
required
=>
'0'
,
},
'path'
=> {
data_type
=>
'string'
,
description
=>
'The path to check.'
,
required
=>
'0'
,
},
'threshold'
=> {
data_type
=>
'int'
,
description
=>
'How many health checks must succeed to be considered healthy.'
,
required
=>
'0'
,
},
'timeout'
=> {
data_type
=>
'int'
,
description
=>
'Timeout in milliseconds.'
,
required
=>
'0'
,
},
'window'
=> {
data_type
=>
'int'
,
description
=>
'The number of most recent health check queries to keep for this health check.'
,
required
=>
'0'
,
},
};
__PACKAGE__->method_documentation->{
'create_healthcheck'
} = {
summary
=>
'Create a health check'
,
params
=>
$params
,
returns
=>
'HealthcheckResponse'
,
};
}
sub
create_healthcheck {
my
(
$self
,
%args
) =
@_
;
unless
(
exists
$args
{
'service_id'
}) {
croak(
"Missing the required parameter 'service_id' when calling create_healthcheck"
);
}
unless
(
exists
$args
{
'version_id'
}) {
croak(
"Missing the required parameter 'version_id' when calling create_healthcheck"
);
}
my
$_resource_path
=
'/service/{service_id}/version/{version_id}/healthcheck'
;
my
$_method
=
'POST'
;
my
$query_params
= {};
my
$header_params
= {};
my
$form_params
= {};
my
$_header_accept
=
$self
->{api_client}->select_header_accept(
'application/json'
);
if
(
$_header_accept
) {
$header_params
->{
'Accept'
} =
$_header_accept
;
}
$header_params
->{
'Content-Type'
} =
$self
->{api_client}->select_header_content_type(
'application/x-www-form-urlencoded'
);
if
(
exists
$args
{
'service_id'
}) {
my
$_base_variable
=
"{"
.
"service_id"
.
"}"
;
my
$_base_value
=
$self
->{api_client}->to_path_value(
$args
{
'service_id'
});
$_resource_path
=~ s/
$_base_variable
/
$_base_value
/g;
}
if
(
exists
$args
{
'version_id'
}) {
my
$_base_variable
=
"{"
.
"version_id"
.
"}"
;
my
$_base_value
=
$self
->{api_client}->to_path_value(
$args
{
'version_id'
});
$_resource_path
=~ s/
$_base_variable
/
$_base_value
/g;
}
if
(
exists
$args
{
'check_interval'
} ) {
$form_params
->{
'check_interval'
} =
$self
->{api_client}->to_form_value(
$args
{
'check_interval'
});
}
if
(
exists
$args
{
'comment'
} ) {
$form_params
->{
'comment'
} =
$self
->{api_client}->to_form_value(
$args
{
'comment'
});
}
if
(
exists
$args
{
'expected_response'
} ) {
$form_params
->{
'expected_response'
} =
$self
->{api_client}->to_form_value(
$args
{
'expected_response'
});
}
if
(
exists
$args
{
'headers'
} ) {
$form_params
->{
'headers'
} =
$self
->{api_client}->to_form_value(
$args
{
'headers'
});
}
if
(
exists
$args
{
'host'
} ) {
$form_params
->{
'host'
} =
$self
->{api_client}->to_form_value(
$args
{
'host'
});
}
if
(
exists
$args
{
'http_version'
} ) {
$form_params
->{
'http_version'
} =
$self
->{api_client}->to_form_value(
$args
{
'http_version'
});
}
if
(
exists
$args
{
'initial'
} ) {
$form_params
->{
'initial'
} =
$self
->{api_client}->to_form_value(
$args
{
'initial'
});
}
if
(
exists
$args
{
'method'
} ) {
$form_params
->{
'method'
} =
$self
->{api_client}->to_form_value(
$args
{
'method'
});
}
if
(
exists
$args
{
'name'
} ) {
$form_params
->{
'name'
} =
$self
->{api_client}->to_form_value(
$args
{
'name'
});
}
if
(
exists
$args
{
'path'
} ) {
$form_params
->{
'path'
} =
$self
->{api_client}->to_form_value(
$args
{
'path'
});
}
if
(
exists
$args
{
'threshold'
} ) {
$form_params
->{
'threshold'
} =
$self
->{api_client}->to_form_value(
$args
{
'threshold'
});
}
if
(
exists
$args
{
'timeout'
} ) {
$form_params
->{
'timeout'
} =
$self
->{api_client}->to_form_value(
$args
{
'timeout'
});
}
if
(
exists
$args
{
'window'
} ) {
$form_params
->{
'window'
} =
$self
->{api_client}->to_form_value(
$args
{
'window'
});
}
my
$_body_data
;
my
$auth_settings
= [
qw(token )
];
my
$response
=
$self
->{api_client}->call_api(
$_resource_path
,
$_method
,
$query_params
,
$form_params
,
$header_params
,
$_body_data
,
$auth_settings
);
if
(!
$response
) {
return
;
}
my
$_response_object
=
$self
->{api_client}->deserialize(
'HealthcheckResponse'
,
$response
);
return
$_response_object
;
}
{
my
$params
= {
'service_id'
=> {
data_type
=>
'string'
,
description
=>
'Alphanumeric string identifying the service.'
,
required
=>
'1'
,
},
'version_id'
=> {
data_type
=>
'int'
,
description
=>
'Integer identifying a service version.'
,
required
=>
'1'
,
},
'healthcheck_name'
=> {
data_type
=>
'string'
,
description
=>
'The name of the health check.'
,
required
=>
'1'
,
},
};
__PACKAGE__->method_documentation->{
'delete_healthcheck'
} = {
summary
=>
'Delete a health check'
,
params
=>
$params
,
returns
=>
'InlineResponse200'
,
};
}
sub
delete_healthcheck {
my
(
$self
,
%args
) =
@_
;
unless
(
exists
$args
{
'service_id'
}) {
croak(
"Missing the required parameter 'service_id' when calling delete_healthcheck"
);
}
unless
(
exists
$args
{
'version_id'
}) {
croak(
"Missing the required parameter 'version_id' when calling delete_healthcheck"
);
}
unless
(
exists
$args
{
'healthcheck_name'
}) {
croak(
"Missing the required parameter 'healthcheck_name' when calling delete_healthcheck"
);
}
my
$_resource_path
=
'/service/{service_id}/version/{version_id}/healthcheck/{healthcheck_name}'
;
my
$_method
=
'DELETE'
;
my
$query_params
= {};
my
$header_params
= {};
my
$form_params
= {};
my
$_header_accept
=
$self
->{api_client}->select_header_accept(
'application/json'
);
if
(
$_header_accept
) {
$header_params
->{
'Accept'
} =
$_header_accept
;
}
$header_params
->{
'Content-Type'
} =
$self
->{api_client}->select_header_content_type();
if
(
exists
$args
{
'service_id'
}) {
my
$_base_variable
=
"{"
.
"service_id"
.
"}"
;
my
$_base_value
=
$self
->{api_client}->to_path_value(
$args
{
'service_id'
});
$_resource_path
=~ s/
$_base_variable
/
$_base_value
/g;
}
if
(
exists
$args
{
'version_id'
}) {
my
$_base_variable
=
"{"
.
"version_id"
.
"}"
;
my
$_base_value
=
$self
->{api_client}->to_path_value(
$args
{
'version_id'
});
$_resource_path
=~ s/
$_base_variable
/
$_base_value
/g;
}
if
(
exists
$args
{
'healthcheck_name'
}) {
my
$_base_variable
=
"{"
.
"healthcheck_name"
.
"}"
;
my
$_base_value
=
$self
->{api_client}->to_path_value(
$args
{
'healthcheck_name'
});
$_resource_path
=~ s/
$_base_variable
/
$_base_value
/g;
}
my
$_body_data
;
my
$auth_settings
= [
qw(token )
];
my
$response
=
$self
->{api_client}->call_api(
$_resource_path
,
$_method
,
$query_params
,
$form_params
,
$header_params
,
$_body_data
,
$auth_settings
);
if
(!
$response
) {
return
;
}
my
$_response_object
=
$self
->{api_client}->deserialize(
'InlineResponse200'
,
$response
);
return
$_response_object
;
}
{
my
$params
= {
'service_id'
=> {
data_type
=>
'string'
,
description
=>
'Alphanumeric string identifying the service.'
,
required
=>
'1'
,
},
'version_id'
=> {
data_type
=>
'int'
,
description
=>
'Integer identifying a service version.'
,
required
=>
'1'
,
},
'healthcheck_name'
=> {
data_type
=>
'string'
,
description
=>
'The name of the health check.'
,
required
=>
'1'
,
},
};
__PACKAGE__->method_documentation->{
'get_healthcheck'
} = {
summary
=>
'Get a health check'
,
params
=>
$params
,
returns
=>
'HealthcheckResponse'
,
};
}
sub
get_healthcheck {
my
(
$self
,
%args
) =
@_
;
unless
(
exists
$args
{
'service_id'
}) {
croak(
"Missing the required parameter 'service_id' when calling get_healthcheck"
);
}
unless
(
exists
$args
{
'version_id'
}) {
croak(
"Missing the required parameter 'version_id' when calling get_healthcheck"
);
}
unless
(
exists
$args
{
'healthcheck_name'
}) {
croak(
"Missing the required parameter 'healthcheck_name' when calling get_healthcheck"
);
}
my
$_resource_path
=
'/service/{service_id}/version/{version_id}/healthcheck/{healthcheck_name}'
;
my
$_method
=
'GET'
;
my
$query_params
= {};
my
$header_params
= {};
my
$form_params
= {};
my
$_header_accept
=
$self
->{api_client}->select_header_accept(
'application/json'
);
if
(
$_header_accept
) {
$header_params
->{
'Accept'
} =
$_header_accept
;
}
$header_params
->{
'Content-Type'
} =
$self
->{api_client}->select_header_content_type();
if
(
exists
$args
{
'service_id'
}) {
my
$_base_variable
=
"{"
.
"service_id"
.
"}"
;
my
$_base_value
=
$self
->{api_client}->to_path_value(
$args
{
'service_id'
});
$_resource_path
=~ s/
$_base_variable
/
$_base_value
/g;
}
if
(
exists
$args
{
'version_id'
}) {
my
$_base_variable
=
"{"
.
"version_id"
.
"}"
;
my
$_base_value
=
$self
->{api_client}->to_path_value(
$args
{
'version_id'
});
$_resource_path
=~ s/
$_base_variable
/
$_base_value
/g;
}
if
(
exists
$args
{
'healthcheck_name'
}) {
my
$_base_variable
=
"{"
.
"healthcheck_name"
.
"}"
;
my
$_base_value
=
$self
->{api_client}->to_path_value(
$args
{
'healthcheck_name'
});
$_resource_path
=~ s/
$_base_variable
/
$_base_value
/g;
}
my
$_body_data
;
my
$auth_settings
= [
qw(token )
];
my
$response
=
$self
->{api_client}->call_api(
$_resource_path
,
$_method
,
$query_params
,
$form_params
,
$header_params
,
$_body_data
,
$auth_settings
);
if
(!
$response
) {
return
;
}
my
$_response_object
=
$self
->{api_client}->deserialize(
'HealthcheckResponse'
,
$response
);
return
$_response_object
;
}
{
my
$params
= {
'service_id'
=> {
data_type
=>
'string'
,
description
=>
'Alphanumeric string identifying the service.'
,
required
=>
'1'
,
},
'version_id'
=> {
data_type
=>
'int'
,
description
=>
'Integer identifying a service version.'
,
required
=>
'1'
,
},
};
__PACKAGE__->method_documentation->{
'list_healthchecks'
} = {
summary
=>
'List health checks'
,
params
=>
$params
,
returns
=>
'ARRAY[HealthcheckResponse]'
,
};
}
sub
list_healthchecks {
my
(
$self
,
%args
) =
@_
;
unless
(
exists
$args
{
'service_id'
}) {
croak(
"Missing the required parameter 'service_id' when calling list_healthchecks"
);
}
unless
(
exists
$args
{
'version_id'
}) {
croak(
"Missing the required parameter 'version_id' when calling list_healthchecks"
);
}
my
$_resource_path
=
'/service/{service_id}/version/{version_id}/healthcheck'
;
my
$_method
=
'GET'
;
my
$query_params
= {};
my
$header_params
= {};
my
$form_params
= {};
my
$_header_accept
=
$self
->{api_client}->select_header_accept(
'application/json'
);
if
(
$_header_accept
) {
$header_params
->{
'Accept'
} =
$_header_accept
;
}
$header_params
->{
'Content-Type'
} =
$self
->{api_client}->select_header_content_type();
if
(
exists
$args
{
'service_id'
}) {
my
$_base_variable
=
"{"
.
"service_id"
.
"}"
;
my
$_base_value
=
$self
->{api_client}->to_path_value(
$args
{
'service_id'
});
$_resource_path
=~ s/
$_base_variable
/
$_base_value
/g;
}
if
(
exists
$args
{
'version_id'
}) {
my
$_base_variable
=
"{"
.
"version_id"
.
"}"
;
my
$_base_value
=
$self
->{api_client}->to_path_value(
$args
{
'version_id'
});
$_resource_path
=~ s/
$_base_variable
/
$_base_value
/g;
}
my
$_body_data
;
my
$auth_settings
= [
qw(token )
];
my
$response
=
$self
->{api_client}->call_api(
$_resource_path
,
$_method
,
$query_params
,
$form_params
,
$header_params
,
$_body_data
,
$auth_settings
);
if
(!
$response
) {
return
;
}
my
$_response_object
=
$self
->{api_client}->deserialize(
'ARRAY[HealthcheckResponse]'
,
$response
);
return
$_response_object
;
}
{
my
$params
= {
'service_id'
=> {
data_type
=>
'string'
,
description
=>
'Alphanumeric string identifying the service.'
,
required
=>
'1'
,
},
'version_id'
=> {
data_type
=>
'int'
,
description
=>
'Integer identifying a service version.'
,
required
=>
'1'
,
},
'healthcheck_name'
=> {
data_type
=>
'string'
,
description
=>
'The name of the health check.'
,
required
=>
'1'
,
},
'check_interval'
=> {
data_type
=>
'int'
,
description
=>
'How often to run the health check in milliseconds.'
,
required
=>
'0'
,
},
'comment'
=> {
data_type
=>
'string'
,
description
=>
'A freeform descriptive note.'
,
required
=>
'0'
,
},
'expected_response'
=> {
data_type
=>
'int'
,
description
=>
'The status code expected from the host.'
,
required
=>
'0'
,
},
'headers'
=> {
data_type
=>
'ARRAY[string]'
,
description
=>
'Array of custom headers that will be added to the health check probes.'
,
required
=>
'0'
,
},
'host'
=> {
data_type
=>
'string'
,
description
=>
'Which host to check.'
,
required
=>
'0'
,
},
'http_version'
=> {
data_type
=>
'string'
,
description
=>
'Whether to use version 1.0 or 1.1 HTTP.'
,
required
=>
'0'
,
},
'initial'
=> {
data_type
=>
'int'
,
description
=>
'When loading a config, the initial number of probes to be seen as OK.'
,
required
=>
'0'
,
},
'method'
=> {
data_type
=>
'string'
,
description
=>
'Which HTTP method to use.'
,
required
=>
'0'
,
},
'name'
=> {
data_type
=>
'string'
,
description
=>
'The name of the health check.'
,
required
=>
'0'
,
},
'path'
=> {
data_type
=>
'string'
,
description
=>
'The path to check.'
,
required
=>
'0'
,
},
'threshold'
=> {
data_type
=>
'int'
,
description
=>
'How many health checks must succeed to be considered healthy.'
,
required
=>
'0'
,
},
'timeout'
=> {
data_type
=>
'int'
,
description
=>
'Timeout in milliseconds.'
,
required
=>
'0'
,
},
'window'
=> {
data_type
=>
'int'
,
description
=>
'The number of most recent health check queries to keep for this health check.'
,
required
=>
'0'
,
},
};
__PACKAGE__->method_documentation->{
'update_healthcheck'
} = {
summary
=>
'Update a health check'
,
params
=>
$params
,
returns
=>
'HealthcheckResponse'
,
};
}
sub
update_healthcheck {
my
(
$self
,
%args
) =
@_
;
unless
(
exists
$args
{
'service_id'
}) {
croak(
"Missing the required parameter 'service_id' when calling update_healthcheck"
);
}
unless
(
exists
$args
{
'version_id'
}) {
croak(
"Missing the required parameter 'version_id' when calling update_healthcheck"
);
}
unless
(
exists
$args
{
'healthcheck_name'
}) {
croak(
"Missing the required parameter 'healthcheck_name' when calling update_healthcheck"
);
}
my
$_resource_path
=
'/service/{service_id}/version/{version_id}/healthcheck/{healthcheck_name}'
;
my
$_method
=
'PUT'
;
my
$query_params
= {};
my
$header_params
= {};
my
$form_params
= {};
my
$_header_accept
=
$self
->{api_client}->select_header_accept(
'application/json'
);
if
(
$_header_accept
) {
$header_params
->{
'Accept'
} =
$_header_accept
;
}
$header_params
->{
'Content-Type'
} =
$self
->{api_client}->select_header_content_type(
'application/x-www-form-urlencoded'
);
if
(
exists
$args
{
'service_id'
}) {
my
$_base_variable
=
"{"
.
"service_id"
.
"}"
;
my
$_base_value
=
$self
->{api_client}->to_path_value(
$args
{
'service_id'
});
$_resource_path
=~ s/
$_base_variable
/
$_base_value
/g;
}
if
(
exists
$args
{
'version_id'
}) {
my
$_base_variable
=
"{"
.
"version_id"
.
"}"
;
my
$_base_value
=
$self
->{api_client}->to_path_value(
$args
{
'version_id'
});
$_resource_path
=~ s/
$_base_variable
/
$_base_value
/g;
}
if
(
exists
$args
{
'healthcheck_name'
}) {
my
$_base_variable
=
"{"
.
"healthcheck_name"
.
"}"
;
my
$_base_value
=
$self
->{api_client}->to_path_value(
$args
{
'healthcheck_name'
});
$_resource_path
=~ s/
$_base_variable
/
$_base_value
/g;
}
if
(
exists
$args
{
'check_interval'
} ) {
$form_params
->{
'check_interval'
} =
$self
->{api_client}->to_form_value(
$args
{
'check_interval'
});
}
if
(
exists
$args
{
'comment'
} ) {
$form_params
->{
'comment'
} =
$self
->{api_client}->to_form_value(
$args
{
'comment'
});
}
if
(
exists
$args
{
'expected_response'
} ) {
$form_params
->{
'expected_response'
} =
$self
->{api_client}->to_form_value(
$args
{
'expected_response'
});
}
if
(
exists
$args
{
'headers'
} ) {
$form_params
->{
'headers'
} =
$self
->{api_client}->to_form_value(
$args
{
'headers'
});
}
if
(
exists
$args
{
'host'
} ) {
$form_params
->{
'host'
} =
$self
->{api_client}->to_form_value(
$args
{
'host'
});
}
if
(
exists
$args
{
'http_version'
} ) {
$form_params
->{
'http_version'
} =
$self
->{api_client}->to_form_value(
$args
{
'http_version'
});
}
if
(
exists
$args
{
'initial'
} ) {
$form_params
->{
'initial'
} =
$self
->{api_client}->to_form_value(
$args
{
'initial'
});
}
if
(
exists
$args
{
'method'
} ) {
$form_params
->{
'method'
} =
$self
->{api_client}->to_form_value(
$args
{
'method'
});
}
if
(
exists
$args
{
'name'
} ) {
$form_params
->{
'name'
} =
$self
->{api_client}->to_form_value(
$args
{
'name'
});
}
if
(
exists
$args
{
'path'
} ) {
$form_params
->{
'path'
} =
$self
->{api_client}->to_form_value(
$args
{
'path'
});
}
if
(
exists
$args
{
'threshold'
} ) {
$form_params
->{
'threshold'
} =
$self
->{api_client}->to_form_value(
$args
{
'threshold'
});
}
if
(
exists
$args
{
'timeout'
} ) {
$form_params
->{
'timeout'
} =
$self
->{api_client}->to_form_value(
$args
{
'timeout'
});
}
if
(
exists
$args
{
'window'
} ) {
$form_params
->{
'window'
} =
$self
->{api_client}->to_form_value(
$args
{
'window'
});
}
my
$_body_data
;
my
$auth_settings
= [
qw(token )
];
my
$response
=
$self
->{api_client}->call_api(
$_resource_path
,
$_method
,
$query_params
,
$form_params
,
$header_params
,
$_body_data
,
$auth_settings
);
if
(!
$response
) {
return
;
}
my
$_response_object
=
$self
->{api_client}->deserialize(
'HealthcheckResponse'
,
$response
);
return
$_response_object
;
}
1;