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'
,
},
'resource_id'
=> {
data_type
=>
'string'
,
description
=>
'The ID of the underlying linked resource.'
,
required
=>
'0'
,
},
'name'
=> {
data_type
=>
'string'
,
description
=>
'The name of the resource link.'
,
required
=>
'0'
,
},
};
__PACKAGE__->method_documentation->{
'create_resource'
} = {
summary
=>
'Create a resource link'
,
params
=>
$params
,
returns
=>
'ResourceResponse'
,
};
}
sub
create_resource {
my
(
$self
,
%args
) =
@_
;
unless
(
exists
$args
{
'service_id'
}) {
croak(
"Missing the required parameter 'service_id' when calling create_resource"
);
}
unless
(
exists
$args
{
'version_id'
}) {
croak(
"Missing the required parameter 'version_id' when calling create_resource"
);
}
my
$_resource_path
=
'/service/{service_id}/version/{version_id}/resource'
;
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
{
'resource_id'
} ) {
$form_params
->{
'resource_id'
} =
$self
->{api_client}->to_form_value(
$args
{
'resource_id'
});
}
if
(
exists
$args
{
'name'
} ) {
$form_params
->{
'name'
} =
$self
->{api_client}->to_form_value(
$args
{
'name'
});
}
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(
'ResourceResponse'
,
$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'
,
},
'id'
=> {
data_type
=>
'string'
,
description
=>
'An alphanumeric string identifying the resource link.'
,
required
=>
'1'
,
},
};
__PACKAGE__->method_documentation->{
'delete_resource'
} = {
summary
=>
'Delete a resource link'
,
params
=>
$params
,
returns
=>
'InlineResponse200'
,
};
}
sub
delete_resource {
my
(
$self
,
%args
) =
@_
;
unless
(
exists
$args
{
'service_id'
}) {
croak(
"Missing the required parameter 'service_id' when calling delete_resource"
);
}
unless
(
exists
$args
{
'version_id'
}) {
croak(
"Missing the required parameter 'version_id' when calling delete_resource"
);
}
unless
(
exists
$args
{
'id'
}) {
croak(
"Missing the required parameter 'id' when calling delete_resource"
);
}
my
$_resource_path
=
'/service/{service_id}/version/{version_id}/resource/{id}'
;
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
{
'id'
}) {
my
$_base_variable
=
"{"
.
"id"
.
"}"
;
my
$_base_value
=
$self
->{api_client}->to_path_value(
$args
{
'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(
'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'
,
},
'id'
=> {
data_type
=>
'string'
,
description
=>
'An alphanumeric string identifying the resource link.'
,
required
=>
'1'
,
},
};
__PACKAGE__->method_documentation->{
'get_resource'
} = {
summary
=>
'Display a resource link'
,
params
=>
$params
,
returns
=>
'ResourceResponse'
,
};
}
sub
get_resource {
my
(
$self
,
%args
) =
@_
;
unless
(
exists
$args
{
'service_id'
}) {
croak(
"Missing the required parameter 'service_id' when calling get_resource"
);
}
unless
(
exists
$args
{
'version_id'
}) {
croak(
"Missing the required parameter 'version_id' when calling get_resource"
);
}
unless
(
exists
$args
{
'id'
}) {
croak(
"Missing the required parameter 'id' when calling get_resource"
);
}
my
$_resource_path
=
'/service/{service_id}/version/{version_id}/resource/{id}'
;
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
{
'id'
}) {
my
$_base_variable
=
"{"
.
"id"
.
"}"
;
my
$_base_value
=
$self
->{api_client}->to_path_value(
$args
{
'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(
'ResourceResponse'
,
$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_resources'
} = {
summary
=>
'List resource links'
,
params
=>
$params
,
returns
=>
'ARRAY[ResourceResponse]'
,
};
}
sub
list_resources {
my
(
$self
,
%args
) =
@_
;
unless
(
exists
$args
{
'service_id'
}) {
croak(
"Missing the required parameter 'service_id' when calling list_resources"
);
}
unless
(
exists
$args
{
'version_id'
}) {
croak(
"Missing the required parameter 'version_id' when calling list_resources"
);
}
my
$_resource_path
=
'/service/{service_id}/version/{version_id}/resource'
;
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[ResourceResponse]'
,
$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'
,
},
'id'
=> {
data_type
=>
'string'
,
description
=>
'An alphanumeric string identifying the resource link.'
,
required
=>
'1'
,
},
'resource_id'
=> {
data_type
=>
'string'
,
description
=>
'The ID of the underlying linked resource.'
,
required
=>
'0'
,
},
'name'
=> {
data_type
=>
'string'
,
description
=>
'The name of the resource link.'
,
required
=>
'0'
,
},
};
__PACKAGE__->method_documentation->{
'update_resource'
} = {
summary
=>
'Update a resource link'
,
params
=>
$params
,
returns
=>
'ResourceResponse'
,
};
}
sub
update_resource {
my
(
$self
,
%args
) =
@_
;
unless
(
exists
$args
{
'service_id'
}) {
croak(
"Missing the required parameter 'service_id' when calling update_resource"
);
}
unless
(
exists
$args
{
'version_id'
}) {
croak(
"Missing the required parameter 'version_id' when calling update_resource"
);
}
unless
(
exists
$args
{
'id'
}) {
croak(
"Missing the required parameter 'id' when calling update_resource"
);
}
my
$_resource_path
=
'/service/{service_id}/version/{version_id}/resource/{id}'
;
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
{
'id'
}) {
my
$_base_variable
=
"{"
.
"id"
.
"}"
;
my
$_base_value
=
$self
->{api_client}->to_path_value(
$args
{
'id'
});
$_resource_path
=~ s/
$_base_variable
/
$_base_value
/g;
}
if
(
exists
$args
{
'resource_id'
} ) {
$form_params
->{
'resource_id'
} =
$self
->{api_client}->to_form_value(
$args
{
'resource_id'
});
}
if
(
exists
$args
{
'name'
} ) {
$form_params
->{
'name'
} =
$self
->{api_client}->to_form_value(
$args
{
'name'
});
}
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(
'ResourceResponse'
,
$response
);
return
$_response_object
;
}
1;