Fastly/IamRolesApi.pm untested

filter: Statementstmt 0.0% 0 / 90 Branchbran 0.0% 0 / 20 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 0.0% 0 / 12 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 134 CC 11 SCAR 29.8
CC
11
Cov
0%
iam_v1_roles_get
42.0
iam_v1_roles_list
30.0
new
6.0
CRAP 19.6
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::IamRolesApi;
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 # iam_v1_roles_get
51 #
52 # Get IAM role by ID
53 #
54 # @param string $role_id Alphanumeric string identifying the role. (required)
55 # @param string $include Include related data (i.e., permissions). (optional)
56 {
57 my $params = {
58 'role_id' => {
59 data_type => 'string',
60 description => 'Alphanumeric string identifying the role.',
61 required => '1',
62 },
63 'include' => {
64 data_type => 'string',
65 description => 'Include related data (i.e., permissions).',
66 required => '0',
67 },
68 };
69 __PACKAGE__->method_documentation->{ 'iam_v1_roles_get' } = {
70 summary => 'Get IAM role by ID',
71 params => $params,
72 returns => 'IamV1RoleResponse',
73 };
74 }
75 # @return IamV1RoleResponse
76 #
77 sub iam_v1_roles_get {
78 my ($self, %args) = @_;
79  
80 # verify the required parameter 'role_id' is set
81 unless (exists $args{'role_id'}) {
82 croak("Missing the required parameter 'role_id' when calling iam_v1_roles_get");
83 }
84  
85 # parse inputs
86 my $_resource_path = '/iam/v1/roles/{role_id}';
87  
88 my $_method = 'GET';
89 my $query_params = {};
90 my $header_params = {};
91 my $form_params = {};
92  
93 # 'Accept' and 'Content-Type' header
94 my $_header_accept = $self->{api_client}->select_header_accept('application/json');
95 if ($_header_accept) {
96 $header_params->{'Accept'} = $_header_accept;
97 }
98 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type();
99  
100 # query params
101 if ( exists $args{'include'}) {
102 $query_params->{'include'} = $self->{api_client}->to_query_value($args{'include'});
103 }
104  
105 # path params
106 if ( exists $args{'role_id'}) {
107 my $_base_variable = "{" . "role_id" . "}";
108 my $_base_value = $self->{api_client}->to_path_value($args{'role_id'});
109 $_resource_path =~ s/$_base_variable/$_base_value/g;
110 }
111  
112 my $_body_data;
113 # authentication setting, if any
114 my $auth_settings = [qw(token )];
115  
116 # make the API Call
117 my $response = $self->{api_client}->call_api($_resource_path, $_method,
118 $query_params, $form_params,
119 $header_params, $_body_data, $auth_settings);
120 if (!$response) {
121 return;
122 }
123 my $_response_object = $self->{api_client}->deserialize('IamV1RoleResponse', $response);
124 return $_response_object;
125 }
126  
127 #
128 # iam_v1_roles_list
129 #
130 # List IAM roles
131 #
132 # @param int $limit Number of results per page. The maximum is 1000. (optional, default to 100)
133 # @param string $cursor Cursor value from the `next_cursor` field of a previous response, used to retrieve the next page. To request the first page, this should be empty. (optional)
134 {
135 my $params = {
136 'limit' => {
137 data_type => 'int',
138 description => 'Number of results per page. The maximum is 1000.',
139 required => '0',
140 },
141 'cursor' => {
142 data_type => 'string',
143 description => 'Cursor value from the `next_cursor` field of a previous response, used to retrieve the next page. To request the first page, this should be empty.',
144 required => '0',
145 },
146 };
147 __PACKAGE__->method_documentation->{ 'iam_v1_roles_list' } = {
148 summary => 'List IAM roles',
149 params => $params,
150 returns => 'IamV1RoleListResponse',
151 };
152 }
153 # @return IamV1RoleListResponse
154 #
155 sub iam_v1_roles_list {
156 my ($self, %args) = @_;
157  
158 # parse inputs
159 my $_resource_path = '/iam/v1/roles';
160  
161 my $_method = 'GET';
162 my $query_params = {};
163 my $header_params = {};
164 my $form_params = {};
165  
166 # 'Accept' and 'Content-Type' header
167 my $_header_accept = $self->{api_client}->select_header_accept('application/json');
168 if ($_header_accept) {
169 $header_params->{'Accept'} = $_header_accept;
170 }
171 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type();
172  
173 # query params
174 if ( exists $args{'limit'}) {
175 $query_params->{'limit'} = $self->{api_client}->to_query_value($args{'limit'});
176 }
177  
178 # query params
179 if ( exists $args{'cursor'}) {
180 $query_params->{'cursor'} = $self->{api_client}->to_query_value($args{'cursor'});
181 }
182  
183 my $_body_data;
184 # authentication setting, if any
185 my $auth_settings = [qw(token )];
186  
187 # make the API Call
188 my $response = $self->{api_client}->call_api($_resource_path, $_method,
189 $query_params, $form_params,
190 $header_params, $_body_data, $auth_settings);
191 if (!$response) {
192 return;
193 }
194 my $_response_object = $self->{api_client}->deserialize('IamV1RoleListResponse', $response);
195 return $_response_object;
196 }
197  
198 1;