package windowsiot // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. // // 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" ) // ServicesClient is the use this API to manage the Windows IoT device services in your Azure subscription. type ServicesClient struct { BaseClient } // NewServicesClient creates an instance of the ServicesClient client. func NewServicesClient(subscriptionID string) ServicesClient { return NewServicesClientWithBaseURI(DefaultBaseURI, subscriptionID) } // NewServicesClientWithBaseURI creates an instance of the ServicesClient client using a custom endpoint. Use this // when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). func NewServicesClientWithBaseURI(baseURI string, subscriptionID string) ServicesClient { return ServicesClient{NewWithBaseURI(baseURI, subscriptionID)} } // CheckDeviceServiceNameAvailability check if a Windows IoT Device Service name is available. // Parameters: // deviceServiceCheckNameAvailabilityParameters - set the name parameter in the // DeviceServiceCheckNameAvailabilityParameters structure to the name of the Windows IoT Device Service to // check. func (client ServicesClient) CheckDeviceServiceNameAvailability(ctx context.Context, deviceServiceCheckNameAvailabilityParameters DeviceServiceCheckNameAvailabilityParameters) (result DeviceServiceNameAvailabilityInfo, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.CheckDeviceServiceNameAvailability") 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: deviceServiceCheckNameAvailabilityParameters, Constraints: []validation.Constraint{{Target: "deviceServiceCheckNameAvailabilityParameters.Name", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { return result, validation.NewError("windowsiot.ServicesClient", "CheckDeviceServiceNameAvailability", err.Error()) } req, err := client.CheckDeviceServiceNameAvailabilityPreparer(ctx, deviceServiceCheckNameAvailabilityParameters) if err != nil { err = autorest.NewErrorWithError(err, "windowsiot.ServicesClient", "CheckDeviceServiceNameAvailability", nil, "Failure preparing request") return } resp, err := client.CheckDeviceServiceNameAvailabilitySender(req) if err != nil { result.Response = autorest.Response{Response: resp} err = autorest.NewErrorWithError(err, "windowsiot.ServicesClient", "CheckDeviceServiceNameAvailability", resp, "Failure sending request") return } result, err = client.CheckDeviceServiceNameAvailabilityResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "windowsiot.ServicesClient", "CheckDeviceServiceNameAvailability", resp, "Failure responding to request") return } return } // CheckDeviceServiceNameAvailabilityPreparer prepares the CheckDeviceServiceNameAvailability request. func (client ServicesClient) CheckDeviceServiceNameAvailabilityPreparer(ctx context.Context, deviceServiceCheckNameAvailabilityParameters DeviceServiceCheckNameAvailabilityParameters) (*http.Request, error) { pathParameters := map[string]interface{}{ "subscriptionId": autorest.Encode("path", client.SubscriptionID), } const APIVersion = "2019-06-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } preparer := autorest.CreatePreparer( autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPost(), autorest.WithBaseURL(client.BaseURI), autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.WindowsIoT/checkDeviceServiceNameAvailability", pathParameters), autorest.WithJSON(deviceServiceCheckNameAvailabilityParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } // CheckDeviceServiceNameAvailabilitySender sends the CheckDeviceServiceNameAvailability request. The method will close the // http.Response Body if it receives an error. func (client ServicesClient) CheckDeviceServiceNameAvailabilitySender(req *http.Request) (*http.Response, error) { return client.Send(req, azure.DoRetryWithRegistration(client.Client)) } // CheckDeviceServiceNameAvailabilityResponder handles the response to the CheckDeviceServiceNameAvailability request. The method always // closes the http.Response Body. func (client ServicesClient) CheckDeviceServiceNameAvailabilityResponder(resp *http.Response) (result DeviceServiceNameAvailabilityInfo, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} return } // CreateOrUpdate create or update the metadata of a Windows IoT Device Service. The usual pattern to modify a property // is to retrieve the Windows IoT Device Service metadata and security metadata, and then combine them with the // modified values in a new body to update the Windows IoT Device Service. // Parameters: // resourceGroupName - the name of the resource group that contains the Windows IoT Device Service. // deviceName - the name of the Windows IoT Device Service. // deviceService - the Windows IoT Device Service metadata and security metadata. // ifMatch - eTag of the Windows IoT Device Service. Do not specify for creating a new Windows IoT Device // Service. Required to update an existing Windows IoT Device Service. func (client ServicesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, deviceName string, deviceService DeviceServiceProperties, ifMatch string) (result DeviceService, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.CreateOrUpdate") defer func() { sc := -1 if result.Response.Response != nil { sc = result.Response.Response.StatusCode } tracing.EndSpan(ctx, sc, err) }() } req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, deviceName, deviceService, ifMatch) if err != nil { err = autorest.NewErrorWithError(err, "windowsiot.ServicesClient", "CreateOrUpdate", nil, "Failure preparing request") return } resp, err := client.CreateOrUpdateSender(req) if err != nil { result.Response = autorest.Response{Response: resp} err = autorest.NewErrorWithError(err, "windowsiot.ServicesClient", "CreateOrUpdate", resp, "Failure sending request") return } result, err = client.CreateOrUpdateResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "windowsiot.ServicesClient", "CreateOrUpdate", resp, "Failure responding to request") return } return } // CreateOrUpdatePreparer prepares the CreateOrUpdate request. func (client ServicesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, deviceName string, deviceService DeviceServiceProperties, ifMatch string) (*http.Request, error) { pathParameters := map[string]interface{}{ "deviceName": autorest.Encode("path", deviceName), "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } const APIVersion = "2019-06-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } deviceService.StartDate = nil preparer := autorest.CreatePreparer( autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPut(), autorest.WithBaseURL(client.BaseURI), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.WindowsIoT/deviceServices/{deviceName}", pathParameters), autorest.WithJSON(deviceService), autorest.WithQueryParameters(queryParameters)) if len(ifMatch) > 0 { preparer = autorest.DecoratePreparer(preparer, autorest.WithHeader("If-Match", autorest.String(ifMatch))) } return preparer.Prepare((&http.Request{}).WithContext(ctx)) } // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client ServicesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { return client.Send(req, azure.DoRetryWithRegistration(client.Client)) } // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always // closes the http.Response Body. func (client ServicesClient) CreateOrUpdateResponder(resp *http.Response) (result DeviceService, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} return } // Delete delete a Windows IoT Device Service. // Parameters: // resourceGroupName - the name of the resource group that contains the Windows IoT Device Service. // deviceName - the name of the Windows IoT Device Service. func (client ServicesClient) Delete(ctx context.Context, resourceGroupName string, deviceName string) (result DeviceService, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.Delete") defer func() { sc := -1 if result.Response.Response != nil { sc = result.Response.Response.StatusCode } tracing.EndSpan(ctx, sc, err) }() } req, err := client.DeletePreparer(ctx, resourceGroupName, deviceName) if err != nil { err = autorest.NewErrorWithError(err, "windowsiot.ServicesClient", "Delete", nil, "Failure preparing request") return } resp, err := client.DeleteSender(req) if err != nil { result.Response = autorest.Response{Response: resp} err = autorest.NewErrorWithError(err, "windowsiot.ServicesClient", "Delete", resp, "Failure sending request") return } result, err = client.DeleteResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "windowsiot.ServicesClient", "Delete", resp, "Failure responding to request") return } return } // DeletePreparer prepares the Delete request. func (client ServicesClient) DeletePreparer(ctx context.Context, resourceGroupName string, deviceName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "deviceName": autorest.Encode("path", deviceName), "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } const APIVersion = "2019-06-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } preparer := autorest.CreatePreparer( autorest.AsDelete(), autorest.WithBaseURL(client.BaseURI), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.WindowsIoT/deviceServices/{deviceName}", 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 ServicesClient) DeleteSender(req *http.Request) (*http.Response, error) { return client.Send(req, azure.DoRetryWithRegistration(client.Client)) } // DeleteResponder handles the response to the Delete request. The method always // closes the http.Response Body. func (client ServicesClient) DeleteResponder(resp *http.Response) (result DeviceService, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} return } // Get get the non-security related metadata of a Windows IoT Device Service. // Parameters: // resourceGroupName - the name of the resource group that contains the Windows IoT Device Service. // deviceName - the name of the Windows IoT Device Service. func (client ServicesClient) Get(ctx context.Context, resourceGroupName string, deviceName string) (result DeviceService, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.Get") defer func() { sc := -1 if result.Response.Response != nil { sc = result.Response.Response.StatusCode } tracing.EndSpan(ctx, sc, err) }() } req, err := client.GetPreparer(ctx, resourceGroupName, deviceName) if err != nil { err = autorest.NewErrorWithError(err, "windowsiot.ServicesClient", "Get", nil, "Failure preparing request") return } resp, err := client.GetSender(req) if err != nil { result.Response = autorest.Response{Response: resp} err = autorest.NewErrorWithError(err, "windowsiot.ServicesClient", "Get", resp, "Failure sending request") return } result, err = client.GetResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "windowsiot.ServicesClient", "Get", resp, "Failure responding to request") return } return } // GetPreparer prepares the Get request. func (client ServicesClient) GetPreparer(ctx context.Context, resourceGroupName string, deviceName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "deviceName": autorest.Encode("path", deviceName), "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } const APIVersion = "2019-06-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.WindowsIoT/deviceServices/{deviceName}", 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 ServicesClient) GetSender(req *http.Request) (*http.Response, error) { return client.Send(req, azure.DoRetryWithRegistration(client.Client)) } // GetResponder handles the response to the Get request. The method always // closes the http.Response Body. func (client ServicesClient) GetResponder(resp *http.Response) (result DeviceService, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} return } // List get all the IoT hubs in a subscription. func (client ServicesClient) List(ctx context.Context) (result DeviceServiceDescriptionListResultPage, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.List") defer func() { sc := -1 if result.dsdlr.Response.Response != nil { sc = result.dsdlr.Response.Response.StatusCode } tracing.EndSpan(ctx, sc, err) }() } result.fn = client.listNextResults req, err := client.ListPreparer(ctx) if err != nil { err = autorest.NewErrorWithError(err, "windowsiot.ServicesClient", "List", nil, "Failure preparing request") return } resp, err := client.ListSender(req) if err != nil { result.dsdlr.Response = autorest.Response{Response: resp} err = autorest.NewErrorWithError(err, "windowsiot.ServicesClient", "List", resp, "Failure sending request") return } result.dsdlr, err = client.ListResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "windowsiot.ServicesClient", "List", resp, "Failure responding to request") return } if result.dsdlr.hasNextLink() && result.dsdlr.IsEmpty() { err = result.NextWithContext(ctx) return } return } // ListPreparer prepares the List request. func (client ServicesClient) ListPreparer(ctx context.Context) (*http.Request, error) { pathParameters := map[string]interface{}{ "subscriptionId": autorest.Encode("path", client.SubscriptionID), } const APIVersion = "2019-06-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.WindowsIoT/deviceServices", 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 ServicesClient) ListSender(req *http.Request) (*http.Response, error) { return client.Send(req, azure.DoRetryWithRegistration(client.Client)) } // ListResponder handles the response to the List request. The method always // closes the http.Response Body. func (client ServicesClient) ListResponder(resp *http.Response) (result DeviceServiceDescriptionListResult, err error) { err = autorest.Respond( resp, 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 ServicesClient) listNextResults(ctx context.Context, lastResults DeviceServiceDescriptionListResult) (result DeviceServiceDescriptionListResult, err error) { req, err := lastResults.deviceServiceDescriptionListResultPreparer(ctx) if err != nil { return result, autorest.NewErrorWithError(err, "windowsiot.ServicesClient", "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, "windowsiot.ServicesClient", "listNextResults", resp, "Failure sending next results request") } result, err = client.ListResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "windowsiot.ServicesClient", "listNextResults", resp, "Failure responding to next results request") } return } // ListComplete enumerates all values, automatically crossing page boundaries as required. func (client ServicesClient) ListComplete(ctx context.Context) (result DeviceServiceDescriptionListResultIterator, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.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) return } // ListByResourceGroup get all the IoT hubs in a resource group. // Parameters: // resourceGroupName - the name of the resource group that contains the Windows IoT Device Service. func (client ServicesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result DeviceServiceDescriptionListResultPage, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.ListByResourceGroup") defer func() { sc := -1 if result.dsdlr.Response.Response != nil { sc = result.dsdlr.Response.Response.StatusCode } tracing.EndSpan(ctx, sc, err) }() } result.fn = client.listByResourceGroupNextResults req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) if err != nil { err = autorest.NewErrorWithError(err, "windowsiot.ServicesClient", "ListByResourceGroup", nil, "Failure preparing request") return } resp, err := client.ListByResourceGroupSender(req) if err != nil { result.dsdlr.Response = autorest.Response{Response: resp} err = autorest.NewErrorWithError(err, "windowsiot.ServicesClient", "ListByResourceGroup", resp, "Failure sending request") return } result.dsdlr, err = client.ListByResourceGroupResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "windowsiot.ServicesClient", "ListByResourceGroup", resp, "Failure responding to request") return } if result.dsdlr.hasNextLink() && result.dsdlr.IsEmpty() { err = result.NextWithContext(ctx) return } return } // ListByResourceGroupPreparer prepares the ListByResourceGroup request. func (client ServicesClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } const APIVersion = "2019-06-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.WindowsIoT/deviceServices", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } // ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the // http.Response Body if it receives an error. func (client ServicesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { return client.Send(req, azure.DoRetryWithRegistration(client.Client)) } // ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always // closes the http.Response Body. func (client ServicesClient) ListByResourceGroupResponder(resp *http.Response) (result DeviceServiceDescriptionListResult, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} return } // listByResourceGroupNextResults retrieves the next set of results, if any. func (client ServicesClient) listByResourceGroupNextResults(ctx context.Context, lastResults DeviceServiceDescriptionListResult) (result DeviceServiceDescriptionListResult, err error) { req, err := lastResults.deviceServiceDescriptionListResultPreparer(ctx) if err != nil { return result, autorest.NewErrorWithError(err, "windowsiot.ServicesClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") } if req == nil { return } resp, err := client.ListByResourceGroupSender(req) if err != nil { result.Response = autorest.Response{Response: resp} return result, autorest.NewErrorWithError(err, "windowsiot.ServicesClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") } result, err = client.ListByResourceGroupResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "windowsiot.ServicesClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") } return } // ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. func (client ServicesClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result DeviceServiceDescriptionListResultIterator, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.ListByResourceGroup") 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.ListByResourceGroup(ctx, resourceGroupName) return } // Update updates the metadata of a Windows IoT Device Service. The usual pattern to modify a property is to retrieve // the Windows IoT Device Service metadata and security metadata, and then combine them with the modified values in a // new body to update the Windows IoT Device Service. // Parameters: // resourceGroupName - the name of the resource group that contains the Windows IoT Device Service. // deviceName - the name of the Windows IoT Device Service. // deviceService - the Windows IoT Device Service metadata and security metadata. // ifMatch - eTag of the Windows IoT Device Service. Do not specify for creating a brand new Windows IoT Device // Service. Required to update an existing Windows IoT Device Service. func (client ServicesClient) Update(ctx context.Context, resourceGroupName string, deviceName string, deviceService DeviceServiceProperties, ifMatch string) (result DeviceService, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.Update") defer func() { sc := -1 if result.Response.Response != nil { sc = result.Response.Response.StatusCode } tracing.EndSpan(ctx, sc, err) }() } req, err := client.UpdatePreparer(ctx, resourceGroupName, deviceName, deviceService, ifMatch) if err != nil { err = autorest.NewErrorWithError(err, "windowsiot.ServicesClient", "Update", nil, "Failure preparing request") return } resp, err := client.UpdateSender(req) if err != nil { result.Response = autorest.Response{Response: resp} err = autorest.NewErrorWithError(err, "windowsiot.ServicesClient", "Update", resp, "Failure sending request") return } result, err = client.UpdateResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "windowsiot.ServicesClient", "Update", resp, "Failure responding to request") return } return } // UpdatePreparer prepares the Update request. func (client ServicesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, deviceName string, deviceService DeviceServiceProperties, ifMatch string) (*http.Request, error) { pathParameters := map[string]interface{}{ "deviceName": autorest.Encode("path", deviceName), "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } const APIVersion = "2019-06-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } deviceService.StartDate = nil preparer := autorest.CreatePreparer( autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPatch(), autorest.WithBaseURL(client.BaseURI), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.WindowsIoT/deviceServices/{deviceName}", pathParameters), autorest.WithJSON(deviceService), autorest.WithQueryParameters(queryParameters)) if len(ifMatch) > 0 { preparer = autorest.DecoratePreparer(preparer, autorest.WithHeader("If-Match", autorest.String(ifMatch))) } 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 ServicesClient) UpdateSender(req *http.Request) (*http.Response, error) { return client.Send(req, azure.DoRetryWithRegistration(client.Client)) } // UpdateResponder handles the response to the Update request. The method always // closes the http.Response Body. func (client ServicesClient) UpdateResponder(resp *http.Response) (result DeviceService, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} return }