From 6f6640f2f02ca39a757cc5c5bedf1ddccf89940b Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Mon, 24 Jun 2019 22:01:34 -0700 Subject: [PATCH] Generated from 202b235fed51cf166959a378c0adb341870ccbb3 (#5065) Add published blueprint object to the payload to support change notes --- .../blueprint/blueprintapi/interfaces.go | 2 +- .../blueprint/publishedblueprints.go | 24 ++++++++++++++++--- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/services/preview/blueprint/mgmt/2018-11-01-preview/blueprint/blueprintapi/interfaces.go b/services/preview/blueprint/mgmt/2018-11-01-preview/blueprint/blueprintapi/interfaces.go index 2b45c0b1b021..74af04b463d9 100644 --- a/services/preview/blueprint/mgmt/2018-11-01-preview/blueprint/blueprintapi/interfaces.go +++ b/services/preview/blueprint/mgmt/2018-11-01-preview/blueprint/blueprintapi/interfaces.go @@ -44,7 +44,7 @@ var _ ArtifactsClientAPI = (*blueprint.ArtifactsClient)(nil) // PublishedBlueprintsClientAPI contains the set of methods on the PublishedBlueprintsClient type. type PublishedBlueprintsClientAPI interface { - Create(ctx context.Context, scope string, blueprintName string, versionID string) (result blueprint.PublishedBlueprint, err error) + Create(ctx context.Context, scope string, blueprintName string, versionID string, publishedBlueprint *blueprint.PublishedBlueprint) (result blueprint.PublishedBlueprint, err error) Delete(ctx context.Context, scope string, blueprintName string, versionID string) (result blueprint.PublishedBlueprint, err error) Get(ctx context.Context, scope string, blueprintName string, versionID string) (result blueprint.PublishedBlueprint, err error) List(ctx context.Context, scope string, blueprintName string) (result blueprint.PublishedBlueprintListPage, err error) diff --git a/services/preview/blueprint/mgmt/2018-11-01-preview/blueprint/publishedblueprints.go b/services/preview/blueprint/mgmt/2018-11-01-preview/blueprint/publishedblueprints.go index 4db9f07cc9ba..0d87b8242920 100644 --- a/services/preview/blueprint/mgmt/2018-11-01-preview/blueprint/publishedblueprints.go +++ b/services/preview/blueprint/mgmt/2018-11-01-preview/blueprint/publishedblueprints.go @@ -21,6 +21,7 @@ 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" ) @@ -49,7 +50,8 @@ func NewPublishedBlueprintsClientWithBaseURI(baseURI string) PublishedBlueprints // use. // blueprintName - name of the blueprint definition. // versionID - version of the published blueprint definition. -func (client PublishedBlueprintsClient) Create(ctx context.Context, scope string, blueprintName string, versionID string) (result PublishedBlueprint, err error) { +// publishedBlueprint - published Blueprint to create or update. +func (client PublishedBlueprintsClient) Create(ctx context.Context, scope string, blueprintName string, versionID string, publishedBlueprint *PublishedBlueprint) (result PublishedBlueprint, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/PublishedBlueprintsClient.Create") defer func() { @@ -60,7 +62,18 @@ func (client PublishedBlueprintsClient) Create(ctx context.Context, scope string tracing.EndSpan(ctx, sc, err) }() } - req, err := client.CreatePreparer(ctx, scope, blueprintName, versionID) + if err := validation.Validate([]validation.Validation{ + {TargetValue: publishedBlueprint, + Constraints: []validation.Constraint{{Target: "publishedBlueprint", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "publishedBlueprint.PublishedBlueprintProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "publishedBlueprint.PublishedBlueprintProperties.ChangeNotes", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "publishedBlueprint.PublishedBlueprintProperties.ChangeNotes", Name: validation.MaxLength, Rule: 500, Chain: nil}}}, + }}, + }}}}}); err != nil { + return result, validation.NewError("blueprint.PublishedBlueprintsClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, scope, blueprintName, versionID, publishedBlueprint) if err != nil { err = autorest.NewErrorWithError(err, "blueprint.PublishedBlueprintsClient", "Create", nil, "Failure preparing request") return @@ -82,7 +95,7 @@ func (client PublishedBlueprintsClient) Create(ctx context.Context, scope string } // CreatePreparer prepares the Create request. -func (client PublishedBlueprintsClient) CreatePreparer(ctx context.Context, scope string, blueprintName string, versionID string) (*http.Request, error) { +func (client PublishedBlueprintsClient) CreatePreparer(ctx context.Context, scope string, blueprintName string, versionID string, publishedBlueprint *PublishedBlueprint) (*http.Request, error) { pathParameters := map[string]interface{}{ "blueprintName": autorest.Encode("path", blueprintName), "scope": scope, @@ -95,10 +108,15 @@ func (client PublishedBlueprintsClient) CreatePreparer(ctx context.Context, scop } preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPut(), autorest.WithBaseURL(client.BaseURI), autorest.WithPathParameters("/{scope}/providers/Microsoft.Blueprint/blueprints/{blueprintName}/versions/{versionId}", pathParameters), autorest.WithQueryParameters(queryParameters)) + if publishedBlueprint != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(publishedBlueprint)) + } return preparer.Prepare((&http.Request{}).WithContext(ctx)) }