From 17e50be0daaef4132f86c381f6539bccb96c5559 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Thu, 5 Jul 2018 23:46:13 +0000 Subject: [PATCH] Generated from e8a0ed15963c97d38222e26f451052219c790fdc nit fixes: Remove 4xx responses and schema to file --- .../automation/mgmt/automation/models.go | 1 + .../mgmt/2015-10-31/automation/client.go | 2 +- .../2015-10-31/automation/connectiontype.go | 2 +- .../mgmt/2015-10-31/automation/models.go | 8 ++++---- .../mgmt/2015-10-31/automation/runbook.go | 11 +++++------ .../mgmt/2015-10-31/automation/runbookdraft.go | 13 ++++++------- .../mgmt/2015-10-31/automation/schedule.go | 2 +- .../automation/connectiontype.go | 2 +- .../mgmt/2017-05-15-preview/automation/job.go | 18 ++++++++---------- .../2017-05-15-preview/automation/models.go | 15 +++++++++++---- .../2017-05-15-preview/automation/runbook.go | 11 +++++------ .../automation/runbookdraft.go | 13 ++++++------- .../2017-05-15-preview/automation/schedule.go | 2 +- .../automation/connectiontype.go | 2 +- .../mgmt/2018-01-preview/automation/job.go | 18 ++++++++---------- .../mgmt/2018-01-preview/automation/models.go | 15 +++++++++++---- .../mgmt/2018-01-preview/automation/runbook.go | 11 +++++------ .../2018-01-preview/automation/runbookdraft.go | 13 ++++++------- .../2018-01-preview/automation/schedule.go | 2 +- 19 files changed, 83 insertions(+), 78 deletions(-) diff --git a/profiles/preview/preview/automation/mgmt/automation/models.go b/profiles/preview/preview/automation/mgmt/automation/models.go index 2412359c8b9a..f4e85c13d3f1 100644 --- a/profiles/preview/preview/automation/mgmt/automation/models.go +++ b/profiles/preview/preview/automation/mgmt/automation/models.go @@ -476,6 +476,7 @@ type Operation = original.Operation type OperationDisplay = original.OperationDisplay type OperationListResult = original.OperationListResult type ProxyResource = original.ProxyResource +type ReadCloser = original.ReadCloser type Resource = original.Resource type RunAsCredentialAssociationProperty = original.RunAsCredentialAssociationProperty type Runbook = original.Runbook diff --git a/services/automation/mgmt/2015-10-31/automation/client.go b/services/automation/mgmt/2015-10-31/automation/client.go index 71700fb23f89..707fd618586a 100644 --- a/services/automation/mgmt/2015-10-31/automation/client.go +++ b/services/automation/mgmt/2015-10-31/automation/client.go @@ -1,4 +1,4 @@ -// Package automation implements the Azure ARM Automation service API version . +// Package automation implements the Azure ARM Automation service API version 2015-10-31. // // Automation Client package automation diff --git a/services/automation/mgmt/2015-10-31/automation/connectiontype.go b/services/automation/mgmt/2015-10-31/automation/connectiontype.go index 7ec6c994a39b..716b532130b3 100644 --- a/services/automation/mgmt/2015-10-31/automation/connectiontype.go +++ b/services/automation/mgmt/2015-10-31/automation/connectiontype.go @@ -117,7 +117,7 @@ func (client ConnectionTypeClient) CreateOrUpdateResponder(resp *http.Response) err = autorest.Respond( resp, client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusConflict), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} diff --git a/services/automation/mgmt/2015-10-31/automation/models.go b/services/automation/mgmt/2015-10-31/automation/models.go index 70f8dfdd7d49..aadb1e64659e 100644 --- a/services/automation/mgmt/2015-10-31/automation/models.go +++ b/services/automation/mgmt/2015-10-31/automation/models.go @@ -5695,7 +5695,7 @@ type RunbookDraftReplaceContentFuture struct { // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future *RunbookDraftReplaceContentFuture) Result(client RunbookDraftClient) (s String, err error) { +func (future *RunbookDraftReplaceContentFuture) Result(client RunbookDraftClient) (rc ReadCloser, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -5707,10 +5707,10 @@ func (future *RunbookDraftReplaceContentFuture) Result(client RunbookDraftClient return } sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { - s, err = client.ReplaceContentResponder(s.Response.Response) + if rc.Response.Response, err = future.GetResult(sender); err == nil && rc.Response.Response.StatusCode != http.StatusNoContent { + rc, err = client.ReplaceContentResponder(rc.Response.Response) if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookDraftReplaceContentFuture", "Result", s.Response.Response, "Failure responding to request") + err = autorest.NewErrorWithError(err, "automation.RunbookDraftReplaceContentFuture", "Result", rc.Response.Response, "Failure responding to request") } } return diff --git a/services/automation/mgmt/2015-10-31/automation/runbook.go b/services/automation/mgmt/2015-10-31/automation/runbook.go index af0abb9909f2..e228e1866544 100644 --- a/services/automation/mgmt/2015-10-31/automation/runbook.go +++ b/services/automation/mgmt/2015-10-31/automation/runbook.go @@ -131,7 +131,7 @@ func (client RunbookClient) CreateOrUpdateResponder(resp *http.Response) (result err = autorest.Respond( resp, client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusBadRequest), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} @@ -296,7 +296,7 @@ func (client RunbookClient) GetResponder(resp *http.Response) (result Runbook, e // resourceGroupName - name of an Azure Resource group. // automationAccountName - the name of the automation account. // runbookName - the runbook name. -func (client RunbookClient) GetContent(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (result String, err error) { +func (client RunbookClient) GetContent(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (result ReadCloser, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, @@ -357,13 +357,12 @@ func (client RunbookClient) GetContentSender(req *http.Request) (*http.Response, // GetContentResponder handles the response to the GetContent request. The method always // closes the http.Response Body. -func (client RunbookClient) GetContentResponder(resp *http.Response) (result String, err error) { +func (client RunbookClient) GetContentResponder(resp *http.Response) (result ReadCloser, err error) { + result.Value = &resp.Body err = autorest.Respond( resp, client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) + azure.WithErrorUnlessStatusCode(http.StatusOK)) result.Response = autorest.Response{Response: resp} return } diff --git a/services/automation/mgmt/2015-10-31/automation/runbookdraft.go b/services/automation/mgmt/2015-10-31/automation/runbookdraft.go index 25e7f2886be2..9de6ca1a79f3 100644 --- a/services/automation/mgmt/2015-10-31/automation/runbookdraft.go +++ b/services/automation/mgmt/2015-10-31/automation/runbookdraft.go @@ -122,7 +122,7 @@ func (client RunbookDraftClient) GetResponder(resp *http.Response) (result Runbo // resourceGroupName - name of an Azure Resource group. // automationAccountName - the name of the automation account. // runbookName - the runbook name. -func (client RunbookDraftClient) GetContent(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (result String, err error) { +func (client RunbookDraftClient) GetContent(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (result ReadCloser, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, @@ -183,13 +183,12 @@ func (client RunbookDraftClient) GetContentSender(req *http.Request) (*http.Resp // GetContentResponder handles the response to the GetContent request. The method always // closes the http.Response Body. -func (client RunbookDraftClient) GetContentResponder(resp *http.Response) (result String, err error) { +func (client RunbookDraftClient) GetContentResponder(resp *http.Response) (result ReadCloser, err error) { + result.Value = &resp.Body err = autorest.Respond( resp, client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) + azure.WithErrorUnlessStatusCode(http.StatusOK)) result.Response = autorest.Response{Response: resp} return } @@ -279,7 +278,7 @@ func (client RunbookDraftClient) PublishResponder(resp *http.Response) (result a // resourceGroupName - name of an Azure Resource group. // automationAccountName - the name of the automation account. // runbookName - the runbook name. -// runbookContent - the runbook draft content. +// runbookContent - the runbook draft content. func (client RunbookDraftClient) ReplaceContent(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string, runbookContent string) (result RunbookDraftReplaceContentFuture, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, @@ -347,7 +346,7 @@ func (client RunbookDraftClient) ReplaceContentSender(req *http.Request) (future // ReplaceContentResponder handles the response to the ReplaceContent request. The method always // closes the http.Response Body. -func (client RunbookDraftClient) ReplaceContentResponder(resp *http.Response) (result String, err error) { +func (client RunbookDraftClient) ReplaceContentResponder(resp *http.Response) (result ReadCloser, err error) { err = autorest.Respond( resp, client.ByInspecting(), diff --git a/services/automation/mgmt/2015-10-31/automation/schedule.go b/services/automation/mgmt/2015-10-31/automation/schedule.go index c6635f076f56..ce73dab64230 100644 --- a/services/automation/mgmt/2015-10-31/automation/schedule.go +++ b/services/automation/mgmt/2015-10-31/automation/schedule.go @@ -117,7 +117,7 @@ func (client ScheduleClient) CreateOrUpdateResponder(resp *http.Response) (resul err = autorest.Respond( resp, client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusConflict), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} diff --git a/services/preview/automation/mgmt/2017-05-15-preview/automation/connectiontype.go b/services/preview/automation/mgmt/2017-05-15-preview/automation/connectiontype.go index 7ec6c994a39b..716b532130b3 100644 --- a/services/preview/automation/mgmt/2017-05-15-preview/automation/connectiontype.go +++ b/services/preview/automation/mgmt/2017-05-15-preview/automation/connectiontype.go @@ -117,7 +117,7 @@ func (client ConnectionTypeClient) CreateOrUpdateResponder(resp *http.Response) err = autorest.Respond( resp, client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusConflict), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} diff --git a/services/preview/automation/mgmt/2017-05-15-preview/automation/job.go b/services/preview/automation/mgmt/2017-05-15-preview/automation/job.go index 2333affa4d59..1ae0d32c936f 100644 --- a/services/preview/automation/mgmt/2017-05-15-preview/automation/job.go +++ b/services/preview/automation/mgmt/2017-05-15-preview/automation/job.go @@ -215,7 +215,7 @@ func (client JobClient) GetResponder(resp *http.Response) (result Job, err error // automationAccountName - the name of the automation account. // jobName - the name of the job to be created. // clientRequestID - identifies this specific client request. -func (client JobClient) GetOutput(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, clientRequestID string) (result String, err error) { +func (client JobClient) GetOutput(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, clientRequestID string) (result ReadCloser, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, @@ -280,13 +280,12 @@ func (client JobClient) GetOutputSender(req *http.Request) (*http.Response, erro // GetOutputResponder handles the response to the GetOutput request. The method always // closes the http.Response Body. -func (client JobClient) GetOutputResponder(resp *http.Response) (result String, err error) { +func (client JobClient) GetOutputResponder(resp *http.Response) (result ReadCloser, err error) { + result.Value = &resp.Body err = autorest.Respond( resp, client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) + azure.WithErrorUnlessStatusCode(http.StatusOK)) result.Response = autorest.Response{Response: resp} return } @@ -297,7 +296,7 @@ func (client JobClient) GetOutputResponder(resp *http.Response) (result String, // automationAccountName - the name of the automation account. // jobName - the job name. // clientRequestID - identifies this specific client request. -func (client JobClient) GetRunbookContent(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, clientRequestID string) (result String, err error) { +func (client JobClient) GetRunbookContent(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, clientRequestID string) (result ReadCloser, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, @@ -362,13 +361,12 @@ func (client JobClient) GetRunbookContentSender(req *http.Request) (*http.Respon // GetRunbookContentResponder handles the response to the GetRunbookContent request. The method always // closes the http.Response Body. -func (client JobClient) GetRunbookContentResponder(resp *http.Response) (result String, err error) { +func (client JobClient) GetRunbookContentResponder(resp *http.Response) (result ReadCloser, err error) { + result.Value = &resp.Body err = autorest.Respond( resp, client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) + azure.WithErrorUnlessStatusCode(http.StatusOK)) result.Response = autorest.Response{Response: resp} return } diff --git a/services/preview/automation/mgmt/2017-05-15-preview/automation/models.go b/services/preview/automation/mgmt/2017-05-15-preview/automation/models.go index a40d1a88680a..15671b438edc 100644 --- a/services/preview/automation/mgmt/2017-05-15-preview/automation/models.go +++ b/services/preview/automation/mgmt/2017-05-15-preview/automation/models.go @@ -24,6 +24,7 @@ import ( "github.com/Azure/go-autorest/autorest/date" "github.com/Azure/go-autorest/autorest/to" "github.com/satori/go.uuid" + "io" "net/http" ) @@ -5624,6 +5625,12 @@ type ProxyResource struct { Type *string `json:"type,omitempty"` } +// ReadCloser ... +type ReadCloser struct { + autorest.Response `json:"-"` + Value *io.ReadCloser `json:"value,omitempty"` +} + // Resource the core properties of ARM resources type Resource struct { // ID - Fully qualified resource Id for the resource @@ -5962,7 +5969,7 @@ type RunbookDraftReplaceContentFuture struct { // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future *RunbookDraftReplaceContentFuture) Result(client RunbookDraftClient) (s String, err error) { +func (future *RunbookDraftReplaceContentFuture) Result(client RunbookDraftClient) (rc ReadCloser, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -5974,10 +5981,10 @@ func (future *RunbookDraftReplaceContentFuture) Result(client RunbookDraftClient return } sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { - s, err = client.ReplaceContentResponder(s.Response.Response) + if rc.Response.Response, err = future.GetResult(sender); err == nil && rc.Response.Response.StatusCode != http.StatusNoContent { + rc, err = client.ReplaceContentResponder(rc.Response.Response) if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookDraftReplaceContentFuture", "Result", s.Response.Response, "Failure responding to request") + err = autorest.NewErrorWithError(err, "automation.RunbookDraftReplaceContentFuture", "Result", rc.Response.Response, "Failure responding to request") } } return diff --git a/services/preview/automation/mgmt/2017-05-15-preview/automation/runbook.go b/services/preview/automation/mgmt/2017-05-15-preview/automation/runbook.go index af0abb9909f2..e228e1866544 100644 --- a/services/preview/automation/mgmt/2017-05-15-preview/automation/runbook.go +++ b/services/preview/automation/mgmt/2017-05-15-preview/automation/runbook.go @@ -131,7 +131,7 @@ func (client RunbookClient) CreateOrUpdateResponder(resp *http.Response) (result err = autorest.Respond( resp, client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusBadRequest), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} @@ -296,7 +296,7 @@ func (client RunbookClient) GetResponder(resp *http.Response) (result Runbook, e // resourceGroupName - name of an Azure Resource group. // automationAccountName - the name of the automation account. // runbookName - the runbook name. -func (client RunbookClient) GetContent(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (result String, err error) { +func (client RunbookClient) GetContent(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (result ReadCloser, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, @@ -357,13 +357,12 @@ func (client RunbookClient) GetContentSender(req *http.Request) (*http.Response, // GetContentResponder handles the response to the GetContent request. The method always // closes the http.Response Body. -func (client RunbookClient) GetContentResponder(resp *http.Response) (result String, err error) { +func (client RunbookClient) GetContentResponder(resp *http.Response) (result ReadCloser, err error) { + result.Value = &resp.Body err = autorest.Respond( resp, client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) + azure.WithErrorUnlessStatusCode(http.StatusOK)) result.Response = autorest.Response{Response: resp} return } diff --git a/services/preview/automation/mgmt/2017-05-15-preview/automation/runbookdraft.go b/services/preview/automation/mgmt/2017-05-15-preview/automation/runbookdraft.go index 25e7f2886be2..9de6ca1a79f3 100644 --- a/services/preview/automation/mgmt/2017-05-15-preview/automation/runbookdraft.go +++ b/services/preview/automation/mgmt/2017-05-15-preview/automation/runbookdraft.go @@ -122,7 +122,7 @@ func (client RunbookDraftClient) GetResponder(resp *http.Response) (result Runbo // resourceGroupName - name of an Azure Resource group. // automationAccountName - the name of the automation account. // runbookName - the runbook name. -func (client RunbookDraftClient) GetContent(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (result String, err error) { +func (client RunbookDraftClient) GetContent(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (result ReadCloser, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, @@ -183,13 +183,12 @@ func (client RunbookDraftClient) GetContentSender(req *http.Request) (*http.Resp // GetContentResponder handles the response to the GetContent request. The method always // closes the http.Response Body. -func (client RunbookDraftClient) GetContentResponder(resp *http.Response) (result String, err error) { +func (client RunbookDraftClient) GetContentResponder(resp *http.Response) (result ReadCloser, err error) { + result.Value = &resp.Body err = autorest.Respond( resp, client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) + azure.WithErrorUnlessStatusCode(http.StatusOK)) result.Response = autorest.Response{Response: resp} return } @@ -279,7 +278,7 @@ func (client RunbookDraftClient) PublishResponder(resp *http.Response) (result a // resourceGroupName - name of an Azure Resource group. // automationAccountName - the name of the automation account. // runbookName - the runbook name. -// runbookContent - the runbook draft content. +// runbookContent - the runbook draft content. func (client RunbookDraftClient) ReplaceContent(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string, runbookContent string) (result RunbookDraftReplaceContentFuture, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, @@ -347,7 +346,7 @@ func (client RunbookDraftClient) ReplaceContentSender(req *http.Request) (future // ReplaceContentResponder handles the response to the ReplaceContent request. The method always // closes the http.Response Body. -func (client RunbookDraftClient) ReplaceContentResponder(resp *http.Response) (result String, err error) { +func (client RunbookDraftClient) ReplaceContentResponder(resp *http.Response) (result ReadCloser, err error) { err = autorest.Respond( resp, client.ByInspecting(), diff --git a/services/preview/automation/mgmt/2017-05-15-preview/automation/schedule.go b/services/preview/automation/mgmt/2017-05-15-preview/automation/schedule.go index c6635f076f56..ce73dab64230 100644 --- a/services/preview/automation/mgmt/2017-05-15-preview/automation/schedule.go +++ b/services/preview/automation/mgmt/2017-05-15-preview/automation/schedule.go @@ -117,7 +117,7 @@ func (client ScheduleClient) CreateOrUpdateResponder(resp *http.Response) (resul err = autorest.Respond( resp, client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusConflict), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} diff --git a/services/preview/automation/mgmt/2018-01-preview/automation/connectiontype.go b/services/preview/automation/mgmt/2018-01-preview/automation/connectiontype.go index d4277e164145..2ef94acdf3de 100644 --- a/services/preview/automation/mgmt/2018-01-preview/automation/connectiontype.go +++ b/services/preview/automation/mgmt/2018-01-preview/automation/connectiontype.go @@ -117,7 +117,7 @@ func (client ConnectionTypeClient) CreateOrUpdateResponder(resp *http.Response) err = autorest.Respond( resp, client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusConflict), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} diff --git a/services/preview/automation/mgmt/2018-01-preview/automation/job.go b/services/preview/automation/mgmt/2018-01-preview/automation/job.go index 40f9f057eb56..bf97a45f3be4 100644 --- a/services/preview/automation/mgmt/2018-01-preview/automation/job.go +++ b/services/preview/automation/mgmt/2018-01-preview/automation/job.go @@ -215,7 +215,7 @@ func (client JobClient) GetResponder(resp *http.Response) (result Job, err error // automationAccountName - the name of the automation account. // jobName - the name of the job to be created. // clientRequestID - identifies this specific client request. -func (client JobClient) GetOutput(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, clientRequestID string) (result String, err error) { +func (client JobClient) GetOutput(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, clientRequestID string) (result ReadCloser, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, @@ -280,13 +280,12 @@ func (client JobClient) GetOutputSender(req *http.Request) (*http.Response, erro // GetOutputResponder handles the response to the GetOutput request. The method always // closes the http.Response Body. -func (client JobClient) GetOutputResponder(resp *http.Response) (result String, err error) { +func (client JobClient) GetOutputResponder(resp *http.Response) (result ReadCloser, err error) { + result.Value = &resp.Body err = autorest.Respond( resp, client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) + azure.WithErrorUnlessStatusCode(http.StatusOK)) result.Response = autorest.Response{Response: resp} return } @@ -297,7 +296,7 @@ func (client JobClient) GetOutputResponder(resp *http.Response) (result String, // automationAccountName - the name of the automation account. // jobName - the job name. // clientRequestID - identifies this specific client request. -func (client JobClient) GetRunbookContent(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, clientRequestID string) (result String, err error) { +func (client JobClient) GetRunbookContent(ctx context.Context, resourceGroupName string, automationAccountName string, jobName string, clientRequestID string) (result ReadCloser, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, @@ -362,13 +361,12 @@ func (client JobClient) GetRunbookContentSender(req *http.Request) (*http.Respon // GetRunbookContentResponder handles the response to the GetRunbookContent request. The method always // closes the http.Response Body. -func (client JobClient) GetRunbookContentResponder(resp *http.Response) (result String, err error) { +func (client JobClient) GetRunbookContentResponder(resp *http.Response) (result ReadCloser, err error) { + result.Value = &resp.Body err = autorest.Respond( resp, client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) + azure.WithErrorUnlessStatusCode(http.StatusOK)) result.Response = autorest.Response{Response: resp} return } diff --git a/services/preview/automation/mgmt/2018-01-preview/automation/models.go b/services/preview/automation/mgmt/2018-01-preview/automation/models.go index 30fcbdfae8f0..e9ffe70f2142 100644 --- a/services/preview/automation/mgmt/2018-01-preview/automation/models.go +++ b/services/preview/automation/mgmt/2018-01-preview/automation/models.go @@ -24,6 +24,7 @@ import ( "github.com/Azure/go-autorest/autorest/date" "github.com/Azure/go-autorest/autorest/to" "github.com/satori/go.uuid" + "io" "net/http" ) @@ -6102,6 +6103,12 @@ type ProxyResource struct { Type *string `json:"type,omitempty"` } +// ReadCloser ... +type ReadCloser struct { + autorest.Response `json:"-"` + Value *io.ReadCloser `json:"value,omitempty"` +} + // Resource the core properties of ARM resources type Resource struct { // ID - Fully qualified resource Id for the resource @@ -6440,7 +6447,7 @@ type RunbookDraftReplaceContentFuture struct { // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future *RunbookDraftReplaceContentFuture) Result(client RunbookDraftClient) (s String, err error) { +func (future *RunbookDraftReplaceContentFuture) Result(client RunbookDraftClient) (rc ReadCloser, err error) { var done bool done, err = future.Done(client) if err != nil { @@ -6452,10 +6459,10 @@ func (future *RunbookDraftReplaceContentFuture) Result(client RunbookDraftClient return } sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { - s, err = client.ReplaceContentResponder(s.Response.Response) + if rc.Response.Response, err = future.GetResult(sender); err == nil && rc.Response.Response.StatusCode != http.StatusNoContent { + rc, err = client.ReplaceContentResponder(rc.Response.Response) if err != nil { - err = autorest.NewErrorWithError(err, "automation.RunbookDraftReplaceContentFuture", "Result", s.Response.Response, "Failure responding to request") + err = autorest.NewErrorWithError(err, "automation.RunbookDraftReplaceContentFuture", "Result", rc.Response.Response, "Failure responding to request") } } return diff --git a/services/preview/automation/mgmt/2018-01-preview/automation/runbook.go b/services/preview/automation/mgmt/2018-01-preview/automation/runbook.go index 8add60582b89..fc235beeaad2 100644 --- a/services/preview/automation/mgmt/2018-01-preview/automation/runbook.go +++ b/services/preview/automation/mgmt/2018-01-preview/automation/runbook.go @@ -131,7 +131,7 @@ func (client RunbookClient) CreateOrUpdateResponder(resp *http.Response) (result err = autorest.Respond( resp, client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusBadRequest), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} @@ -296,7 +296,7 @@ func (client RunbookClient) GetResponder(resp *http.Response) (result Runbook, e // resourceGroupName - name of an Azure Resource group. // automationAccountName - the name of the automation account. // runbookName - the runbook name. -func (client RunbookClient) GetContent(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (result String, err error) { +func (client RunbookClient) GetContent(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (result ReadCloser, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, @@ -357,13 +357,12 @@ func (client RunbookClient) GetContentSender(req *http.Request) (*http.Response, // GetContentResponder handles the response to the GetContent request. The method always // closes the http.Response Body. -func (client RunbookClient) GetContentResponder(resp *http.Response) (result String, err error) { +func (client RunbookClient) GetContentResponder(resp *http.Response) (result ReadCloser, err error) { + result.Value = &resp.Body err = autorest.Respond( resp, client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) + azure.WithErrorUnlessStatusCode(http.StatusOK)) result.Response = autorest.Response{Response: resp} return } diff --git a/services/preview/automation/mgmt/2018-01-preview/automation/runbookdraft.go b/services/preview/automation/mgmt/2018-01-preview/automation/runbookdraft.go index 17ae48507214..c566bc58b792 100644 --- a/services/preview/automation/mgmt/2018-01-preview/automation/runbookdraft.go +++ b/services/preview/automation/mgmt/2018-01-preview/automation/runbookdraft.go @@ -122,7 +122,7 @@ func (client RunbookDraftClient) GetResponder(resp *http.Response) (result Runbo // resourceGroupName - name of an Azure Resource group. // automationAccountName - the name of the automation account. // runbookName - the runbook name. -func (client RunbookDraftClient) GetContent(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (result String, err error) { +func (client RunbookDraftClient) GetContent(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string) (result ReadCloser, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, @@ -183,13 +183,12 @@ func (client RunbookDraftClient) GetContentSender(req *http.Request) (*http.Resp // GetContentResponder handles the response to the GetContent request. The method always // closes the http.Response Body. -func (client RunbookDraftClient) GetContentResponder(resp *http.Response) (result String, err error) { +func (client RunbookDraftClient) GetContentResponder(resp *http.Response) (result ReadCloser, err error) { + result.Value = &resp.Body err = autorest.Respond( resp, client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) + azure.WithErrorUnlessStatusCode(http.StatusOK)) result.Response = autorest.Response{Response: resp} return } @@ -279,7 +278,7 @@ func (client RunbookDraftClient) PublishResponder(resp *http.Response) (result a // resourceGroupName - name of an Azure Resource group. // automationAccountName - the name of the automation account. // runbookName - the runbook name. -// runbookContent - the runbook draft content. +// runbookContent - the runbook draft content. func (client RunbookDraftClient) ReplaceContent(ctx context.Context, resourceGroupName string, automationAccountName string, runbookName string, runbookContent string) (result RunbookDraftReplaceContentFuture, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, @@ -347,7 +346,7 @@ func (client RunbookDraftClient) ReplaceContentSender(req *http.Request) (future // ReplaceContentResponder handles the response to the ReplaceContent request. The method always // closes the http.Response Body. -func (client RunbookDraftClient) ReplaceContentResponder(resp *http.Response) (result String, err error) { +func (client RunbookDraftClient) ReplaceContentResponder(resp *http.Response) (result ReadCloser, err error) { err = autorest.Respond( resp, client.ByInspecting(), diff --git a/services/preview/automation/mgmt/2018-01-preview/automation/schedule.go b/services/preview/automation/mgmt/2018-01-preview/automation/schedule.go index 8856aaa45182..2bedc00d1720 100644 --- a/services/preview/automation/mgmt/2018-01-preview/automation/schedule.go +++ b/services/preview/automation/mgmt/2018-01-preview/automation/schedule.go @@ -117,7 +117,7 @@ func (client ScheduleClient) CreateOrUpdateResponder(resp *http.Response) (resul err = autorest.Respond( resp, client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusConflict), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp}