From f293a3a97b9c768bfe5fdbab6688c0b42524c3a6 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Thu, 5 Sep 2019 00:17:20 +0000 Subject: [PATCH 1/7] Generated from f53e343cf92770b37b319e7ca9f8b7b17b7066c3 taskrun RP --- .../containerregistryapi/models.go | 1 + .../mgmt/containerregistry/models.go | 22 + .../containerregistryapi/interfaces.go | 11 + .../containerregistry/models.go | 429 ++++++++++++++ .../containerregistry/taskruns.go | 527 ++++++++++++++++++ 5 files changed, 990 insertions(+) create mode 100644 services/containerregistry/mgmt/2019-06-01-preview/containerregistry/taskruns.go diff --git a/profiles/preview/containerregistry/mgmt/containerregistry/containerregistryapi/models.go b/profiles/preview/containerregistry/mgmt/containerregistry/containerregistryapi/models.go index 976f96f6266c..977f09cd4e19 100644 --- a/profiles/preview/containerregistry/mgmt/containerregistry/containerregistryapi/models.go +++ b/profiles/preview/containerregistry/mgmt/containerregistry/containerregistryapi/models.go @@ -25,5 +25,6 @@ type OperationsClientAPI = original.OperationsClientAPI type RegistriesClientAPI = original.RegistriesClientAPI type ReplicationsClientAPI = original.ReplicationsClientAPI type RunsClientAPI = original.RunsClientAPI +type TaskRunsClientAPI = original.TaskRunsClientAPI type TasksClientAPI = original.TasksClientAPI type WebhooksClientAPI = original.WebhooksClientAPI diff --git a/profiles/preview/containerregistry/mgmt/containerregistry/models.go b/profiles/preview/containerregistry/mgmt/containerregistry/models.go index dbe09e21f9ce..fdec1eafdd0c 100644 --- a/profiles/preview/containerregistry/mgmt/containerregistry/models.go +++ b/profiles/preview/containerregistry/mgmt/containerregistry/models.go @@ -396,7 +396,17 @@ type TaskListResultIterator = original.TaskListResultIterator type TaskListResultPage = original.TaskListResultPage type TaskProperties = original.TaskProperties type TaskPropertiesUpdateParameters = original.TaskPropertiesUpdateParameters +type TaskRun = original.TaskRun +type TaskRunListResult = original.TaskRunListResult +type TaskRunListResultIterator = original.TaskRunListResultIterator +type TaskRunListResultPage = original.TaskRunListResultPage +type TaskRunProperties = original.TaskRunProperties type TaskRunRequest = original.TaskRunRequest +type TaskRunUpdateParameters = original.TaskRunUpdateParameters +type TaskRunsClient = original.TaskRunsClient +type TaskRunsCreateFuture = original.TaskRunsCreateFuture +type TaskRunsDeleteFuture = original.TaskRunsDeleteFuture +type TaskRunsUpdateFuture = original.TaskRunsUpdateFuture type TaskStepProperties = original.TaskStepProperties type TaskStepUpdateParameters = original.TaskStepUpdateParameters type TaskUpdateParameters = original.TaskUpdateParameters @@ -489,6 +499,18 @@ func NewTaskListResultIterator(page TaskListResultPage) TaskListResultIterator { func NewTaskListResultPage(getNextPage func(context.Context, TaskListResult) (TaskListResult, error)) TaskListResultPage { return original.NewTaskListResultPage(getNextPage) } +func NewTaskRunListResultIterator(page TaskRunListResultPage) TaskRunListResultIterator { + return original.NewTaskRunListResultIterator(page) +} +func NewTaskRunListResultPage(getNextPage func(context.Context, TaskRunListResult) (TaskRunListResult, error)) TaskRunListResultPage { + return original.NewTaskRunListResultPage(getNextPage) +} +func NewTaskRunsClient(subscriptionID string) TaskRunsClient { + return original.NewTaskRunsClient(subscriptionID) +} +func NewTaskRunsClientWithBaseURI(baseURI string, subscriptionID string) TaskRunsClient { + return original.NewTaskRunsClientWithBaseURI(baseURI, subscriptionID) +} func NewTasksClient(subscriptionID string) TasksClient { return original.NewTasksClient(subscriptionID) } diff --git a/services/containerregistry/mgmt/2019-06-01-preview/containerregistry/containerregistryapi/interfaces.go b/services/containerregistry/mgmt/2019-06-01-preview/containerregistry/containerregistryapi/interfaces.go index 8a80b2ae34d6..0a67c6e547f5 100644 --- a/services/containerregistry/mgmt/2019-06-01-preview/containerregistry/containerregistryapi/interfaces.go +++ b/services/containerregistry/mgmt/2019-06-01-preview/containerregistry/containerregistryapi/interfaces.go @@ -84,6 +84,17 @@ type RunsClientAPI interface { var _ RunsClientAPI = (*containerregistry.RunsClient)(nil) +// TaskRunsClientAPI contains the set of methods on the TaskRunsClient type. +type TaskRunsClientAPI interface { + Create(ctx context.Context, resourceGroupName string, registryName string, taskRunName string, taskRun containerregistry.TaskRun) (result containerregistry.TaskRunsCreateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, registryName string, taskRunName string) (result containerregistry.TaskRunsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, registryName string, taskRunName string) (result containerregistry.TaskRun, err error) + List(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.TaskRunListResultPage, err error) + Update(ctx context.Context, resourceGroupName string, registryName string, taskRunName string, updateParameters containerregistry.TaskRunUpdateParameters) (result containerregistry.TaskRunsUpdateFuture, err error) +} + +var _ TaskRunsClientAPI = (*containerregistry.TaskRunsClient)(nil) + // TasksClientAPI contains the set of methods on the TasksClient type. type TasksClientAPI interface { Create(ctx context.Context, resourceGroupName string, registryName string, taskName string, taskCreateParameters containerregistry.Task) (result containerregistry.TasksCreateFuture, err error) diff --git a/services/containerregistry/mgmt/2019-06-01-preview/containerregistry/models.go b/services/containerregistry/mgmt/2019-06-01-preview/containerregistry/models.go index f3c40cb85d90..86cbcd59eb42 100644 --- a/services/containerregistry/mgmt/2019-06-01-preview/containerregistry/models.go +++ b/services/containerregistry/mgmt/2019-06-01-preview/containerregistry/models.go @@ -3153,6 +3153,8 @@ type RunFilter struct { RunID *string `json:"runId,omitempty"` // RunType - The type of run. Possible values include: 'QuickBuild', 'QuickRun', 'AutoBuild', 'AutoRun' RunType RunType `json:"runType,omitempty"` + // TaskRunName - The name of task run associated with this run. + TaskRunName *string `json:"taskRunName,omitempty"` // Status - The current status of the run. Possible values include: 'RunStatusQueued', 'RunStatusStarted', 'RunStatusRunning', 'RunStatusSucceeded', 'RunStatusFailed', 'RunStatusCanceled', 'RunStatusError', 'RunStatusTimeout' Status RunStatus `json:"status,omitempty"` // CreateTime - The create time for a run. @@ -4166,6 +4168,295 @@ func (tpup *TaskPropertiesUpdateParameters) UnmarshalJSON(body []byte) error { return nil } +// TaskRun ... +type TaskRun struct { + autorest.Response `json:"-"` + // Identity - Identity for the resource. + Identity *IdentityProperties `json:"identity,omitempty"` + *TaskRunProperties `json:"properties,omitempty"` + RunRequest BasicRunRequest `json:"runRequest,omitempty"` + RunResult *Run `json:"runResult,omitempty"` + // ID - READ-ONLY; The resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + // Location - The location of the resource. This cannot be changed after the resource is created. + Location *string `json:"location,omitempty"` + // Tags - The tags of the resource. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for TaskRun. +func (tr TaskRun) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tr.Identity != nil { + objectMap["identity"] = tr.Identity + } + if tr.TaskRunProperties != nil { + objectMap["properties"] = tr.TaskRunProperties + } + objectMap["runRequest"] = tr.RunRequest + if tr.RunResult != nil { + objectMap["runResult"] = tr.RunResult + } + if tr.Location != nil { + objectMap["location"] = tr.Location + } + if tr.Tags != nil { + objectMap["tags"] = tr.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for TaskRun struct. +func (tr *TaskRun) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "identity": + if v != nil { + var identity IdentityProperties + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + tr.Identity = &identity + } + case "properties": + if v != nil { + var taskRunProperties TaskRunProperties + err = json.Unmarshal(*v, &taskRunProperties) + if err != nil { + return err + } + tr.TaskRunProperties = &taskRunProperties + } + case "runRequest": + if v != nil { + runRequest, err := unmarshalBasicRunRequest(*v) + if err != nil { + return err + } + tr.RunRequest = runRequest + } + case "runResult": + if v != nil { + var runResult Run + err = json.Unmarshal(*v, &runResult) + if err != nil { + return err + } + tr.RunResult = &runResult + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + tr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + tr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + tr.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + tr.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + tr.Tags = tags + } + } + } + + return nil +} + +// TaskRunListResult ... +type TaskRunListResult struct { + autorest.Response `json:"-"` + // Value - The collection value. + Value *[]TaskRun `json:"value,omitempty"` + // NextLink - The URI that can be used to request the next set of paged results. + NextLink *string `json:"nextLink,omitempty"` +} + +// TaskRunListResultIterator provides access to a complete listing of TaskRun values. +type TaskRunListResultIterator struct { + i int + page TaskRunListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *TaskRunListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TaskRunListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *TaskRunListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter TaskRunListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter TaskRunListResultIterator) Response() TaskRunListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter TaskRunListResultIterator) Value() TaskRun { + if !iter.page.NotDone() { + return TaskRun{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the TaskRunListResultIterator type. +func NewTaskRunListResultIterator(page TaskRunListResultPage) TaskRunListResultIterator { + return TaskRunListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (trlr TaskRunListResult) IsEmpty() bool { + return trlr.Value == nil || len(*trlr.Value) == 0 +} + +// taskRunListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (trlr TaskRunListResult) taskRunListResultPreparer(ctx context.Context) (*http.Request, error) { + if trlr.NextLink == nil || len(to.String(trlr.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(trlr.NextLink))) +} + +// TaskRunListResultPage contains a page of TaskRun values. +type TaskRunListResultPage struct { + fn func(context.Context, TaskRunListResult) (TaskRunListResult, error) + trlr TaskRunListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *TaskRunListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TaskRunListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + next, err := page.fn(ctx, page.trlr) + if err != nil { + return err + } + page.trlr = next + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *TaskRunListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page TaskRunListResultPage) NotDone() bool { + return !page.trlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page TaskRunListResultPage) Response() TaskRunListResult { + return page.trlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page TaskRunListResultPage) Values() []TaskRun { + if page.trlr.IsEmpty() { + return nil + } + return *page.trlr.Value +} + +// Creates a new instance of the TaskRunListResultPage type. +func NewTaskRunListResultPage(getNextPage func(context.Context, TaskRunListResult) (TaskRunListResult, error)) TaskRunListResultPage { + return TaskRunListResultPage{fn: getNextPage} +} + +// TaskRunProperties ... +type TaskRunProperties struct { + // ProvisioningState - READ-ONLY; Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + // TaskRunRequest the parameters for a task run request. type TaskRunRequest struct { // TaskID - The resource ID of task against which run has to be queued. @@ -4227,6 +4518,144 @@ func (trr TaskRunRequest) AsBasicRunRequest() (BasicRunRequest, bool) { return &trr, true } +// TaskRunsCreateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type TaskRunsCreateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *TaskRunsCreateFuture) Result(client TaskRunsClient) (tr TaskRun, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsCreateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("containerregistry.TaskRunsCreateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if tr.Response.Response, err = future.GetResult(sender); err == nil && tr.Response.Response.StatusCode != http.StatusNoContent { + tr, err = client.CreateResponder(tr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsCreateFuture", "Result", tr.Response.Response, "Failure responding to request") + } + } + return +} + +// TaskRunsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type TaskRunsDeleteFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *TaskRunsDeleteFuture) Result(client TaskRunsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("containerregistry.TaskRunsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// TaskRunsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type TaskRunsUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *TaskRunsUpdateFuture) Result(client TaskRunsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("containerregistry.TaskRunsUpdateFuture") + return + } + ar.Response = future.Response() + return +} + +// TaskRunUpdateParameters ... +type TaskRunUpdateParameters struct { + // Identity - Identity for the resource. + Identity *IdentityProperties `json:"identity,omitempty"` + RunRequest BasicRunRequest `json:"runRequest,omitempty"` + // Tags - The ARM resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for TaskRunUpdateParameters. +func (trup TaskRunUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if trup.Identity != nil { + objectMap["identity"] = trup.Identity + } + objectMap["runRequest"] = trup.RunRequest + if trup.Tags != nil { + objectMap["tags"] = trup.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for TaskRunUpdateParameters struct. +func (trup *TaskRunUpdateParameters) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "identity": + if v != nil { + var identity IdentityProperties + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + trup.Identity = &identity + } + case "runRequest": + if v != nil { + runRequest, err := unmarshalBasicRunRequest(*v) + if err != nil { + return err + } + trup.RunRequest = runRequest + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + trup.Tags = tags + } + } + } + + return nil +} + // TasksCreateFuture an abstraction for monitoring and retrieving the results of a long-running operation. type TasksCreateFuture struct { azure.Future diff --git a/services/containerregistry/mgmt/2019-06-01-preview/containerregistry/taskruns.go b/services/containerregistry/mgmt/2019-06-01-preview/containerregistry/taskruns.go new file mode 100644 index 000000000000..9711645fe11a --- /dev/null +++ b/services/containerregistry/mgmt/2019-06-01-preview/containerregistry/taskruns.go @@ -0,0 +1,527 @@ +package containerregistry + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// TaskRunsClient is the client for the TaskRuns methods of the Containerregistry service. +type TaskRunsClient struct { + BaseClient +} + +// NewTaskRunsClient creates an instance of the TaskRunsClient client. +func NewTaskRunsClient(subscriptionID string) TaskRunsClient { + return NewTaskRunsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewTaskRunsClientWithBaseURI creates an instance of the TaskRunsClient client. +func NewTaskRunsClientWithBaseURI(baseURI string, subscriptionID string) TaskRunsClient { + return TaskRunsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create creates a run request for a container registry with the specified parameters. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +// taskRunName - the name of task run. +// taskRun - the parameters of a run that needs to scheduled. +func (client TaskRunsClient) Create(ctx context.Context, resourceGroupName string, registryName string, taskRunName string, taskRun TaskRun) (result TaskRunsCreateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TaskRunsClient.Create") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.TaskRunsClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, registryName, taskRunName, taskRun) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "Create", nil, "Failure preparing request") + return + } + + result, err = client.CreateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "Create", result.Response(), "Failure sending request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client TaskRunsClient) CreatePreparer(ctx context.Context, resourceGroupName string, registryName string, taskRunName string, taskRun TaskRun) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "registryName": autorest.Encode("path", registryName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "taskRunName": autorest.Encode("path", taskRunName), + } + + const APIVersion = "2019-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/taskRuns/{taskRunName}", pathParameters), + autorest.WithJSON(taskRun), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client TaskRunsClient) CreateSender(req *http.Request) (future TaskRunsCreateFuture, err error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, sd...) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client TaskRunsClient) CreateResponder(resp *http.Response) (result TaskRun, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a specified TaskRun resource. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +// taskRunName - the Run Request name. +func (client TaskRunsClient) Delete(ctx context.Context, resourceGroupName string, registryName string, taskRunName string) (result TaskRunsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TaskRunsClient.Delete") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.TaskRunsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, registryName, taskRunName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client TaskRunsClient) DeletePreparer(ctx context.Context, resourceGroupName string, registryName string, taskRunName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "registryName": autorest.Encode("path", registryName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "taskRunName": autorest.Encode("path", taskRunName), + } + + const APIVersion = "2019-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/taskRuns/{taskRunName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client TaskRunsClient) DeleteSender(req *http.Request) (future TaskRunsDeleteFuture, err error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, sd...) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client TaskRunsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the detailed information for a given run request. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +// taskRunName - the run request name. +func (client TaskRunsClient) Get(ctx context.Context, resourceGroupName string, registryName string, taskRunName string) (result TaskRun, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TaskRunsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.TaskRunsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, registryName, taskRunName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client TaskRunsClient) GetPreparer(ctx context.Context, resourceGroupName string, registryName string, taskRunName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "registryName": autorest.Encode("path", registryName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "taskRunName": autorest.Encode("path", taskRunName), + } + + const APIVersion = "2019-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/taskRuns/{taskRunName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client TaskRunsClient) GetSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client TaskRunsClient) GetResponder(resp *http.Response) (result TaskRun, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists all the task runs for a specified container registry. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +func (client TaskRunsClient) List(ctx context.Context, resourceGroupName string, registryName string) (result TaskRunListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TaskRunsClient.List") + defer func() { + sc := -1 + if result.trlr.Response.Response != nil { + sc = result.trlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.TaskRunsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, registryName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.trlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "List", resp, "Failure sending request") + return + } + + result.trlr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client TaskRunsClient) ListPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "registryName": autorest.Encode("path", registryName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/taskRuns", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client TaskRunsClient) ListSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client TaskRunsClient) ListResponder(resp *http.Response) (result TaskRunListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client TaskRunsClient) listNextResults(ctx context.Context, lastResults TaskRunListResult) (result TaskRunListResult, err error) { + req, err := lastResults.taskRunListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client TaskRunsClient) ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result TaskRunListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TaskRunsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, registryName) + return +} + +// Update updates a task run with the specified parameters. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +// taskRunName - the run request name. +// updateParameters - the parameters for updating a task run. +func (client TaskRunsClient) Update(ctx context.Context, resourceGroupName string, registryName string, taskRunName string, updateParameters TaskRunUpdateParameters) (result TaskRunsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TaskRunsClient.Update") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.TaskRunsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, registryName, taskRunName, updateParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client TaskRunsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, registryName string, taskRunName string, updateParameters TaskRunUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "registryName": autorest.Encode("path", registryName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "taskRunName": autorest.Encode("path", taskRunName), + } + + const APIVersion = "2019-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/taskRuns/{taskRunName}", pathParameters), + autorest.WithJSON(updateParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client TaskRunsClient) UpdateSender(req *http.Request) (future TaskRunsUpdateFuture, err error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, sd...) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client TaskRunsClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} From 0889fb2d5186fc58744776a9b426d0393a35aa83 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Fri, 6 Sep 2019 17:44:32 +0000 Subject: [PATCH 2/7] Generated from 19d11d906a3ab8b121955c72681e8a15aedbfde4 update samples --- .../mgmt/containerregistry/models.go | 1 + .../containerregistry/models.go | 111 +++++++++++++----- 2 files changed, 83 insertions(+), 29 deletions(-) diff --git a/profiles/preview/containerregistry/mgmt/containerregistry/models.go b/profiles/preview/containerregistry/mgmt/containerregistry/models.go index fdec1eafdd0c..1d807a5d2dad 100644 --- a/profiles/preview/containerregistry/mgmt/containerregistry/models.go +++ b/profiles/preview/containerregistry/mgmt/containerregistry/models.go @@ -401,6 +401,7 @@ type TaskRunListResult = original.TaskRunListResult type TaskRunListResultIterator = original.TaskRunListResultIterator type TaskRunListResultPage = original.TaskRunListResultPage type TaskRunProperties = original.TaskRunProperties +type TaskRunPropertiesUpdateParameters = original.TaskRunPropertiesUpdateParameters type TaskRunRequest = original.TaskRunRequest type TaskRunUpdateParameters = original.TaskRunUpdateParameters type TaskRunsClient = original.TaskRunsClient diff --git a/services/containerregistry/mgmt/2019-06-01-preview/containerregistry/models.go b/services/containerregistry/mgmt/2019-06-01-preview/containerregistry/models.go index 86cbcd59eb42..9797e975b93b 100644 --- a/services/containerregistry/mgmt/2019-06-01-preview/containerregistry/models.go +++ b/services/containerregistry/mgmt/2019-06-01-preview/containerregistry/models.go @@ -4174,8 +4174,6 @@ type TaskRun struct { // Identity - Identity for the resource. Identity *IdentityProperties `json:"identity,omitempty"` *TaskRunProperties `json:"properties,omitempty"` - RunRequest BasicRunRequest `json:"runRequest,omitempty"` - RunResult *Run `json:"runResult,omitempty"` // ID - READ-ONLY; The resource ID. ID *string `json:"id,omitempty"` // Name - READ-ONLY; The name of the resource. @@ -4197,10 +4195,6 @@ func (tr TaskRun) MarshalJSON() ([]byte, error) { if tr.TaskRunProperties != nil { objectMap["properties"] = tr.TaskRunProperties } - objectMap["runRequest"] = tr.RunRequest - if tr.RunResult != nil { - objectMap["runResult"] = tr.RunResult - } if tr.Location != nil { objectMap["location"] = tr.Location } @@ -4237,23 +4231,6 @@ func (tr *TaskRun) UnmarshalJSON(body []byte) error { } tr.TaskRunProperties = &taskRunProperties } - case "runRequest": - if v != nil { - runRequest, err := unmarshalBasicRunRequest(*v) - if err != nil { - return err - } - tr.RunRequest = runRequest - } - case "runResult": - if v != nil { - var runResult Run - err = json.Unmarshal(*v, &runResult) - if err != nil { - return err - } - tr.RunResult = &runResult - } case "id": if v != nil { var ID string @@ -4455,6 +4432,78 @@ func NewTaskRunListResultPage(getNextPage func(context.Context, TaskRunListResul type TaskRunProperties struct { // ProvisioningState - READ-ONLY; Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled' ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + RunRequest BasicRunRequest `json:"runRequest,omitempty"` + // RunResult - READ-ONLY + RunResult *Run `json:"runResult,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for TaskRunProperties struct. +func (trp *TaskRunProperties) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "provisioningState": + if v != nil { + var provisioningState ProvisioningState + err = json.Unmarshal(*v, &provisioningState) + if err != nil { + return err + } + trp.ProvisioningState = provisioningState + } + case "runRequest": + if v != nil { + runRequest, err := unmarshalBasicRunRequest(*v) + if err != nil { + return err + } + trp.RunRequest = runRequest + } + case "runResult": + if v != nil { + var runResult Run + err = json.Unmarshal(*v, &runResult) + if err != nil { + return err + } + trp.RunResult = &runResult + } + } + } + + return nil +} + +// TaskRunPropertiesUpdateParameters ... +type TaskRunPropertiesUpdateParameters struct { + RunRequest BasicRunRequest `json:"runRequest,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for TaskRunPropertiesUpdateParameters struct. +func (trpup *TaskRunPropertiesUpdateParameters) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "runRequest": + if v != nil { + runRequest, err := unmarshalBasicRunRequest(*v) + if err != nil { + return err + } + trpup.RunRequest = runRequest + } + } + } + + return nil } // TaskRunRequest the parameters for a task run request. @@ -4596,8 +4645,9 @@ func (future *TaskRunsUpdateFuture) Result(client TaskRunsClient) (ar autorest.R // TaskRunUpdateParameters ... type TaskRunUpdateParameters struct { // Identity - Identity for the resource. - Identity *IdentityProperties `json:"identity,omitempty"` - RunRequest BasicRunRequest `json:"runRequest,omitempty"` + Identity *IdentityProperties `json:"identity,omitempty"` + // TaskRunPropertiesUpdateParameters - The properties for updating a taskrun. + *TaskRunPropertiesUpdateParameters `json:"properties,omitempty"` // Tags - The ARM resource tags. Tags map[string]*string `json:"tags"` } @@ -4608,7 +4658,9 @@ func (trup TaskRunUpdateParameters) MarshalJSON() ([]byte, error) { if trup.Identity != nil { objectMap["identity"] = trup.Identity } - objectMap["runRequest"] = trup.RunRequest + if trup.TaskRunPropertiesUpdateParameters != nil { + objectMap["properties"] = trup.TaskRunPropertiesUpdateParameters + } if trup.Tags != nil { objectMap["tags"] = trup.Tags } @@ -4633,13 +4685,14 @@ func (trup *TaskRunUpdateParameters) UnmarshalJSON(body []byte) error { } trup.Identity = &identity } - case "runRequest": + case "properties": if v != nil { - runRequest, err := unmarshalBasicRunRequest(*v) + var taskRunPropertiesUpdateParameters TaskRunPropertiesUpdateParameters + err = json.Unmarshal(*v, &taskRunPropertiesUpdateParameters) if err != nil { return err } - trup.RunRequest = runRequest + trup.TaskRunPropertiesUpdateParameters = &taskRunPropertiesUpdateParameters } case "tags": if v != nil { From 7661a6bac895b672a99abd983f2b4731fe7abd1a Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Fri, 6 Sep 2019 18:37:36 +0000 Subject: [PATCH 3/7] Generated from fdd35f9dea26eb927e39f8ead818afa55bf149f4 update description --- .../containerregistry/models.go | 22 +++++++++++-------- .../containerregistry/taskruns.go | 2 +- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/services/containerregistry/mgmt/2019-06-01-preview/containerregistry/models.go b/services/containerregistry/mgmt/2019-06-01-preview/containerregistry/models.go index 9797e975b93b..d32bc66fe627 100644 --- a/services/containerregistry/mgmt/2019-06-01-preview/containerregistry/models.go +++ b/services/containerregistry/mgmt/2019-06-01-preview/containerregistry/models.go @@ -4168,11 +4168,13 @@ func (tpup *TaskPropertiesUpdateParameters) UnmarshalJSON(body []byte) error { return nil } -// TaskRun ... +// TaskRun the taskrun that has the ARM resource and taskrun properties. +// The taskrun will have the information of request and result of a run. type TaskRun struct { autorest.Response `json:"-"` // Identity - Identity for the resource. - Identity *IdentityProperties `json:"identity,omitempty"` + Identity *IdentityProperties `json:"identity,omitempty"` + // TaskRunProperties - The properties associated with the taskrun, i.e., request and result of the run *TaskRunProperties `json:"properties,omitempty"` // ID - READ-ONLY; The resource ID. ID *string `json:"id,omitempty"` @@ -4282,7 +4284,7 @@ func (tr *TaskRun) UnmarshalJSON(body []byte) error { return nil } -// TaskRunListResult ... +// TaskRunListResult the collection of taskruns. type TaskRunListResult struct { autorest.Response `json:"-"` // Value - The collection value. @@ -4428,12 +4430,13 @@ func NewTaskRunListResultPage(getNextPage func(context.Context, TaskRunListResul return TaskRunListResultPage{fn: getNextPage} } -// TaskRunProperties ... +// TaskRunProperties the properties of a taskrun. type TaskRunProperties struct { - // ProvisioningState - READ-ONLY; Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled' + // ProvisioningState - READ-ONLY; The privisioning state of this taskrun. Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled' ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - RunRequest BasicRunRequest `json:"runRequest,omitempty"` - // RunResult - READ-ONLY + // RunRequest - The request (parameters) for the run + RunRequest BasicRunRequest `json:"runRequest,omitempty"` + // RunResult - READ-ONLY; The run result of this taskrun RunResult *Run `json:"runResult,omitempty"` } @@ -4478,8 +4481,9 @@ func (trp *TaskRunProperties) UnmarshalJSON(body []byte) error { return nil } -// TaskRunPropertiesUpdateParameters ... +// TaskRunPropertiesUpdateParameters the properties of a taskrun update parameters. type TaskRunPropertiesUpdateParameters struct { + // RunRequest - The request (parameters) for the new run RunRequest BasicRunRequest `json:"runRequest,omitempty"` } @@ -4642,7 +4646,7 @@ func (future *TaskRunsUpdateFuture) Result(client TaskRunsClient) (ar autorest.R return } -// TaskRunUpdateParameters ... +// TaskRunUpdateParameters the parameters for updating a taskrun. type TaskRunUpdateParameters struct { // Identity - Identity for the resource. Identity *IdentityProperties `json:"identity,omitempty"` diff --git a/services/containerregistry/mgmt/2019-06-01-preview/containerregistry/taskruns.go b/services/containerregistry/mgmt/2019-06-01-preview/containerregistry/taskruns.go index 9711645fe11a..e3e5efaf2e78 100644 --- a/services/containerregistry/mgmt/2019-06-01-preview/containerregistry/taskruns.go +++ b/services/containerregistry/mgmt/2019-06-01-preview/containerregistry/taskruns.go @@ -520,7 +520,7 @@ func (client TaskRunsClient) UpdateResponder(resp *http.Response) (result autore err = autorest.Respond( resp, client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), autorest.ByClosing()) result.Response = resp return From b6184fc464fb74db71d34e6636b65147f5564c6e Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Fri, 6 Sep 2019 21:41:53 +0000 Subject: [PATCH 4/7] Generated from e6ce2ce008f731fd3a0c67663ce3480169523dd7 update tags --- .../containerregistry/models.go | 18 ++++++++++++------ .../containerregistry/taskruns.go | 7 ++++--- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/services/containerregistry/mgmt/2019-06-01-preview/containerregistry/models.go b/services/containerregistry/mgmt/2019-06-01-preview/containerregistry/models.go index d32bc66fe627..9626384fe2ec 100644 --- a/services/containerregistry/mgmt/2019-06-01-preview/containerregistry/models.go +++ b/services/containerregistry/mgmt/2019-06-01-preview/containerregistry/models.go @@ -4168,8 +4168,8 @@ func (tpup *TaskPropertiesUpdateParameters) UnmarshalJSON(body []byte) error { return nil } -// TaskRun the taskrun that has the ARM resource and taskrun properties. -// The taskrun will have the information of request and result of a run. +// TaskRun the task run that has the ARM resource and properties. +// The task run will have the information of request and result of a run. type TaskRun struct { autorest.Response `json:"-"` // Identity - Identity for the resource. @@ -4430,13 +4430,13 @@ func NewTaskRunListResultPage(getNextPage func(context.Context, TaskRunListResul return TaskRunListResultPage{fn: getNextPage} } -// TaskRunProperties the properties of a taskrun. +// TaskRunProperties the properties of task run. type TaskRunProperties struct { // ProvisioningState - READ-ONLY; The privisioning state of this taskrun. Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled' ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` // RunRequest - The request (parameters) for the run RunRequest BasicRunRequest `json:"runRequest,omitempty"` - // RunResult - READ-ONLY; The run result of this taskrun + // RunResult - READ-ONLY; The result of this task run RunResult *Run `json:"runResult,omitempty"` } @@ -4631,7 +4631,7 @@ type TaskRunsUpdateFuture struct { // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future *TaskRunsUpdateFuture) Result(client TaskRunsClient) (ar autorest.Response, err error) { +func (future *TaskRunsUpdateFuture) Result(client TaskRunsClient) (tr TaskRun, err error) { var done bool done, err = future.DoneWithContext(context.Background(), client) if err != nil { @@ -4642,7 +4642,13 @@ func (future *TaskRunsUpdateFuture) Result(client TaskRunsClient) (ar autorest.R err = azure.NewAsyncOpIncompleteError("containerregistry.TaskRunsUpdateFuture") return } - ar.Response = future.Response() + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if tr.Response.Response, err = future.GetResult(sender); err == nil && tr.Response.Response.StatusCode != http.StatusNoContent { + tr, err = client.UpdateResponder(tr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsUpdateFuture", "Result", tr.Response.Response, "Failure responding to request") + } + } return } diff --git a/services/containerregistry/mgmt/2019-06-01-preview/containerregistry/taskruns.go b/services/containerregistry/mgmt/2019-06-01-preview/containerregistry/taskruns.go index e3e5efaf2e78..7b6fc92a08f6 100644 --- a/services/containerregistry/mgmt/2019-06-01-preview/containerregistry/taskruns.go +++ b/services/containerregistry/mgmt/2019-06-01-preview/containerregistry/taskruns.go @@ -439,7 +439,7 @@ func (client TaskRunsClient) ListComplete(ctx context.Context, resourceGroupName // Parameters: // resourceGroupName - the name of the resource group to which the container registry belongs. // registryName - the name of the container registry. -// taskRunName - the run request name. +// taskRunName - the task run name. // updateParameters - the parameters for updating a task run. func (client TaskRunsClient) Update(ctx context.Context, resourceGroupName string, registryName string, taskRunName string, updateParameters TaskRunUpdateParameters) (result TaskRunsUpdateFuture, err error) { if tracing.IsEnabled() { @@ -516,12 +516,13 @@ func (client TaskRunsClient) UpdateSender(req *http.Request) (future TaskRunsUpd // UpdateResponder handles the response to the Update request. The method always // closes the http.Response Body. -func (client TaskRunsClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { +func (client TaskRunsClient) UpdateResponder(resp *http.Response) (result TaskRun, err error) { err = autorest.Respond( resp, client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) - result.Response = resp + result.Response = autorest.Response{Response: resp} return } From 3fc099f0fa2e8b2a876a5005176f30da8d8eb085 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Fri, 6 Sep 2019 22:45:12 +0000 Subject: [PATCH 5/7] Generated from 3017256a111f085cc5b537b413bdc106e7bfa444 update description --- .../mgmt/2019-06-01-preview/containerregistry/taskruns.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/services/containerregistry/mgmt/2019-06-01-preview/containerregistry/taskruns.go b/services/containerregistry/mgmt/2019-06-01-preview/containerregistry/taskruns.go index 7b6fc92a08f6..784174b4bec8 100644 --- a/services/containerregistry/mgmt/2019-06-01-preview/containerregistry/taskruns.go +++ b/services/containerregistry/mgmt/2019-06-01-preview/containerregistry/taskruns.go @@ -41,7 +41,7 @@ func NewTaskRunsClientWithBaseURI(baseURI string, subscriptionID string) TaskRun return TaskRunsClient{NewWithBaseURI(baseURI, subscriptionID)} } -// Create creates a run request for a container registry with the specified parameters. +// Create creates a task run for a container registry with the specified parameters. // Parameters: // resourceGroupName - the name of the resource group to which the container registry belongs. // registryName - the name of the container registry. @@ -133,11 +133,11 @@ func (client TaskRunsClient) CreateResponder(resp *http.Response) (result TaskRu return } -// Delete deletes a specified TaskRun resource. +// Delete deletes a specified task run resource. // Parameters: // resourceGroupName - the name of the resource group to which the container registry belongs. // registryName - the name of the container registry. -// taskRunName - the Run Request name. +// taskRunName - the task run name. func (client TaskRunsClient) Delete(ctx context.Context, resourceGroupName string, registryName string, taskRunName string) (result TaskRunsDeleteFuture, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/TaskRunsClient.Delete") @@ -221,7 +221,7 @@ func (client TaskRunsClient) DeleteResponder(resp *http.Response) (result autore return } -// Get gets the detailed information for a given run request. +// Get gets the detailed information for a given task run. // Parameters: // resourceGroupName - the name of the resource group to which the container registry belongs. // registryName - the name of the container registry. From 528a79fa38984d0b97f047530f3a26604d5b1d43 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Fri, 6 Sep 2019 23:56:21 +0000 Subject: [PATCH 6/7] Generated from 06c9759803f49d9e9a2a3c25154bfbbfe5e23f6f fix typo --- .../mgmt/2019-06-01-preview/containerregistry/models.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/containerregistry/mgmt/2019-06-01-preview/containerregistry/models.go b/services/containerregistry/mgmt/2019-06-01-preview/containerregistry/models.go index 9626384fe2ec..8a8b73bbb169 100644 --- a/services/containerregistry/mgmt/2019-06-01-preview/containerregistry/models.go +++ b/services/containerregistry/mgmt/2019-06-01-preview/containerregistry/models.go @@ -4432,7 +4432,7 @@ func NewTaskRunListResultPage(getNextPage func(context.Context, TaskRunListResul // TaskRunProperties the properties of task run. type TaskRunProperties struct { - // ProvisioningState - READ-ONLY; The privisioning state of this taskrun. Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled' + // ProvisioningState - READ-ONLY; The provisioning state of this task run. Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled' ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` // RunRequest - The request (parameters) for the run RunRequest BasicRunRequest `json:"runRequest,omitempty"` @@ -4652,7 +4652,7 @@ func (future *TaskRunsUpdateFuture) Result(client TaskRunsClient) (tr TaskRun, e return } -// TaskRunUpdateParameters the parameters for updating a taskrun. +// TaskRunUpdateParameters the parameters for updating a task run. type TaskRunUpdateParameters struct { // Identity - Identity for the resource. Identity *IdentityProperties `json:"identity,omitempty"` From 902ea080568e9223a9862244b4a0ec5039ef2f91 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Sat, 7 Sep 2019 00:17:06 +0000 Subject: [PATCH 7/7] Generated from d0215e3e28bf88ac79e264ecec74268ce685965c update naming --- .../mgmt/2019-06-01-preview/containerregistry/models.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/services/containerregistry/mgmt/2019-06-01-preview/containerregistry/models.go b/services/containerregistry/mgmt/2019-06-01-preview/containerregistry/models.go index 8a8b73bbb169..18db08c894ef 100644 --- a/services/containerregistry/mgmt/2019-06-01-preview/containerregistry/models.go +++ b/services/containerregistry/mgmt/2019-06-01-preview/containerregistry/models.go @@ -4174,7 +4174,7 @@ type TaskRun struct { autorest.Response `json:"-"` // Identity - Identity for the resource. Identity *IdentityProperties `json:"identity,omitempty"` - // TaskRunProperties - The properties associated with the taskrun, i.e., request and result of the run + // TaskRunProperties - The properties associated with the task run, i.e., request and result of the run *TaskRunProperties `json:"properties,omitempty"` // ID - READ-ONLY; The resource ID. ID *string `json:"id,omitempty"` @@ -4284,7 +4284,7 @@ func (tr *TaskRun) UnmarshalJSON(body []byte) error { return nil } -// TaskRunListResult the collection of taskruns. +// TaskRunListResult the collection of task runs. type TaskRunListResult struct { autorest.Response `json:"-"` // Value - The collection value. @@ -4481,7 +4481,7 @@ func (trp *TaskRunProperties) UnmarshalJSON(body []byte) error { return nil } -// TaskRunPropertiesUpdateParameters the properties of a taskrun update parameters. +// TaskRunPropertiesUpdateParameters the properties of a task run update parameters. type TaskRunPropertiesUpdateParameters struct { // RunRequest - The request (parameters) for the new run RunRequest BasicRunRequest `json:"runRequest,omitempty"` @@ -4656,7 +4656,7 @@ func (future *TaskRunsUpdateFuture) Result(client TaskRunsClient) (tr TaskRun, e type TaskRunUpdateParameters struct { // Identity - Identity for the resource. Identity *IdentityProperties `json:"identity,omitempty"` - // TaskRunPropertiesUpdateParameters - The properties for updating a taskrun. + // TaskRunPropertiesUpdateParameters - The properties for updating a task run. *TaskRunPropertiesUpdateParameters `json:"properties,omitempty"` // Tags - The ARM resource tags. Tags map[string]*string `json:"tags"`