Group
Extension

WebService-Fastly/lib/WebService/Fastly/VclApi.pm

=begin comment

Fastly API

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/) 

The version of the API Spec document: 1.0.0
Contact: oss@fastly.com

=end comment

=cut

#
# NOTE: This class is auto generated.
# Do not edit the class manually.
#
package WebService::Fastly::VclApi;

require 5.6.0;
use strict;
use warnings;
use utf8;
use Exporter;
use Carp qw( croak );
use Log::Any qw($log);

use WebService::Fastly::ApiClient;

use base "Class::Data::Inheritable";

__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;

}


#
# create_custom_vcl
#
# Create a custom VCL file
#
# @param string $service_id Alphanumeric string identifying the service. (required)
# @param int $version_id Integer identifying a service version. (required)
# @param string $content The VCL code to be included. (optional)
# @param boolean $main Set to `true` when this is the main VCL, otherwise `false`. (optional)
# @param string $name The name of this VCL. (optional)
{
    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',
    },
    'content' => {
        data_type => 'string',
        description => 'The VCL code to be included.',
        required => '0',
    },
    'main' => {
        data_type => 'boolean',
        description => 'Set to `true` when this is the main VCL, otherwise `false`.',
        required => '0',
    },
    'name' => {
        data_type => 'string',
        description => 'The name of this VCL.',
        required => '0',
    },
    };
    __PACKAGE__->method_documentation->{ 'create_custom_vcl' } = {
        summary => 'Create a custom VCL file',
        params => $params,
        returns => 'VclResponse',
        };
}
# @return VclResponse
#
sub create_custom_vcl {
    my ($self, %args) = @_;

    # verify the required parameter 'service_id' is set
    unless (exists $args{'service_id'}) {
      croak("Missing the required parameter 'service_id' when calling create_custom_vcl");
    }

    # verify the required parameter 'version_id' is set
    unless (exists $args{'version_id'}) {
      croak("Missing the required parameter 'version_id' when calling create_custom_vcl");
    }

    # parse inputs
    my $_resource_path = '/service/{service_id}/version/{version_id}/vcl';

    my $_method = 'POST';
    my $query_params = {};
    my $header_params = {};
    my $form_params = {};

    # 'Accept' and 'Content-Type' header
    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');

    # path params
    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;
    }

    # path params
    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;
    }

    # form params
    if ( exists $args{'content'} ) {
                $form_params->{'content'} = $self->{api_client}->to_form_value($args{'content'});
    }

    # form params
    if ( exists $args{'main'} ) {
                $form_params->{'main'} = $self->{api_client}->to_form_value($args{'main'});
    }

    # form params
    if ( exists $args{'name'} ) {
                $form_params->{'name'} = $self->{api_client}->to_form_value($args{'name'});
    }

    my $_body_data;
    # authentication setting, if any
    my $auth_settings = [qw(token )];

    # make the API Call
    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('VclResponse', $response);
    return $_response_object;
}

#
# delete_custom_vcl
#
# Delete a custom VCL file
#
# @param string $service_id Alphanumeric string identifying the service. (required)
# @param int $version_id Integer identifying a service version. (required)
# @param string $vcl_name The name of this VCL. (required)
{
    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',
    },
    'vcl_name' => {
        data_type => 'string',
        description => 'The name of this VCL.',
        required => '1',
    },
    };
    __PACKAGE__->method_documentation->{ 'delete_custom_vcl' } = {
        summary => 'Delete a custom VCL file',
        params => $params,
        returns => 'InlineResponse200',
        };
}
# @return InlineResponse200
#
sub delete_custom_vcl {
    my ($self, %args) = @_;

    # verify the required parameter 'service_id' is set
    unless (exists $args{'service_id'}) {
      croak("Missing the required parameter 'service_id' when calling delete_custom_vcl");
    }

    # verify the required parameter 'version_id' is set
    unless (exists $args{'version_id'}) {
      croak("Missing the required parameter 'version_id' when calling delete_custom_vcl");
    }

    # verify the required parameter 'vcl_name' is set
    unless (exists $args{'vcl_name'}) {
      croak("Missing the required parameter 'vcl_name' when calling delete_custom_vcl");
    }

    # parse inputs
    my $_resource_path = '/service/{service_id}/version/{version_id}/vcl/{vcl_name}';

    my $_method = 'DELETE';
    my $query_params = {};
    my $header_params = {};
    my $form_params = {};

    # 'Accept' and 'Content-Type' header
    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();

    # path params
    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;
    }

    # path params
    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;
    }

    # path params
    if ( exists $args{'vcl_name'}) {
        my $_base_variable = "{" . "vcl_name" . "}";
        my $_base_value = $self->{api_client}->to_path_value($args{'vcl_name'});
        $_resource_path =~ s/$_base_variable/$_base_value/g;
    }

    my $_body_data;
    # authentication setting, if any
    my $auth_settings = [qw(token )];

    # make the API Call
    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;
}

#
# get_custom_vcl
#
# Get a custom VCL file
#
# @param string $service_id Alphanumeric string identifying the service. (required)
# @param int $version_id Integer identifying a service version. (required)
# @param string $vcl_name The name of this VCL. (required)
# @param string $no_content Omit VCL content. (optional, default to '0')
{
    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',
    },
    'vcl_name' => {
        data_type => 'string',
        description => 'The name of this VCL.',
        required => '1',
    },
    'no_content' => {
        data_type => 'string',
        description => 'Omit VCL content.',
        required => '0',
    },
    };
    __PACKAGE__->method_documentation->{ 'get_custom_vcl' } = {
        summary => 'Get a custom VCL file',
        params => $params,
        returns => 'VclResponse',
        };
}
# @return VclResponse
#
sub get_custom_vcl {
    my ($self, %args) = @_;

    # verify the required parameter 'service_id' is set
    unless (exists $args{'service_id'}) {
      croak("Missing the required parameter 'service_id' when calling get_custom_vcl");
    }

    # verify the required parameter 'version_id' is set
    unless (exists $args{'version_id'}) {
      croak("Missing the required parameter 'version_id' when calling get_custom_vcl");
    }

    # verify the required parameter 'vcl_name' is set
    unless (exists $args{'vcl_name'}) {
      croak("Missing the required parameter 'vcl_name' when calling get_custom_vcl");
    }

    # parse inputs
    my $_resource_path = '/service/{service_id}/version/{version_id}/vcl/{vcl_name}';

    my $_method = 'GET';
    my $query_params = {};
    my $header_params = {};
    my $form_params = {};

    # 'Accept' and 'Content-Type' header
    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();

    # query params
    if ( exists $args{'no_content'}) {
        $query_params->{'no_content'} = $self->{api_client}->to_query_value($args{'no_content'});
    }

    # path params
    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;
    }

    # path params
    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;
    }

    # path params
    if ( exists $args{'vcl_name'}) {
        my $_base_variable = "{" . "vcl_name" . "}";
        my $_base_value = $self->{api_client}->to_path_value($args{'vcl_name'});
        $_resource_path =~ s/$_base_variable/$_base_value/g;
    }

    my $_body_data;
    # authentication setting, if any
    my $auth_settings = [qw(token )];

    # make the API Call
    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('VclResponse', $response);
    return $_response_object;
}

#
# get_custom_vcl_boilerplate
#
# Get boilerplate VCL
#
# @param string $service_id Alphanumeric string identifying the service. (required)
# @param int $version_id Integer identifying a service version. (required)
{
    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->{ 'get_custom_vcl_boilerplate' } = {
        summary => 'Get boilerplate VCL',
        params => $params,
        returns => 'string',
        };
}
# @return string
#
sub get_custom_vcl_boilerplate {
    my ($self, %args) = @_;

    # verify the required parameter 'service_id' is set
    unless (exists $args{'service_id'}) {
      croak("Missing the required parameter 'service_id' when calling get_custom_vcl_boilerplate");
    }

    # verify the required parameter 'version_id' is set
    unless (exists $args{'version_id'}) {
      croak("Missing the required parameter 'version_id' when calling get_custom_vcl_boilerplate");
    }

    # parse inputs
    my $_resource_path = '/service/{service_id}/version/{version_id}/boilerplate';

    my $_method = 'GET';
    my $query_params = {};
    my $header_params = {};
    my $form_params = {};

    # 'Accept' and 'Content-Type' header
    my $_header_accept = $self->{api_client}->select_header_accept('text/plain');
    if ($_header_accept) {
        $header_params->{'Accept'} = $_header_accept;
    }
    $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type();

    # path params
    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;
    }

    # path params
    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;
    # authentication setting, if any
    my $auth_settings = [qw(token )];

    # make the API Call
    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('string', $response);
    return $_response_object;
}

#
# get_custom_vcl_generated
#
# Get the generated VCL for a service
#
# @param string $service_id Alphanumeric string identifying the service. (required)
# @param int $version_id Integer identifying a service version. (required)
{
    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->{ 'get_custom_vcl_generated' } = {
        summary => 'Get the generated VCL for a service',
        params => $params,
        returns => 'VclResponse',
        };
}
# @return VclResponse
#
sub get_custom_vcl_generated {
    my ($self, %args) = @_;

    # verify the required parameter 'service_id' is set
    unless (exists $args{'service_id'}) {
      croak("Missing the required parameter 'service_id' when calling get_custom_vcl_generated");
    }

    # verify the required parameter 'version_id' is set
    unless (exists $args{'version_id'}) {
      croak("Missing the required parameter 'version_id' when calling get_custom_vcl_generated");
    }

    # parse inputs
    my $_resource_path = '/service/{service_id}/version/{version_id}/generated_vcl';

    my $_method = 'GET';
    my $query_params = {};
    my $header_params = {};
    my $form_params = {};

    # 'Accept' and 'Content-Type' header
    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();

    # path params
    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;
    }

    # path params
    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;
    # authentication setting, if any
    my $auth_settings = [qw(token )];

    # make the API Call
    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('VclResponse', $response);
    return $_response_object;
}

#
# get_custom_vcl_generated_highlighted
#
# Get the generated VCL with syntax highlighting
#
# @param string $service_id Alphanumeric string identifying the service. (required)
# @param int $version_id Integer identifying a service version. (required)
{
    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->{ 'get_custom_vcl_generated_highlighted' } = {
        summary => 'Get the generated VCL with syntax highlighting',
        params => $params,
        returns => 'VclSyntaxHighlightingResponse',
        };
}
# @return VclSyntaxHighlightingResponse
#
sub get_custom_vcl_generated_highlighted {
    my ($self, %args) = @_;

    # verify the required parameter 'service_id' is set
    unless (exists $args{'service_id'}) {
      croak("Missing the required parameter 'service_id' when calling get_custom_vcl_generated_highlighted");
    }

    # verify the required parameter 'version_id' is set
    unless (exists $args{'version_id'}) {
      croak("Missing the required parameter 'version_id' when calling get_custom_vcl_generated_highlighted");
    }

    # parse inputs
    my $_resource_path = '/service/{service_id}/version/{version_id}/generated_vcl/content';

    my $_method = 'GET';
    my $query_params = {};
    my $header_params = {};
    my $form_params = {};

    # 'Accept' and 'Content-Type' header
    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();

    # path params
    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;
    }

    # path params
    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;
    # authentication setting, if any
    my $auth_settings = [qw(token )];

    # make the API Call
    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('VclSyntaxHighlightingResponse', $response);
    return $_response_object;
}

#
# get_custom_vcl_highlighted
#
# Get a custom VCL file with syntax highlighting
#
# @param string $service_id Alphanumeric string identifying the service. (required)
# @param int $version_id Integer identifying a service version. (required)
# @param string $vcl_name The name of this VCL. (required)
{
    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',
    },
    'vcl_name' => {
        data_type => 'string',
        description => 'The name of this VCL.',
        required => '1',
    },
    };
    __PACKAGE__->method_documentation->{ 'get_custom_vcl_highlighted' } = {
        summary => 'Get a custom VCL file with syntax highlighting',
        params => $params,
        returns => 'VclSyntaxHighlightingResponse',
        };
}
# @return VclSyntaxHighlightingResponse
#
sub get_custom_vcl_highlighted {
    my ($self, %args) = @_;

    # verify the required parameter 'service_id' is set
    unless (exists $args{'service_id'}) {
      croak("Missing the required parameter 'service_id' when calling get_custom_vcl_highlighted");
    }

    # verify the required parameter 'version_id' is set
    unless (exists $args{'version_id'}) {
      croak("Missing the required parameter 'version_id' when calling get_custom_vcl_highlighted");
    }

    # verify the required parameter 'vcl_name' is set
    unless (exists $args{'vcl_name'}) {
      croak("Missing the required parameter 'vcl_name' when calling get_custom_vcl_highlighted");
    }

    # parse inputs
    my $_resource_path = '/service/{service_id}/version/{version_id}/vcl/{vcl_name}/content';

    my $_method = 'GET';
    my $query_params = {};
    my $header_params = {};
    my $form_params = {};

    # 'Accept' and 'Content-Type' header
    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();

    # path params
    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;
    }

    # path params
    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;
    }

    # path params
    if ( exists $args{'vcl_name'}) {
        my $_base_variable = "{" . "vcl_name" . "}";
        my $_base_value = $self->{api_client}->to_path_value($args{'vcl_name'});
        $_resource_path =~ s/$_base_variable/$_base_value/g;
    }

    my $_body_data;
    # authentication setting, if any
    my $auth_settings = [qw(token )];

    # make the API Call
    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('VclSyntaxHighlightingResponse', $response);
    return $_response_object;
}

#
# get_custom_vcl_raw
#
# Download a custom VCL file
#
# @param string $service_id Alphanumeric string identifying the service. (required)
# @param int $version_id Integer identifying a service version. (required)
# @param string $vcl_name The name of this VCL. (required)
{
    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',
    },
    'vcl_name' => {
        data_type => 'string',
        description => 'The name of this VCL.',
        required => '1',
    },
    };
    __PACKAGE__->method_documentation->{ 'get_custom_vcl_raw' } = {
        summary => 'Download a custom VCL file',
        params => $params,
        returns => 'string',
        };
}
# @return string
#
sub get_custom_vcl_raw {
    my ($self, %args) = @_;

    # verify the required parameter 'service_id' is set
    unless (exists $args{'service_id'}) {
      croak("Missing the required parameter 'service_id' when calling get_custom_vcl_raw");
    }

    # verify the required parameter 'version_id' is set
    unless (exists $args{'version_id'}) {
      croak("Missing the required parameter 'version_id' when calling get_custom_vcl_raw");
    }

    # verify the required parameter 'vcl_name' is set
    unless (exists $args{'vcl_name'}) {
      croak("Missing the required parameter 'vcl_name' when calling get_custom_vcl_raw");
    }

    # parse inputs
    my $_resource_path = '/service/{service_id}/version/{version_id}/vcl/{vcl_name}/download';

    my $_method = 'GET';
    my $query_params = {};
    my $header_params = {};
    my $form_params = {};

    # 'Accept' and 'Content-Type' header
    my $_header_accept = $self->{api_client}->select_header_accept('text/plain');
    if ($_header_accept) {
        $header_params->{'Accept'} = $_header_accept;
    }
    $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type();

    # path params
    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;
    }

    # path params
    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;
    }

    # path params
    if ( exists $args{'vcl_name'}) {
        my $_base_variable = "{" . "vcl_name" . "}";
        my $_base_value = $self->{api_client}->to_path_value($args{'vcl_name'});
        $_resource_path =~ s/$_base_variable/$_base_value/g;
    }

    my $_body_data;
    # authentication setting, if any
    my $auth_settings = [qw(token )];

    # make the API Call
    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('string', $response);
    return $_response_object;
}

#
# lint_vcl_default
#
# Lint (validate) VCL using a default set of flags.
#
# @param InlineObject1 $inline_object1  (required)
{
    my $params = {
    'inline_object1' => {
        data_type => 'InlineObject1',
        description => '',
        required => '1',
    },
    };
    __PACKAGE__->method_documentation->{ 'lint_vcl_default' } = {
        summary => 'Lint (validate) VCL using a default set of flags.',
        params => $params,
        returns => 'ValidatorResult',
        };
}
# @return ValidatorResult
#
sub lint_vcl_default {
    my ($self, %args) = @_;

    # verify the required parameter 'inline_object1' is set
    unless (exists $args{'inline_object1'}) {
      croak("Missing the required parameter 'inline_object1' when calling lint_vcl_default");
    }

    # parse inputs
    my $_resource_path = '/vcl_lint';

    my $_method = 'POST';
    my $query_params = {};
    my $header_params = {};
    my $form_params = {};

    # 'Accept' and 'Content-Type' header
    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/json');

    my $_body_data;
    # body params
    if ( exists $args{'inline_object1'}) {
        $_body_data = $args{'inline_object1'};
    }

    # authentication setting, if any
    my $auth_settings = [qw(token )];

    # make the API Call
    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('ValidatorResult', $response);
    return $_response_object;
}

#
# lint_vcl_for_service
#
# Lint (validate) VCL using flags set for the service.
#
# @param string $service_id Alphanumeric string identifying the service. (required)
# @param InlineObject $inline_object  (required)
{
    my $params = {
    'service_id' => {
        data_type => 'string',
        description => 'Alphanumeric string identifying the service.',
        required => '1',
    },
    'inline_object' => {
        data_type => 'InlineObject',
        description => '',
        required => '1',
    },
    };
    __PACKAGE__->method_documentation->{ 'lint_vcl_for_service' } = {
        summary => 'Lint (validate) VCL using flags set for the service.',
        params => $params,
        returns => 'ValidatorResult',
        };
}
# @return ValidatorResult
#
sub lint_vcl_for_service {
    my ($self, %args) = @_;

    # verify the required parameter 'service_id' is set
    unless (exists $args{'service_id'}) {
      croak("Missing the required parameter 'service_id' when calling lint_vcl_for_service");
    }

    # verify the required parameter 'inline_object' is set
    unless (exists $args{'inline_object'}) {
      croak("Missing the required parameter 'inline_object' when calling lint_vcl_for_service");
    }

    # parse inputs
    my $_resource_path = '/service/{service_id}/lint';

    my $_method = 'POST';
    my $query_params = {};
    my $header_params = {};
    my $form_params = {};

    # 'Accept' and 'Content-Type' header
    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/json');

    # path params
    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;
    }

    my $_body_data;
    # body params
    if ( exists $args{'inline_object'}) {
        $_body_data = $args{'inline_object'};
    }

    # authentication setting, if any
    my $auth_settings = [qw(token )];

    # make the API Call
    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('ValidatorResult', $response);
    return $_response_object;
}

#
# list_custom_vcl
#
# List custom VCL files
#
# @param string $service_id Alphanumeric string identifying the service. (required)
# @param int $version_id Integer identifying a service version. (required)
{
    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_custom_vcl' } = {
        summary => 'List custom VCL files',
        params => $params,
        returns => 'ARRAY[VclResponse]',
        };
}
# @return ARRAY[VclResponse]
#
sub list_custom_vcl {
    my ($self, %args) = @_;

    # verify the required parameter 'service_id' is set
    unless (exists $args{'service_id'}) {
      croak("Missing the required parameter 'service_id' when calling list_custom_vcl");
    }

    # verify the required parameter 'version_id' is set
    unless (exists $args{'version_id'}) {
      croak("Missing the required parameter 'version_id' when calling list_custom_vcl");
    }

    # parse inputs
    my $_resource_path = '/service/{service_id}/version/{version_id}/vcl';

    my $_method = 'GET';
    my $query_params = {};
    my $header_params = {};
    my $form_params = {};

    # 'Accept' and 'Content-Type' header
    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();

    # path params
    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;
    }

    # path params
    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;
    # authentication setting, if any
    my $auth_settings = [qw(token )];

    # make the API Call
    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[VclResponse]', $response);
    return $_response_object;
}

#
# set_custom_vcl_main
#
# Set a custom VCL file as main
#
# @param string $service_id Alphanumeric string identifying the service. (required)
# @param int $version_id Integer identifying a service version. (required)
# @param string $vcl_name The name of this VCL. (required)
{
    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',
    },
    'vcl_name' => {
        data_type => 'string',
        description => 'The name of this VCL.',
        required => '1',
    },
    };
    __PACKAGE__->method_documentation->{ 'set_custom_vcl_main' } = {
        summary => 'Set a custom VCL file as main',
        params => $params,
        returns => 'VclResponse',
        };
}
# @return VclResponse
#
sub set_custom_vcl_main {
    my ($self, %args) = @_;

    # verify the required parameter 'service_id' is set
    unless (exists $args{'service_id'}) {
      croak("Missing the required parameter 'service_id' when calling set_custom_vcl_main");
    }

    # verify the required parameter 'version_id' is set
    unless (exists $args{'version_id'}) {
      croak("Missing the required parameter 'version_id' when calling set_custom_vcl_main");
    }

    # verify the required parameter 'vcl_name' is set
    unless (exists $args{'vcl_name'}) {
      croak("Missing the required parameter 'vcl_name' when calling set_custom_vcl_main");
    }

    # parse inputs
    my $_resource_path = '/service/{service_id}/version/{version_id}/vcl/{vcl_name}/main';

    my $_method = 'PUT';
    my $query_params = {};
    my $header_params = {};
    my $form_params = {};

    # 'Accept' and 'Content-Type' header
    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();

    # path params
    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;
    }

    # path params
    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;
    }

    # path params
    if ( exists $args{'vcl_name'}) {
        my $_base_variable = "{" . "vcl_name" . "}";
        my $_base_value = $self->{api_client}->to_path_value($args{'vcl_name'});
        $_resource_path =~ s/$_base_variable/$_base_value/g;
    }

    my $_body_data;
    # authentication setting, if any
    my $auth_settings = [qw(token )];

    # make the API Call
    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('VclResponse', $response);
    return $_response_object;
}

#
# update_custom_vcl
#
# Update a custom VCL file
#
# @param string $service_id Alphanumeric string identifying the service. (required)
# @param int $version_id Integer identifying a service version. (required)
# @param string $vcl_name The name of this VCL. (required)
# @param string $content The VCL code to be included. (optional)
# @param boolean $main Set to `true` when this is the main VCL, otherwise `false`. (optional)
# @param string $name The name of this VCL. (optional)
{
    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',
    },
    'vcl_name' => {
        data_type => 'string',
        description => 'The name of this VCL.',
        required => '1',
    },
    'content' => {
        data_type => 'string',
        description => 'The VCL code to be included.',
        required => '0',
    },
    'main' => {
        data_type => 'boolean',
        description => 'Set to `true` when this is the main VCL, otherwise `false`.',
        required => '0',
    },
    'name' => {
        data_type => 'string',
        description => 'The name of this VCL.',
        required => '0',
    },
    };
    __PACKAGE__->method_documentation->{ 'update_custom_vcl' } = {
        summary => 'Update a custom VCL file',
        params => $params,
        returns => 'VclResponse',
        };
}
# @return VclResponse
#
sub update_custom_vcl {
    my ($self, %args) = @_;

    # verify the required parameter 'service_id' is set
    unless (exists $args{'service_id'}) {
      croak("Missing the required parameter 'service_id' when calling update_custom_vcl");
    }

    # verify the required parameter 'version_id' is set
    unless (exists $args{'version_id'}) {
      croak("Missing the required parameter 'version_id' when calling update_custom_vcl");
    }

    # verify the required parameter 'vcl_name' is set
    unless (exists $args{'vcl_name'}) {
      croak("Missing the required parameter 'vcl_name' when calling update_custom_vcl");
    }

    # parse inputs
    my $_resource_path = '/service/{service_id}/version/{version_id}/vcl/{vcl_name}';

    my $_method = 'PUT';
    my $query_params = {};
    my $header_params = {};
    my $form_params = {};

    # 'Accept' and 'Content-Type' header
    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');

    # path params
    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;
    }

    # path params
    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;
    }

    # path params
    if ( exists $args{'vcl_name'}) {
        my $_base_variable = "{" . "vcl_name" . "}";
        my $_base_value = $self->{api_client}->to_path_value($args{'vcl_name'});
        $_resource_path =~ s/$_base_variable/$_base_value/g;
    }

    # form params
    if ( exists $args{'content'} ) {
                $form_params->{'content'} = $self->{api_client}->to_form_value($args{'content'});
    }

    # form params
    if ( exists $args{'main'} ) {
                $form_params->{'main'} = $self->{api_client}->to_form_value($args{'main'});
    }

    # form params
    if ( exists $args{'name'} ) {
                $form_params->{'name'} = $self->{api_client}->to_form_value($args{'name'});
    }

    my $_body_data;
    # authentication setting, if any
    my $auth_settings = [qw(token )];

    # make the API Call
    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('VclResponse', $response);
    return $_response_object;
}

1;


Powered by Groonga
Maintained by Kenichi Ishigaki <ishigaki@cpan.org>. If you find anything, submit it on GitHub.