1package automation 2 3// Copyright (c) Microsoft and contributors. All rights reserved. 4// 5// Licensed under the Apache License, Version 2.0 (the "License"); 6// you may not use this file except in compliance with the License. 7// You may obtain a copy of the License at 8// http://www.apache.org/licenses/LICENSE-2.0 9// 10// Unless required by applicable law or agreed to in writing, software 11// distributed under the License is distributed on an "AS IS" BASIS, 12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13// 14// See the License for the specific language governing permissions and 15// limitations under the License. 16// 17// Code generated by Microsoft (R) AutoRest Code Generator. 18// Changes may cause incorrect behavior and will be lost if the code is regenerated. 19 20import ( 21 "context" 22 "github.com/Azure/go-autorest/autorest" 23 "github.com/Azure/go-autorest/autorest/azure" 24 "github.com/Azure/go-autorest/autorest/validation" 25 "github.com/Azure/go-autorest/tracing" 26 "net/http" 27) 28 29// ModuleClient is the automation Client 30type ModuleClient struct { 31 BaseClient 32} 33 34// NewModuleClient creates an instance of the ModuleClient client. 35func NewModuleClient(subscriptionID string) ModuleClient { 36 return NewModuleClientWithBaseURI(DefaultBaseURI, subscriptionID) 37} 38 39// NewModuleClientWithBaseURI creates an instance of the ModuleClient client using a custom endpoint. Use this when 40// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). 41func NewModuleClientWithBaseURI(baseURI string, subscriptionID string) ModuleClient { 42 return ModuleClient{NewWithBaseURI(baseURI, subscriptionID)} 43} 44 45// CreateOrUpdate create or Update the module identified by module name. 46// Parameters: 47// resourceGroupName - name of an Azure Resource group. 48// automationAccountName - the name of the automation account. 49// moduleName - the name of module. 50// parameters - the create or update parameters for module. 51func (client ModuleClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, moduleName string, parameters ModuleCreateOrUpdateParameters) (result Module, err error) { 52 if tracing.IsEnabled() { 53 ctx = tracing.StartSpan(ctx, fqdn+"/ModuleClient.CreateOrUpdate") 54 defer func() { 55 sc := -1 56 if result.Response.Response != nil { 57 sc = result.Response.Response.StatusCode 58 } 59 tracing.EndSpan(ctx, sc, err) 60 }() 61 } 62 if err := validation.Validate([]validation.Validation{ 63 {TargetValue: resourceGroupName, 64 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, 65 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, 66 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, 67 {TargetValue: parameters, 68 Constraints: []validation.Constraint{{Target: "parameters.ModuleCreateOrUpdateProperties", Name: validation.Null, Rule: true, 69 Chain: []validation.Constraint{{Target: "parameters.ModuleCreateOrUpdateProperties.ContentLink", Name: validation.Null, Rule: true, 70 Chain: []validation.Constraint{{Target: "parameters.ModuleCreateOrUpdateProperties.ContentLink.ContentHash", Name: validation.Null, Rule: false, 71 Chain: []validation.Constraint{{Target: "parameters.ModuleCreateOrUpdateProperties.ContentLink.ContentHash.Algorithm", Name: validation.Null, Rule: true, Chain: nil}, 72 {Target: "parameters.ModuleCreateOrUpdateProperties.ContentLink.ContentHash.Value", Name: validation.Null, Rule: true, Chain: nil}, 73 }}, 74 }}, 75 }}}}}); err != nil { 76 return result, validation.NewError("automation.ModuleClient", "CreateOrUpdate", err.Error()) 77 } 78 79 req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, automationAccountName, moduleName, parameters) 80 if err != nil { 81 err = autorest.NewErrorWithError(err, "automation.ModuleClient", "CreateOrUpdate", nil, "Failure preparing request") 82 return 83 } 84 85 resp, err := client.CreateOrUpdateSender(req) 86 if err != nil { 87 result.Response = autorest.Response{Response: resp} 88 err = autorest.NewErrorWithError(err, "automation.ModuleClient", "CreateOrUpdate", resp, "Failure sending request") 89 return 90 } 91 92 result, err = client.CreateOrUpdateResponder(resp) 93 if err != nil { 94 err = autorest.NewErrorWithError(err, "automation.ModuleClient", "CreateOrUpdate", resp, "Failure responding to request") 95 } 96 97 return 98} 99 100// CreateOrUpdatePreparer prepares the CreateOrUpdate request. 101func (client ModuleClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, moduleName string, parameters ModuleCreateOrUpdateParameters) (*http.Request, error) { 102 pathParameters := map[string]interface{}{ 103 "automationAccountName": autorest.Encode("path", automationAccountName), 104 "moduleName": autorest.Encode("path", moduleName), 105 "resourceGroupName": autorest.Encode("path", resourceGroupName), 106 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 107 } 108 109 const APIVersion = "2015-10-31" 110 queryParameters := map[string]interface{}{ 111 "api-version": APIVersion, 112 } 113 114 preparer := autorest.CreatePreparer( 115 autorest.AsContentType("application/json; charset=utf-8"), 116 autorest.AsPut(), 117 autorest.WithBaseURL(client.BaseURI), 118 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules/{moduleName}", pathParameters), 119 autorest.WithJSON(parameters), 120 autorest.WithQueryParameters(queryParameters)) 121 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 122} 123 124// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the 125// http.Response Body if it receives an error. 126func (client ModuleClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { 127 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 128} 129 130// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always 131// closes the http.Response Body. 132func (client ModuleClient) CreateOrUpdateResponder(resp *http.Response) (result Module, err error) { 133 err = autorest.Respond( 134 resp, 135 client.ByInspecting(), 136 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), 137 autorest.ByUnmarshallingJSON(&result), 138 autorest.ByClosing()) 139 result.Response = autorest.Response{Response: resp} 140 return 141} 142 143// Delete delete the module by name. 144// Parameters: 145// resourceGroupName - name of an Azure Resource group. 146// automationAccountName - the name of the automation account. 147// moduleName - the module name. 148func (client ModuleClient) Delete(ctx context.Context, resourceGroupName string, automationAccountName string, moduleName string) (result autorest.Response, err error) { 149 if tracing.IsEnabled() { 150 ctx = tracing.StartSpan(ctx, fqdn+"/ModuleClient.Delete") 151 defer func() { 152 sc := -1 153 if result.Response != nil { 154 sc = result.Response.StatusCode 155 } 156 tracing.EndSpan(ctx, sc, err) 157 }() 158 } 159 if err := validation.Validate([]validation.Validation{ 160 {TargetValue: resourceGroupName, 161 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, 162 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, 163 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { 164 return result, validation.NewError("automation.ModuleClient", "Delete", err.Error()) 165 } 166 167 req, err := client.DeletePreparer(ctx, resourceGroupName, automationAccountName, moduleName) 168 if err != nil { 169 err = autorest.NewErrorWithError(err, "automation.ModuleClient", "Delete", nil, "Failure preparing request") 170 return 171 } 172 173 resp, err := client.DeleteSender(req) 174 if err != nil { 175 result.Response = resp 176 err = autorest.NewErrorWithError(err, "automation.ModuleClient", "Delete", resp, "Failure sending request") 177 return 178 } 179 180 result, err = client.DeleteResponder(resp) 181 if err != nil { 182 err = autorest.NewErrorWithError(err, "automation.ModuleClient", "Delete", resp, "Failure responding to request") 183 } 184 185 return 186} 187 188// DeletePreparer prepares the Delete request. 189func (client ModuleClient) DeletePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, moduleName string) (*http.Request, error) { 190 pathParameters := map[string]interface{}{ 191 "automationAccountName": autorest.Encode("path", automationAccountName), 192 "moduleName": autorest.Encode("path", moduleName), 193 "resourceGroupName": autorest.Encode("path", resourceGroupName), 194 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 195 } 196 197 const APIVersion = "2015-10-31" 198 queryParameters := map[string]interface{}{ 199 "api-version": APIVersion, 200 } 201 202 preparer := autorest.CreatePreparer( 203 autorest.AsDelete(), 204 autorest.WithBaseURL(client.BaseURI), 205 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules/{moduleName}", pathParameters), 206 autorest.WithQueryParameters(queryParameters)) 207 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 208} 209 210// DeleteSender sends the Delete request. The method will close the 211// http.Response Body if it receives an error. 212func (client ModuleClient) DeleteSender(req *http.Request) (*http.Response, error) { 213 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 214} 215 216// DeleteResponder handles the response to the Delete request. The method always 217// closes the http.Response Body. 218func (client ModuleClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { 219 err = autorest.Respond( 220 resp, 221 client.ByInspecting(), 222 azure.WithErrorUnlessStatusCode(http.StatusOK), 223 autorest.ByClosing()) 224 result.Response = resp 225 return 226} 227 228// Get retrieve the module identified by module name. 229// Parameters: 230// resourceGroupName - name of an Azure Resource group. 231// automationAccountName - the name of the automation account. 232// moduleName - the module name. 233func (client ModuleClient) Get(ctx context.Context, resourceGroupName string, automationAccountName string, moduleName string) (result Module, err error) { 234 if tracing.IsEnabled() { 235 ctx = tracing.StartSpan(ctx, fqdn+"/ModuleClient.Get") 236 defer func() { 237 sc := -1 238 if result.Response.Response != nil { 239 sc = result.Response.Response.StatusCode 240 } 241 tracing.EndSpan(ctx, sc, err) 242 }() 243 } 244 if err := validation.Validate([]validation.Validation{ 245 {TargetValue: resourceGroupName, 246 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, 247 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, 248 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { 249 return result, validation.NewError("automation.ModuleClient", "Get", err.Error()) 250 } 251 252 req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName, moduleName) 253 if err != nil { 254 err = autorest.NewErrorWithError(err, "automation.ModuleClient", "Get", nil, "Failure preparing request") 255 return 256 } 257 258 resp, err := client.GetSender(req) 259 if err != nil { 260 result.Response = autorest.Response{Response: resp} 261 err = autorest.NewErrorWithError(err, "automation.ModuleClient", "Get", resp, "Failure sending request") 262 return 263 } 264 265 result, err = client.GetResponder(resp) 266 if err != nil { 267 err = autorest.NewErrorWithError(err, "automation.ModuleClient", "Get", resp, "Failure responding to request") 268 } 269 270 return 271} 272 273// GetPreparer prepares the Get request. 274func (client ModuleClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, moduleName string) (*http.Request, error) { 275 pathParameters := map[string]interface{}{ 276 "automationAccountName": autorest.Encode("path", automationAccountName), 277 "moduleName": autorest.Encode("path", moduleName), 278 "resourceGroupName": autorest.Encode("path", resourceGroupName), 279 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 280 } 281 282 const APIVersion = "2015-10-31" 283 queryParameters := map[string]interface{}{ 284 "api-version": APIVersion, 285 } 286 287 preparer := autorest.CreatePreparer( 288 autorest.AsGet(), 289 autorest.WithBaseURL(client.BaseURI), 290 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules/{moduleName}", pathParameters), 291 autorest.WithQueryParameters(queryParameters)) 292 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 293} 294 295// GetSender sends the Get request. The method will close the 296// http.Response Body if it receives an error. 297func (client ModuleClient) GetSender(req *http.Request) (*http.Response, error) { 298 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 299} 300 301// GetResponder handles the response to the Get request. The method always 302// closes the http.Response Body. 303func (client ModuleClient) GetResponder(resp *http.Response) (result Module, err error) { 304 err = autorest.Respond( 305 resp, 306 client.ByInspecting(), 307 azure.WithErrorUnlessStatusCode(http.StatusOK), 308 autorest.ByUnmarshallingJSON(&result), 309 autorest.ByClosing()) 310 result.Response = autorest.Response{Response: resp} 311 return 312} 313 314// ListByAutomationAccount retrieve a list of modules. 315// Parameters: 316// resourceGroupName - name of an Azure Resource group. 317// automationAccountName - the name of the automation account. 318func (client ModuleClient) ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string) (result ModuleListResultPage, err error) { 319 if tracing.IsEnabled() { 320 ctx = tracing.StartSpan(ctx, fqdn+"/ModuleClient.ListByAutomationAccount") 321 defer func() { 322 sc := -1 323 if result.mlr.Response.Response != nil { 324 sc = result.mlr.Response.Response.StatusCode 325 } 326 tracing.EndSpan(ctx, sc, err) 327 }() 328 } 329 if err := validation.Validate([]validation.Validation{ 330 {TargetValue: resourceGroupName, 331 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, 332 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, 333 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { 334 return result, validation.NewError("automation.ModuleClient", "ListByAutomationAccount", err.Error()) 335 } 336 337 result.fn = client.listByAutomationAccountNextResults 338 req, err := client.ListByAutomationAccountPreparer(ctx, resourceGroupName, automationAccountName) 339 if err != nil { 340 err = autorest.NewErrorWithError(err, "automation.ModuleClient", "ListByAutomationAccount", nil, "Failure preparing request") 341 return 342 } 343 344 resp, err := client.ListByAutomationAccountSender(req) 345 if err != nil { 346 result.mlr.Response = autorest.Response{Response: resp} 347 err = autorest.NewErrorWithError(err, "automation.ModuleClient", "ListByAutomationAccount", resp, "Failure sending request") 348 return 349 } 350 351 result.mlr, err = client.ListByAutomationAccountResponder(resp) 352 if err != nil { 353 err = autorest.NewErrorWithError(err, "automation.ModuleClient", "ListByAutomationAccount", resp, "Failure responding to request") 354 } 355 356 return 357} 358 359// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. 360func (client ModuleClient) ListByAutomationAccountPreparer(ctx context.Context, resourceGroupName string, automationAccountName string) (*http.Request, error) { 361 pathParameters := map[string]interface{}{ 362 "automationAccountName": autorest.Encode("path", automationAccountName), 363 "resourceGroupName": autorest.Encode("path", resourceGroupName), 364 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 365 } 366 367 const APIVersion = "2015-10-31" 368 queryParameters := map[string]interface{}{ 369 "api-version": APIVersion, 370 } 371 372 preparer := autorest.CreatePreparer( 373 autorest.AsGet(), 374 autorest.WithBaseURL(client.BaseURI), 375 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules", pathParameters), 376 autorest.WithQueryParameters(queryParameters)) 377 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 378} 379 380// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the 381// http.Response Body if it receives an error. 382func (client ModuleClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { 383 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 384} 385 386// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always 387// closes the http.Response Body. 388func (client ModuleClient) ListByAutomationAccountResponder(resp *http.Response) (result ModuleListResult, err error) { 389 err = autorest.Respond( 390 resp, 391 client.ByInspecting(), 392 azure.WithErrorUnlessStatusCode(http.StatusOK), 393 autorest.ByUnmarshallingJSON(&result), 394 autorest.ByClosing()) 395 result.Response = autorest.Response{Response: resp} 396 return 397} 398 399// listByAutomationAccountNextResults retrieves the next set of results, if any. 400func (client ModuleClient) listByAutomationAccountNextResults(ctx context.Context, lastResults ModuleListResult) (result ModuleListResult, err error) { 401 req, err := lastResults.moduleListResultPreparer(ctx) 402 if err != nil { 403 return result, autorest.NewErrorWithError(err, "automation.ModuleClient", "listByAutomationAccountNextResults", nil, "Failure preparing next results request") 404 } 405 if req == nil { 406 return 407 } 408 resp, err := client.ListByAutomationAccountSender(req) 409 if err != nil { 410 result.Response = autorest.Response{Response: resp} 411 return result, autorest.NewErrorWithError(err, "automation.ModuleClient", "listByAutomationAccountNextResults", resp, "Failure sending next results request") 412 } 413 result, err = client.ListByAutomationAccountResponder(resp) 414 if err != nil { 415 err = autorest.NewErrorWithError(err, "automation.ModuleClient", "listByAutomationAccountNextResults", resp, "Failure responding to next results request") 416 } 417 return 418} 419 420// ListByAutomationAccountComplete enumerates all values, automatically crossing page boundaries as required. 421func (client ModuleClient) ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string) (result ModuleListResultIterator, err error) { 422 if tracing.IsEnabled() { 423 ctx = tracing.StartSpan(ctx, fqdn+"/ModuleClient.ListByAutomationAccount") 424 defer func() { 425 sc := -1 426 if result.Response().Response.Response != nil { 427 sc = result.page.Response().Response.Response.StatusCode 428 } 429 tracing.EndSpan(ctx, sc, err) 430 }() 431 } 432 result.page, err = client.ListByAutomationAccount(ctx, resourceGroupName, automationAccountName) 433 return 434} 435 436// Update update the module identified by module name. 437// Parameters: 438// resourceGroupName - name of an Azure Resource group. 439// automationAccountName - the name of the automation account. 440// moduleName - the name of module. 441// parameters - the update parameters for module. 442func (client ModuleClient) Update(ctx context.Context, resourceGroupName string, automationAccountName string, moduleName string, parameters ModuleUpdateParameters) (result Module, err error) { 443 if tracing.IsEnabled() { 444 ctx = tracing.StartSpan(ctx, fqdn+"/ModuleClient.Update") 445 defer func() { 446 sc := -1 447 if result.Response.Response != nil { 448 sc = result.Response.Response.StatusCode 449 } 450 tracing.EndSpan(ctx, sc, err) 451 }() 452 } 453 if err := validation.Validate([]validation.Validation{ 454 {TargetValue: resourceGroupName, 455 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, 456 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, 457 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { 458 return result, validation.NewError("automation.ModuleClient", "Update", err.Error()) 459 } 460 461 req, err := client.UpdatePreparer(ctx, resourceGroupName, automationAccountName, moduleName, parameters) 462 if err != nil { 463 err = autorest.NewErrorWithError(err, "automation.ModuleClient", "Update", nil, "Failure preparing request") 464 return 465 } 466 467 resp, err := client.UpdateSender(req) 468 if err != nil { 469 result.Response = autorest.Response{Response: resp} 470 err = autorest.NewErrorWithError(err, "automation.ModuleClient", "Update", resp, "Failure sending request") 471 return 472 } 473 474 result, err = client.UpdateResponder(resp) 475 if err != nil { 476 err = autorest.NewErrorWithError(err, "automation.ModuleClient", "Update", resp, "Failure responding to request") 477 } 478 479 return 480} 481 482// UpdatePreparer prepares the Update request. 483func (client ModuleClient) UpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, moduleName string, parameters ModuleUpdateParameters) (*http.Request, error) { 484 pathParameters := map[string]interface{}{ 485 "automationAccountName": autorest.Encode("path", automationAccountName), 486 "moduleName": autorest.Encode("path", moduleName), 487 "resourceGroupName": autorest.Encode("path", resourceGroupName), 488 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 489 } 490 491 const APIVersion = "2015-10-31" 492 queryParameters := map[string]interface{}{ 493 "api-version": APIVersion, 494 } 495 496 preparer := autorest.CreatePreparer( 497 autorest.AsContentType("application/json; charset=utf-8"), 498 autorest.AsPatch(), 499 autorest.WithBaseURL(client.BaseURI), 500 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules/{moduleName}", pathParameters), 501 autorest.WithJSON(parameters), 502 autorest.WithQueryParameters(queryParameters)) 503 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 504} 505 506// UpdateSender sends the Update request. The method will close the 507// http.Response Body if it receives an error. 508func (client ModuleClient) UpdateSender(req *http.Request) (*http.Response, error) { 509 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 510} 511 512// UpdateResponder handles the response to the Update request. The method always 513// closes the http.Response Body. 514func (client ModuleClient) UpdateResponder(resp *http.Response) (result Module, err error) { 515 err = autorest.Respond( 516 resp, 517 client.ByInspecting(), 518 azure.WithErrorUnlessStatusCode(http.StatusOK), 519 autorest.ByUnmarshallingJSON(&result), 520 autorest.ByClosing()) 521 result.Response = autorest.Response{Response: resp} 522 return 523} 524