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'
,
},
'comment'
=> {
data_type
=>
'string'
,
description
=>
'A freeform descriptive note.'
,
required
=>
'0'
,
},
'name'
=> {
data_type
=>
'string'
,
description
=>
'Name of the condition. Required.'
,
required
=>
'0'
,
},
'priority'
=> {
data_type
=>
'string'
,
description
=>
'A numeric string. Priority determines execution order. Lower numbers execute first.'
,
required
=>
'0'
,
},
'statement'
=> {
data_type
=>
'string'
,
description
=>
'A conditional expression in VCL used to determine if the condition is met.'
,
required
=>
'0'
,
},
'service_id'
=> {
data_type
=>
'string'
,
description
=>
''
,
required
=>
'0'
,
},
'version'
=> {
data_type
=>
'string'
,
description
=>
'A numeric string that represents the service version.'
,
required
=>
'0'
,
},
'type'
=> {
data_type
=>
'string'
,
description
=>
'Type of the condition. Required.'
,
required
=>
'0'
,
},
};
__PACKAGE__->method_documentation->{
'create_condition'
} = {
summary
=>
'Create a condition'
,
params
=>
$params
,
returns
=>
'ConditionResponse'
,
};
}
sub
create_condition {
my
(
$self
,
%args
) =
@_
;
unless
(
exists
$args
{
'service_id'
}) {
croak(
"Missing the required parameter 'service_id' when calling create_condition"
);
}
unless
(
exists
$args
{
'version_id'
}) {
croak(
"Missing the required parameter 'version_id' when calling create_condition"
);
}
my
$_resource_path
=
'/service/{service_id}/version/{version_id}/condition'
;
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
{
'comment'
} ) {
$form_params
->{
'comment'
} =
$self
->{api_client}->to_form_value(
$args
{
'comment'
});
}
if
(
exists
$args
{
'name'
} ) {
$form_params
->{
'name'
} =
$self
->{api_client}->to_form_value(
$args
{
'name'
});
}
if
(
exists
$args
{
'priority'
} ) {
$form_params
->{
'priority'
} =
$self
->{api_client}->to_form_value(
$args
{
'priority'
});
}
if
(
exists
$args
{
'statement'
} ) {
$form_params
->{
'statement'
} =
$self
->{api_client}->to_form_value(
$args
{
'statement'
});
}
if
(
exists
$args
{
'service_id'
} ) {
$form_params
->{
'service_id'
} =
$self
->{api_client}->to_form_value(
$args
{
'service_id'
});
}
if
(
exists
$args
{
'version'
} ) {
$form_params
->{
'version'
} =
$self
->{api_client}->to_form_value(
$args
{
'version'
});
}
if
(
exists
$args
{
'type'
} ) {
$form_params
->{
'type'
} =
$self
->{api_client}->to_form_value(
$args
{
'type'
});
}
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(
'ConditionResponse'
,
$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'
,
},
'condition_name'
=> {
data_type
=>
'string'
,
description
=>
'Name of the condition. Required.'
,
required
=>
'1'
,
},
};
__PACKAGE__->method_documentation->{
'delete_condition'
} = {
summary
=>
'Delete a condition'
,
params
=>
$params
,
returns
=>
'InlineResponse200'
,
};
}
sub
delete_condition {
my
(
$self
,
%args
) =
@_
;
unless
(
exists
$args
{
'service_id'
}) {
croak(
"Missing the required parameter 'service_id' when calling delete_condition"
);
}
unless
(
exists
$args
{
'version_id'
}) {
croak(
"Missing the required parameter 'version_id' when calling delete_condition"
);
}
unless
(
exists
$args
{
'condition_name'
}) {
croak(
"Missing the required parameter 'condition_name' when calling delete_condition"
);
}
my
$_resource_path
=
'/service/{service_id}/version/{version_id}/condition/{condition_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
{
'condition_name'
}) {
my
$_base_variable
=
"{"
.
"condition_name"
.
"}"
;
my
$_base_value
=
$self
->{api_client}->to_path_value(
$args
{
'condition_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'
,
},
'condition_name'
=> {
data_type
=>
'string'
,
description
=>
'Name of the condition. Required.'
,
required
=>
'1'
,
},
};
__PACKAGE__->method_documentation->{
'get_condition'
} = {
summary
=>
'Describe a condition'
,
params
=>
$params
,
returns
=>
'ConditionResponse'
,
};
}
sub
get_condition {
my
(
$self
,
%args
) =
@_
;
unless
(
exists
$args
{
'service_id'
}) {
croak(
"Missing the required parameter 'service_id' when calling get_condition"
);
}
unless
(
exists
$args
{
'version_id'
}) {
croak(
"Missing the required parameter 'version_id' when calling get_condition"
);
}
unless
(
exists
$args
{
'condition_name'
}) {
croak(
"Missing the required parameter 'condition_name' when calling get_condition"
);
}
my
$_resource_path
=
'/service/{service_id}/version/{version_id}/condition/{condition_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
{
'condition_name'
}) {
my
$_base_variable
=
"{"
.
"condition_name"
.
"}"
;
my
$_base_value
=
$self
->{api_client}->to_path_value(
$args
{
'condition_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(
'ConditionResponse'
,
$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_conditions'
} = {
summary
=>
'List conditions'
,
params
=>
$params
,
returns
=>
'ARRAY[ConditionResponse]'
,
};
}
sub
list_conditions {
my
(
$self
,
%args
) =
@_
;
unless
(
exists
$args
{
'service_id'
}) {
croak(
"Missing the required parameter 'service_id' when calling list_conditions"
);
}
unless
(
exists
$args
{
'version_id'
}) {
croak(
"Missing the required parameter 'version_id' when calling list_conditions"
);
}
my
$_resource_path
=
'/service/{service_id}/version/{version_id}/condition'
;
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[ConditionResponse]'
,
$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'
,
},
'condition_name'
=> {
data_type
=>
'string'
,
description
=>
'Name of the condition. Required.'
,
required
=>
'1'
,
},
'comment'
=> {
data_type
=>
'string'
,
description
=>
'A freeform descriptive note.'
,
required
=>
'0'
,
},
'name'
=> {
data_type
=>
'string'
,
description
=>
'Name of the condition. Required.'
,
required
=>
'0'
,
},
'priority'
=> {
data_type
=>
'string'
,
description
=>
'A numeric string. Priority determines execution order. Lower numbers execute first.'
,
required
=>
'0'
,
},
'statement'
=> {
data_type
=>
'string'
,
description
=>
'A conditional expression in VCL used to determine if the condition is met.'
,
required
=>
'0'
,
},
'service_id'
=> {
data_type
=>
'string'
,
description
=>
''
,
required
=>
'0'
,
},
'version'
=> {
data_type
=>
'string'
,
description
=>
'A numeric string that represents the service version.'
,
required
=>
'0'
,
},
'type'
=> {
data_type
=>
'string'
,
description
=>
'Type of the condition. Required.'
,
required
=>
'0'
,
},
};
__PACKAGE__->method_documentation->{
'update_condition'
} = {
summary
=>
'Update a condition'
,
params
=>
$params
,
returns
=>
'ConditionResponse'
,
};
}
sub
update_condition {
my
(
$self
,
%args
) =
@_
;
unless
(
exists
$args
{
'service_id'
}) {
croak(
"Missing the required parameter 'service_id' when calling update_condition"
);
}
unless
(
exists
$args
{
'version_id'
}) {
croak(
"Missing the required parameter 'version_id' when calling update_condition"
);
}
unless
(
exists
$args
{
'condition_name'
}) {
croak(
"Missing the required parameter 'condition_name' when calling update_condition"
);
}
my
$_resource_path
=
'/service/{service_id}/version/{version_id}/condition/{condition_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
{
'condition_name'
}) {
my
$_base_variable
=
"{"
.
"condition_name"
.
"}"
;
my
$_base_value
=
$self
->{api_client}->to_path_value(
$args
{
'condition_name'
});
$_resource_path
=~ s/
$_base_variable
/
$_base_value
/g;
}
if
(
exists
$args
{
'comment'
} ) {
$form_params
->{
'comment'
} =
$self
->{api_client}->to_form_value(
$args
{
'comment'
});
}
if
(
exists
$args
{
'name'
} ) {
$form_params
->{
'name'
} =
$self
->{api_client}->to_form_value(
$args
{
'name'
});
}
if
(
exists
$args
{
'priority'
} ) {
$form_params
->{
'priority'
} =
$self
->{api_client}->to_form_value(
$args
{
'priority'
});
}
if
(
exists
$args
{
'statement'
} ) {
$form_params
->{
'statement'
} =
$self
->{api_client}->to_form_value(
$args
{
'statement'
});
}
if
(
exists
$args
{
'service_id'
} ) {
$form_params
->{
'service_id'
} =
$self
->{api_client}->to_form_value(
$args
{
'service_id'
});
}
if
(
exists
$args
{
'version'
} ) {
$form_params
->{
'version'
} =
$self
->{api_client}->to_form_value(
$args
{
'version'
});
}
if
(
exists
$args
{
'type'
} ) {
$form_params
->{
'type'
} =
$self
->{api_client}->to_form_value(
$args
{
'type'
});
}
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(
'ConditionResponse'
,
$response
);
return
$_response_object
;
}
1;