From 8097d4694fe878b5988ef6bcf5ee84f606fc604a Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Tue, 19 Mar 2019 19:52:40 -0700 Subject: [PATCH] [AutoPR machinelearning/resource-manager] [Hub Generated] Review request for Microsoft.MachineLearning to add version 2017-01-01 (#4291) * Generated from 3e4f75e7a15cbd81f6161bf9221a29a621386acc RevertWebServiceDefinition * Generated from 3e4f75e7a15cbd81f6161bf9221a29a621386acc RevertWebServiceDefinition --- .../mgmt/webservices/models.go | 2 + .../mgmt/webservices/models.go | 2 + .../mgmt/2017-01-01/webservices/models.go | 141 ++++++++++++++++++ .../2017-01-01/webservices/webservices.go | 4 +- .../webservices/webservicesapi/interfaces.go | 2 +- 5 files changed, 148 insertions(+), 3 deletions(-) diff --git a/profiles/latest/machinelearning/mgmt/webservices/models.go b/profiles/latest/machinelearning/mgmt/webservices/models.go index bbaa06c8547a..15e0f13cfe13 100644 --- a/profiles/latest/machinelearning/mgmt/webservices/models.go +++ b/profiles/latest/machinelearning/mgmt/webservices/models.go @@ -153,6 +153,8 @@ type PaginatedWebServicesListIterator = original.PaginatedWebServicesListIterato type PaginatedWebServicesListPage = original.PaginatedWebServicesListPage type Parameter = original.Parameter type PatchFuture = original.PatchFuture +type PatchedResource = original.PatchedResource +type PatchedWebService = original.PatchedWebService type Properties = original.Properties type PropertiesForGraph = original.PropertiesForGraph type RealtimeConfiguration = original.RealtimeConfiguration diff --git a/profiles/preview/machinelearning/mgmt/webservices/models.go b/profiles/preview/machinelearning/mgmt/webservices/models.go index f3fb201bc630..fcd55b1a5df4 100644 --- a/profiles/preview/machinelearning/mgmt/webservices/models.go +++ b/profiles/preview/machinelearning/mgmt/webservices/models.go @@ -153,6 +153,8 @@ type PaginatedWebServicesListIterator = original.PaginatedWebServicesListIterato type PaginatedWebServicesListPage = original.PaginatedWebServicesListPage type Parameter = original.Parameter type PatchFuture = original.PatchFuture +type PatchedResource = original.PatchedResource +type PatchedWebService = original.PatchedWebService type Properties = original.Properties type PropertiesForGraph = original.PropertiesForGraph type RealtimeConfiguration = original.RealtimeConfiguration diff --git a/services/machinelearning/mgmt/2017-01-01/webservices/models.go b/services/machinelearning/mgmt/2017-01-01/webservices/models.go index f8da6501b7d9..468fbccb5e22 100644 --- a/services/machinelearning/mgmt/2017-01-01/webservices/models.go +++ b/services/machinelearning/mgmt/2017-01-01/webservices/models.go @@ -746,6 +746,147 @@ type Parameter struct { CertificateThumbprint *string `json:"certificateThumbprint,omitempty"` } +// PatchedResource azure resource. +type PatchedResource struct { + // ID - Specifies the resource ID. + ID *string `json:"id,omitempty"` + // Name - Specifies the name of the resource. + Name *string `json:"name,omitempty"` + // Location - Specifies the location of the resource. + Location *string `json:"location,omitempty"` + // Type - Specifies the type of the resource. + Type *string `json:"type,omitempty"` + // Tags - Contains resource tags defined as key/value pairs. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for PatchedResource. +func (pr PatchedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pr.ID != nil { + objectMap["id"] = pr.ID + } + if pr.Name != nil { + objectMap["name"] = pr.Name + } + if pr.Location != nil { + objectMap["location"] = pr.Location + } + if pr.Type != nil { + objectMap["type"] = pr.Type + } + if pr.Tags != nil { + objectMap["tags"] = pr.Tags + } + return json.Marshal(objectMap) +} + +// PatchedWebService instance of an Patched Azure ML web service resource. +type PatchedWebService struct { + // Properties - Contains the property payload that describes the web service. + Properties BasicProperties `json:"properties,omitempty"` + // ID - Specifies the resource ID. + ID *string `json:"id,omitempty"` + // Name - Specifies the name of the resource. + Name *string `json:"name,omitempty"` + // Location - Specifies the location of the resource. + Location *string `json:"location,omitempty"` + // Type - Specifies the type of the resource. + Type *string `json:"type,omitempty"` + // Tags - Contains resource tags defined as key/value pairs. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for PatchedWebService. +func (pws PatchedWebService) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["properties"] = pws.Properties + if pws.ID != nil { + objectMap["id"] = pws.ID + } + if pws.Name != nil { + objectMap["name"] = pws.Name + } + if pws.Location != nil { + objectMap["location"] = pws.Location + } + if pws.Type != nil { + objectMap["type"] = pws.Type + } + if pws.Tags != nil { + objectMap["tags"] = pws.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PatchedWebService struct. +func (pws *PatchedWebService) 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 "properties": + if v != nil { + properties, err := unmarshalBasicProperties(*v) + if err != nil { + return err + } + pws.Properties = properties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + pws.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + pws.Name = &name + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + pws.Location = &location + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + pws.Type = &typeVar + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + pws.Tags = tags + } + } + } + + return nil +} + // PatchFuture an abstraction for monitoring and retrieving the results of a long-running operation. type PatchFuture struct { azure.Future diff --git a/services/machinelearning/mgmt/2017-01-01/webservices/webservices.go b/services/machinelearning/mgmt/2017-01-01/webservices/webservices.go index 2947123ad50c..6da8a09bc377 100644 --- a/services/machinelearning/mgmt/2017-01-01/webservices/webservices.go +++ b/services/machinelearning/mgmt/2017-01-01/webservices/webservices.go @@ -632,7 +632,7 @@ func (client Client) ListKeysResponder(resp *http.Response) (result Keys, err er // resourceGroupName - name of the resource group in which the web service is located. // webServiceName - the name of the web service. // patchPayload - the payload to use to patch the web service. -func (client Client) Patch(ctx context.Context, resourceGroupName string, webServiceName string, patchPayload WebService) (result PatchFuture, err error) { +func (client Client) Patch(ctx context.Context, resourceGroupName string, webServiceName string, patchPayload PatchedWebService) (result PatchFuture, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/Client.Patch") defer func() { @@ -659,7 +659,7 @@ func (client Client) Patch(ctx context.Context, resourceGroupName string, webSer } // PatchPreparer prepares the Patch request. -func (client Client) PatchPreparer(ctx context.Context, resourceGroupName string, webServiceName string, patchPayload WebService) (*http.Request, error) { +func (client Client) PatchPreparer(ctx context.Context, resourceGroupName string, webServiceName string, patchPayload PatchedWebService) (*http.Request, error) { pathParameters := map[string]interface{}{ "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), diff --git a/services/machinelearning/mgmt/2017-01-01/webservices/webservicesapi/interfaces.go b/services/machinelearning/mgmt/2017-01-01/webservices/webservicesapi/interfaces.go index f10dc00c2e0d..b6f293e9733f 100644 --- a/services/machinelearning/mgmt/2017-01-01/webservices/webservicesapi/interfaces.go +++ b/services/machinelearning/mgmt/2017-01-01/webservices/webservicesapi/interfaces.go @@ -37,7 +37,7 @@ type ClientAPI interface { ListByResourceGroup(ctx context.Context, resourceGroupName string, skiptoken string) (result webservices.PaginatedWebServicesListPage, err error) ListBySubscriptionID(ctx context.Context, skiptoken string) (result webservices.PaginatedWebServicesListPage, err error) ListKeys(ctx context.Context, resourceGroupName string, webServiceName string) (result webservices.Keys, err error) - Patch(ctx context.Context, resourceGroupName string, webServiceName string, patchPayload webservices.WebService) (result webservices.PatchFuture, err error) + Patch(ctx context.Context, resourceGroupName string, webServiceName string, patchPayload webservices.PatchedWebService) (result webservices.PatchFuture, err error) Remove(ctx context.Context, resourceGroupName string, webServiceName string) (result webservices.RemoveFuture, err error) }