From eae8f3f47c3a06ff89616f553375122a0ea66c61 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Wed, 27 Mar 2019 23:29:09 +0000 Subject: [PATCH 01/10] Generated from 57118f4ece67623419fab8d80c7e89f64d591c51 Add IOT central app templates api in swagger --- .../iotcentral/mgmt/iotcentral/models.go | 10 ++ .../iotcentral/mgmt/iotcentral/models.go | 10 ++ .../mgmt/2018-09-01/iotcentral/apps.go | 110 ++++++++++++ .../iotcentral/iotcentralapi/interfaces.go | 1 + .../mgmt/2018-09-01/iotcentral/models.go | 163 ++++++++++++++++++ 5 files changed, 294 insertions(+) diff --git a/profiles/latest/iotcentral/mgmt/iotcentral/models.go b/profiles/latest/iotcentral/mgmt/iotcentral/models.go index ccc401836fbe..7d03f897bccd 100644 --- a/profiles/latest/iotcentral/mgmt/iotcentral/models.go +++ b/profiles/latest/iotcentral/mgmt/iotcentral/models.go @@ -44,6 +44,10 @@ type AppListResultPage = original.AppListResultPage type AppPatch = original.AppPatch type AppProperties = original.AppProperties type AppSkuInfo = original.AppSkuInfo +type AppTemplate = original.AppTemplate +type AppTemplatesResult = original.AppTemplatesResult +type AppTemplatesResultIterator = original.AppTemplatesResultIterator +type AppTemplatesResultPage = original.AppTemplatesResultPage type AppsClient = original.AppsClient type AppsCreateOrUpdateFuture = original.AppsCreateOrUpdateFuture type AppsDeleteFuture = original.AppsDeleteFuture @@ -69,6 +73,12 @@ func NewAppListResultIterator(page AppListResultPage) AppListResultIterator { func NewAppListResultPage(getNextPage func(context.Context, AppListResult) (AppListResult, error)) AppListResultPage { return original.NewAppListResultPage(getNextPage) } +func NewAppTemplatesResultIterator(page AppTemplatesResultPage) AppTemplatesResultIterator { + return original.NewAppTemplatesResultIterator(page) +} +func NewAppTemplatesResultPage(getNextPage func(context.Context, AppTemplatesResult) (AppTemplatesResult, error)) AppTemplatesResultPage { + return original.NewAppTemplatesResultPage(getNextPage) +} func NewAppsClient(subscriptionID string) AppsClient { return original.NewAppsClient(subscriptionID) } diff --git a/profiles/preview/iotcentral/mgmt/iotcentral/models.go b/profiles/preview/iotcentral/mgmt/iotcentral/models.go index dc7f6a5b83a0..820d6b91ec50 100644 --- a/profiles/preview/iotcentral/mgmt/iotcentral/models.go +++ b/profiles/preview/iotcentral/mgmt/iotcentral/models.go @@ -44,6 +44,10 @@ type AppListResultPage = original.AppListResultPage type AppPatch = original.AppPatch type AppProperties = original.AppProperties type AppSkuInfo = original.AppSkuInfo +type AppTemplate = original.AppTemplate +type AppTemplatesResult = original.AppTemplatesResult +type AppTemplatesResultIterator = original.AppTemplatesResultIterator +type AppTemplatesResultPage = original.AppTemplatesResultPage type AppsClient = original.AppsClient type AppsCreateOrUpdateFuture = original.AppsCreateOrUpdateFuture type AppsDeleteFuture = original.AppsDeleteFuture @@ -69,6 +73,12 @@ func NewAppListResultIterator(page AppListResultPage) AppListResultIterator { func NewAppListResultPage(getNextPage func(context.Context, AppListResult) (AppListResult, error)) AppListResultPage { return original.NewAppListResultPage(getNextPage) } +func NewAppTemplatesResultIterator(page AppTemplatesResultPage) AppTemplatesResultIterator { + return original.NewAppTemplatesResultIterator(page) +} +func NewAppTemplatesResultPage(getNextPage func(context.Context, AppTemplatesResult) (AppTemplatesResult, error)) AppTemplatesResultPage { + return original.NewAppTemplatesResultPage(getNextPage) +} func NewAppsClient(subscriptionID string) AppsClient { return original.NewAppsClient(subscriptionID) } diff --git a/services/iotcentral/mgmt/2018-09-01/iotcentral/apps.go b/services/iotcentral/mgmt/2018-09-01/iotcentral/apps.go index 4517bda1d98e..a4e30e7d200f 100644 --- a/services/iotcentral/mgmt/2018-09-01/iotcentral/apps.go +++ b/services/iotcentral/mgmt/2018-09-01/iotcentral/apps.go @@ -679,6 +679,116 @@ func (client AppsClient) ListBySubscriptionComplete(ctx context.Context) (result return } +// ListTemplates get all available application templates. +func (client AppsClient) ListTemplates(ctx context.Context) (result AppTemplatesResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListTemplates") + defer func() { + sc := -1 + if result.atr.Response.Response != nil { + sc = result.atr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listTemplatesNextResults + req, err := client.ListTemplatesPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "iotcentral.AppsClient", "ListTemplates", nil, "Failure preparing request") + return + } + + resp, err := client.ListTemplatesSender(req) + if err != nil { + result.atr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "iotcentral.AppsClient", "ListTemplates", resp, "Failure sending request") + return + } + + result.atr, err = client.ListTemplatesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "iotcentral.AppsClient", "ListTemplates", resp, "Failure responding to request") + } + + return +} + +// ListTemplatesPreparer prepares the ListTemplates request. +func (client AppsClient) ListTemplatesPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.IoTCentral/appTemplates", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListTemplatesSender sends the ListTemplates request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListTemplatesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListTemplatesResponder handles the response to the ListTemplates request. The method always +// closes the http.Response Body. +func (client AppsClient) ListTemplatesResponder(resp *http.Response) (result AppTemplatesResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listTemplatesNextResults retrieves the next set of results, if any. +func (client AppsClient) listTemplatesNextResults(ctx context.Context, lastResults AppTemplatesResult) (result AppTemplatesResult, err error) { + req, err := lastResults.appTemplatesResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "iotcentral.AppsClient", "listTemplatesNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListTemplatesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "iotcentral.AppsClient", "listTemplatesNextResults", resp, "Failure sending next results request") + } + result, err = client.ListTemplatesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "iotcentral.AppsClient", "listTemplatesNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListTemplatesComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppsClient) ListTemplatesComplete(ctx context.Context) (result AppTemplatesResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListTemplates") + 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.ListTemplates(ctx) + return +} + // Update update the metadata of an IoT Central application. // Parameters: // resourceGroupName - the name of the resource group that contains the IoT Central application. diff --git a/services/iotcentral/mgmt/2018-09-01/iotcentral/iotcentralapi/interfaces.go b/services/iotcentral/mgmt/2018-09-01/iotcentral/iotcentralapi/interfaces.go index f3ddd2a6d182..e29f9e512546 100644 --- a/services/iotcentral/mgmt/2018-09-01/iotcentral/iotcentralapi/interfaces.go +++ b/services/iotcentral/mgmt/2018-09-01/iotcentral/iotcentralapi/interfaces.go @@ -31,6 +31,7 @@ type AppsClientAPI interface { Get(ctx context.Context, resourceGroupName string, resourceName string) (result iotcentral.App, err error) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result iotcentral.AppListResultPage, err error) ListBySubscription(ctx context.Context) (result iotcentral.AppListResultPage, err error) + ListTemplates(ctx context.Context) (result iotcentral.AppTemplatesResultPage, err error) Update(ctx context.Context, resourceGroupName string, resourceName string, appPatch iotcentral.AppPatch) (result iotcentral.AppsUpdateFuture, err error) } diff --git a/services/iotcentral/mgmt/2018-09-01/iotcentral/models.go b/services/iotcentral/mgmt/2018-09-01/iotcentral/models.go index b0590b8d152c..54ae6e7ee52a 100644 --- a/services/iotcentral/mgmt/2018-09-01/iotcentral/models.go +++ b/services/iotcentral/mgmt/2018-09-01/iotcentral/models.go @@ -477,8 +477,171 @@ func (future *AppsUpdateFuture) Result(client AppsClient) (a App, err error) { return } +// AppTemplate ioT Central Application Template. +type AppTemplate struct { + // ManifestID - The ID of the template. + ManifestID *string `json:"manifestId,omitempty"` + // ManifestVersion - The version of the template. + ManifestVersion *string `json:"manifestVersion,omitempty"` + // Name - The name of the template. + Name *string `json:"name,omitempty"` + // Title - The title of the template. + Title *string `json:"title,omitempty"` + // Order - The order of the template in the templates list. + Order *float64 `json:"order,omitempty"` + // Description - The description of the template. + Description *string `json:"description,omitempty"` +} + +// AppTemplatesResult a list of IoT Central Application Templates with a next link. +type AppTemplatesResult struct { + autorest.Response `json:"-"` + // NextLink - The link used to get the next page of IoT Central description objects. + NextLink *string `json:"nextLink,omitempty"` + // Value - A list of IoT Central Application Templates. + Value *[]AppTemplate `json:"value,omitempty"` +} + +// AppTemplatesResultIterator provides access to a complete listing of AppTemplate values. +type AppTemplatesResultIterator struct { + i int + page AppTemplatesResultPage +} + +// 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 *AppTemplatesResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppTemplatesResultIterator.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 *AppTemplatesResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter AppTemplatesResultIterator) 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 AppTemplatesResultIterator) Response() AppTemplatesResult { + 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 AppTemplatesResultIterator) Value() AppTemplate { + if !iter.page.NotDone() { + return AppTemplate{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the AppTemplatesResultIterator type. +func NewAppTemplatesResultIterator(page AppTemplatesResultPage) AppTemplatesResultIterator { + return AppTemplatesResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (atr AppTemplatesResult) IsEmpty() bool { + return atr.Value == nil || len(*atr.Value) == 0 +} + +// appTemplatesResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (atr AppTemplatesResult) appTemplatesResultPreparer(ctx context.Context) (*http.Request, error) { + if atr.NextLink == nil || len(to.String(atr.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(atr.NextLink))) +} + +// AppTemplatesResultPage contains a page of AppTemplate values. +type AppTemplatesResultPage struct { + fn func(context.Context, AppTemplatesResult) (AppTemplatesResult, error) + atr AppTemplatesResult +} + +// 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 *AppTemplatesResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppTemplatesResultPage.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.atr) + if err != nil { + return err + } + page.atr = 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 *AppTemplatesResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page AppTemplatesResultPage) NotDone() bool { + return !page.atr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page AppTemplatesResultPage) Response() AppTemplatesResult { + return page.atr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page AppTemplatesResultPage) Values() []AppTemplate { + if page.atr.IsEmpty() { + return nil + } + return *page.atr.Value +} + +// Creates a new instance of the AppTemplatesResultPage type. +func NewAppTemplatesResultPage(getNextPage func(context.Context, AppTemplatesResult) (AppTemplatesResult, error)) AppTemplatesResultPage { + return AppTemplatesResultPage{fn: getNextPage} +} + // ErrorDetails error details. type ErrorDetails struct { + // ErrorResponseBody - Error response body. *ErrorResponseBody `json:"error,omitempty"` } From 2ca01239480b674da5c18c6992e7ade27a325aec Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Fri, 29 Mar 2019 18:10:06 +0000 Subject: [PATCH 02/10] Generated from 752211789b15f63fbdb1c0826be94bfd7448fcde Add IOT central app templates api in swagger --- .../iotcentral/mgmt/iotcentral/models.go | 24 +++--- .../iotcentral/mgmt/iotcentral/models.go | 24 +++--- .../mgmt/2018-09-01/iotcentral/apps.go | 83 +++++++++++++++++-- .../mgmt/2018-09-01/iotcentral/client.go | 18 ++-- .../iotcentral/iotcentralapi/interfaces.go | 1 + .../mgmt/2018-09-01/iotcentral/models.go | 3 +- .../mgmt/2018-09-01/iotcentral/operations.go | 8 +- 7 files changed, 119 insertions(+), 42 deletions(-) diff --git a/profiles/latest/iotcentral/mgmt/iotcentral/models.go b/profiles/latest/iotcentral/mgmt/iotcentral/models.go index 7d03f897bccd..9bf7c1efe5b6 100644 --- a/profiles/latest/iotcentral/mgmt/iotcentral/models.go +++ b/profiles/latest/iotcentral/mgmt/iotcentral/models.go @@ -64,8 +64,8 @@ type OperationListResultPage = original.OperationListResultPage type OperationsClient = original.OperationsClient type Resource = original.Resource -func New(subscriptionID string) BaseClient { - return original.New(subscriptionID) +func New(subscriptionID string, applicationTemplateID string) BaseClient { + return original.New(subscriptionID, applicationTemplateID) } func NewAppListResultIterator(page AppListResultPage) AppListResultIterator { return original.NewAppListResultIterator(page) @@ -79,11 +79,11 @@ func NewAppTemplatesResultIterator(page AppTemplatesResultPage) AppTemplatesResu func NewAppTemplatesResultPage(getNextPage func(context.Context, AppTemplatesResult) (AppTemplatesResult, error)) AppTemplatesResultPage { return original.NewAppTemplatesResultPage(getNextPage) } -func NewAppsClient(subscriptionID string) AppsClient { - return original.NewAppsClient(subscriptionID) +func NewAppsClient(subscriptionID string, applicationTemplateID string) AppsClient { + return original.NewAppsClient(subscriptionID, applicationTemplateID) } -func NewAppsClientWithBaseURI(baseURI string, subscriptionID string) AppsClient { - return original.NewAppsClientWithBaseURI(baseURI, subscriptionID) +func NewAppsClientWithBaseURI(baseURI string, subscriptionID string, applicationTemplateID string) AppsClient { + return original.NewAppsClientWithBaseURI(baseURI, subscriptionID, applicationTemplateID) } func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { return original.NewOperationListResultIterator(page) @@ -91,14 +91,14 @@ func NewOperationListResultIterator(page OperationListResultPage) OperationListR func NewOperationListResultPage(getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { return original.NewOperationListResultPage(getNextPage) } -func NewOperationsClient(subscriptionID string) OperationsClient { - return original.NewOperationsClient(subscriptionID) +func NewOperationsClient(subscriptionID string, applicationTemplateID string) OperationsClient { + return original.NewOperationsClient(subscriptionID, applicationTemplateID) } -func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { - return original.NewOperationsClientWithBaseURI(baseURI, subscriptionID) +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string, applicationTemplateID string) OperationsClient { + return original.NewOperationsClientWithBaseURI(baseURI, subscriptionID, applicationTemplateID) } -func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { - return original.NewWithBaseURI(baseURI, subscriptionID) +func NewWithBaseURI(baseURI string, subscriptionID string, applicationTemplateID string) BaseClient { + return original.NewWithBaseURI(baseURI, subscriptionID, applicationTemplateID) } func PossibleAppSkuValues() []AppSku { return original.PossibleAppSkuValues() diff --git a/profiles/preview/iotcentral/mgmt/iotcentral/models.go b/profiles/preview/iotcentral/mgmt/iotcentral/models.go index 820d6b91ec50..5f6bc55ac5d6 100644 --- a/profiles/preview/iotcentral/mgmt/iotcentral/models.go +++ b/profiles/preview/iotcentral/mgmt/iotcentral/models.go @@ -64,8 +64,8 @@ type OperationListResultPage = original.OperationListResultPage type OperationsClient = original.OperationsClient type Resource = original.Resource -func New(subscriptionID string) BaseClient { - return original.New(subscriptionID) +func New(subscriptionID string, applicationTemplateID string) BaseClient { + return original.New(subscriptionID, applicationTemplateID) } func NewAppListResultIterator(page AppListResultPage) AppListResultIterator { return original.NewAppListResultIterator(page) @@ -79,11 +79,11 @@ func NewAppTemplatesResultIterator(page AppTemplatesResultPage) AppTemplatesResu func NewAppTemplatesResultPage(getNextPage func(context.Context, AppTemplatesResult) (AppTemplatesResult, error)) AppTemplatesResultPage { return original.NewAppTemplatesResultPage(getNextPage) } -func NewAppsClient(subscriptionID string) AppsClient { - return original.NewAppsClient(subscriptionID) +func NewAppsClient(subscriptionID string, applicationTemplateID string) AppsClient { + return original.NewAppsClient(subscriptionID, applicationTemplateID) } -func NewAppsClientWithBaseURI(baseURI string, subscriptionID string) AppsClient { - return original.NewAppsClientWithBaseURI(baseURI, subscriptionID) +func NewAppsClientWithBaseURI(baseURI string, subscriptionID string, applicationTemplateID string) AppsClient { + return original.NewAppsClientWithBaseURI(baseURI, subscriptionID, applicationTemplateID) } func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { return original.NewOperationListResultIterator(page) @@ -91,14 +91,14 @@ func NewOperationListResultIterator(page OperationListResultPage) OperationListR func NewOperationListResultPage(getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { return original.NewOperationListResultPage(getNextPage) } -func NewOperationsClient(subscriptionID string) OperationsClient { - return original.NewOperationsClient(subscriptionID) +func NewOperationsClient(subscriptionID string, applicationTemplateID string) OperationsClient { + return original.NewOperationsClient(subscriptionID, applicationTemplateID) } -func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { - return original.NewOperationsClientWithBaseURI(baseURI, subscriptionID) +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string, applicationTemplateID string) OperationsClient { + return original.NewOperationsClientWithBaseURI(baseURI, subscriptionID, applicationTemplateID) } -func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { - return original.NewWithBaseURI(baseURI, subscriptionID) +func NewWithBaseURI(baseURI string, subscriptionID string, applicationTemplateID string) BaseClient { + return original.NewWithBaseURI(baseURI, subscriptionID, applicationTemplateID) } func PossibleAppSkuValues() []AppSku { return original.PossibleAppSkuValues() diff --git a/services/iotcentral/mgmt/2018-09-01/iotcentral/apps.go b/services/iotcentral/mgmt/2018-09-01/iotcentral/apps.go index a4e30e7d200f..d38c9acbdae5 100644 --- a/services/iotcentral/mgmt/2018-09-01/iotcentral/apps.go +++ b/services/iotcentral/mgmt/2018-09-01/iotcentral/apps.go @@ -32,13 +32,13 @@ type AppsClient struct { } // NewAppsClient creates an instance of the AppsClient client. -func NewAppsClient(subscriptionID string) AppsClient { - return NewAppsClientWithBaseURI(DefaultBaseURI, subscriptionID) +func NewAppsClient(subscriptionID string, applicationTemplateID string) AppsClient { + return NewAppsClientWithBaseURI(DefaultBaseURI, subscriptionID, applicationTemplateID) } // NewAppsClientWithBaseURI creates an instance of the AppsClient client. -func NewAppsClientWithBaseURI(baseURI string, subscriptionID string) AppsClient { - return AppsClient{NewWithBaseURI(baseURI, subscriptionID)} +func NewAppsClientWithBaseURI(baseURI string, subscriptionID string, applicationTemplateID string) AppsClient { + return AppsClient{NewWithBaseURI(baseURI, subscriptionID, applicationTemplateID)} } // CheckNameAvailability check if an IoT Central application name is available. @@ -727,7 +727,7 @@ func (client AppsClient) ListTemplatesPreparer(ctx context.Context) (*http.Reque preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.IoTCentral/appTemplates", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.IoTCentral/applicationTemplates", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -789,6 +789,79 @@ func (client AppsClient) ListTemplatesComplete(ctx context.Context) (result AppT return } +// Template get a single application template. +func (client AppsClient) Template(ctx context.Context) (result AppTemplate, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.Template") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.TemplatePreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "iotcentral.AppsClient", "Template", nil, "Failure preparing request") + return + } + + resp, err := client.TemplateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "iotcentral.AppsClient", "Template", resp, "Failure sending request") + return + } + + result, err = client.TemplateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "iotcentral.AppsClient", "Template", resp, "Failure responding to request") + } + + return +} + +// TemplatePreparer prepares the Template request. +func (client AppsClient) TemplatePreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "applicationTemplateId": autorest.Encode("path", client.ApplicationTemplateID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.IoTCentral/applicationTemplates/{applicationTemplateId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// TemplateSender sends the Template request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) TemplateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// TemplateResponder handles the response to the Template request. The method always +// closes the http.Response Body. +func (client AppsClient) TemplateResponder(resp *http.Response) (result AppTemplate, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + // Update update the metadata of an IoT Central application. // Parameters: // resourceGroupName - the name of the resource group that contains the IoT Central application. diff --git a/services/iotcentral/mgmt/2018-09-01/iotcentral/client.go b/services/iotcentral/mgmt/2018-09-01/iotcentral/client.go index 2f1d8942ff70..a925cf1c0f32 100644 --- a/services/iotcentral/mgmt/2018-09-01/iotcentral/client.go +++ b/services/iotcentral/mgmt/2018-09-01/iotcentral/client.go @@ -32,20 +32,22 @@ const ( // BaseClient is the base client for Iotcentral. type BaseClient struct { autorest.Client - BaseURI string - SubscriptionID string + BaseURI string + SubscriptionID string + ApplicationTemplateID string } // New creates an instance of the BaseClient client. -func New(subscriptionID string) BaseClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) +func New(subscriptionID string, applicationTemplateID string) BaseClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID, applicationTemplateID) } // NewWithBaseURI creates an instance of the BaseClient client. -func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { +func NewWithBaseURI(baseURI string, subscriptionID string, applicationTemplateID string) BaseClient { return BaseClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + ApplicationTemplateID: applicationTemplateID, } } diff --git a/services/iotcentral/mgmt/2018-09-01/iotcentral/iotcentralapi/interfaces.go b/services/iotcentral/mgmt/2018-09-01/iotcentral/iotcentralapi/interfaces.go index e29f9e512546..edd04c660b04 100644 --- a/services/iotcentral/mgmt/2018-09-01/iotcentral/iotcentralapi/interfaces.go +++ b/services/iotcentral/mgmt/2018-09-01/iotcentral/iotcentralapi/interfaces.go @@ -32,6 +32,7 @@ type AppsClientAPI interface { ListByResourceGroup(ctx context.Context, resourceGroupName string) (result iotcentral.AppListResultPage, err error) ListBySubscription(ctx context.Context) (result iotcentral.AppListResultPage, err error) ListTemplates(ctx context.Context) (result iotcentral.AppTemplatesResultPage, err error) + Template(ctx context.Context) (result iotcentral.AppTemplate, err error) Update(ctx context.Context, resourceGroupName string, resourceName string, appPatch iotcentral.AppPatch) (result iotcentral.AppsUpdateFuture, err error) } diff --git a/services/iotcentral/mgmt/2018-09-01/iotcentral/models.go b/services/iotcentral/mgmt/2018-09-01/iotcentral/models.go index 54ae6e7ee52a..28dabef77130 100644 --- a/services/iotcentral/mgmt/2018-09-01/iotcentral/models.go +++ b/services/iotcentral/mgmt/2018-09-01/iotcentral/models.go @@ -479,6 +479,7 @@ func (future *AppsUpdateFuture) Result(client AppsClient) (a App, err error) { // AppTemplate ioT Central Application Template. type AppTemplate struct { + autorest.Response `json:"-"` // ManifestID - The ID of the template. ManifestID *string `json:"manifestId,omitempty"` // ManifestVersion - The version of the template. @@ -496,7 +497,7 @@ type AppTemplate struct { // AppTemplatesResult a list of IoT Central Application Templates with a next link. type AppTemplatesResult struct { autorest.Response `json:"-"` - // NextLink - The link used to get the next page of IoT Central description objects. + // NextLink - The link used to get the next page of IoT Central application templates. NextLink *string `json:"nextLink,omitempty"` // Value - A list of IoT Central Application Templates. Value *[]AppTemplate `json:"value,omitempty"` diff --git a/services/iotcentral/mgmt/2018-09-01/iotcentral/operations.go b/services/iotcentral/mgmt/2018-09-01/iotcentral/operations.go index 257aac200406..5c4f2dff75e3 100644 --- a/services/iotcentral/mgmt/2018-09-01/iotcentral/operations.go +++ b/services/iotcentral/mgmt/2018-09-01/iotcentral/operations.go @@ -31,13 +31,13 @@ type OperationsClient struct { } // NewOperationsClient creates an instance of the OperationsClient client. -func NewOperationsClient(subscriptionID string) OperationsClient { - return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +func NewOperationsClient(subscriptionID string, applicationTemplateID string) OperationsClient { + return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID, applicationTemplateID) } // NewOperationsClientWithBaseURI creates an instance of the OperationsClient client. -func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { - return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string, applicationTemplateID string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID, applicationTemplateID)} } // List lists all of the available IoT Central application REST API operations. From 1f1c3a52f01f34b3e5c7fcd590a891da2539dc8b Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Fri, 29 Mar 2019 18:17:50 +0000 Subject: [PATCH 03/10] Generated from 082507c238868ecda88f3939d399f3b29cd7357b Add IOT central app templates api in swagger --- .../iotcentral/mgmt/iotcentral/models.go | 24 +++++++++---------- .../iotcentral/mgmt/iotcentral/models.go | 24 +++++++++---------- .../mgmt/2018-09-01/iotcentral/apps.go | 19 ++++++++------- .../mgmt/2018-09-01/iotcentral/client.go | 18 +++++++------- .../iotcentral/iotcentralapi/interfaces.go | 2 +- .../mgmt/2018-09-01/iotcentral/operations.go | 8 +++---- 6 files changed, 48 insertions(+), 47 deletions(-) diff --git a/profiles/latest/iotcentral/mgmt/iotcentral/models.go b/profiles/latest/iotcentral/mgmt/iotcentral/models.go index 9bf7c1efe5b6..7d03f897bccd 100644 --- a/profiles/latest/iotcentral/mgmt/iotcentral/models.go +++ b/profiles/latest/iotcentral/mgmt/iotcentral/models.go @@ -64,8 +64,8 @@ type OperationListResultPage = original.OperationListResultPage type OperationsClient = original.OperationsClient type Resource = original.Resource -func New(subscriptionID string, applicationTemplateID string) BaseClient { - return original.New(subscriptionID, applicationTemplateID) +func New(subscriptionID string) BaseClient { + return original.New(subscriptionID) } func NewAppListResultIterator(page AppListResultPage) AppListResultIterator { return original.NewAppListResultIterator(page) @@ -79,11 +79,11 @@ func NewAppTemplatesResultIterator(page AppTemplatesResultPage) AppTemplatesResu func NewAppTemplatesResultPage(getNextPage func(context.Context, AppTemplatesResult) (AppTemplatesResult, error)) AppTemplatesResultPage { return original.NewAppTemplatesResultPage(getNextPage) } -func NewAppsClient(subscriptionID string, applicationTemplateID string) AppsClient { - return original.NewAppsClient(subscriptionID, applicationTemplateID) +func NewAppsClient(subscriptionID string) AppsClient { + return original.NewAppsClient(subscriptionID) } -func NewAppsClientWithBaseURI(baseURI string, subscriptionID string, applicationTemplateID string) AppsClient { - return original.NewAppsClientWithBaseURI(baseURI, subscriptionID, applicationTemplateID) +func NewAppsClientWithBaseURI(baseURI string, subscriptionID string) AppsClient { + return original.NewAppsClientWithBaseURI(baseURI, subscriptionID) } func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { return original.NewOperationListResultIterator(page) @@ -91,14 +91,14 @@ func NewOperationListResultIterator(page OperationListResultPage) OperationListR func NewOperationListResultPage(getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { return original.NewOperationListResultPage(getNextPage) } -func NewOperationsClient(subscriptionID string, applicationTemplateID string) OperationsClient { - return original.NewOperationsClient(subscriptionID, applicationTemplateID) +func NewOperationsClient(subscriptionID string) OperationsClient { + return original.NewOperationsClient(subscriptionID) } -func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string, applicationTemplateID string) OperationsClient { - return original.NewOperationsClientWithBaseURI(baseURI, subscriptionID, applicationTemplateID) +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return original.NewOperationsClientWithBaseURI(baseURI, subscriptionID) } -func NewWithBaseURI(baseURI string, subscriptionID string, applicationTemplateID string) BaseClient { - return original.NewWithBaseURI(baseURI, subscriptionID, applicationTemplateID) +func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { + return original.NewWithBaseURI(baseURI, subscriptionID) } func PossibleAppSkuValues() []AppSku { return original.PossibleAppSkuValues() diff --git a/profiles/preview/iotcentral/mgmt/iotcentral/models.go b/profiles/preview/iotcentral/mgmt/iotcentral/models.go index 5f6bc55ac5d6..820d6b91ec50 100644 --- a/profiles/preview/iotcentral/mgmt/iotcentral/models.go +++ b/profiles/preview/iotcentral/mgmt/iotcentral/models.go @@ -64,8 +64,8 @@ type OperationListResultPage = original.OperationListResultPage type OperationsClient = original.OperationsClient type Resource = original.Resource -func New(subscriptionID string, applicationTemplateID string) BaseClient { - return original.New(subscriptionID, applicationTemplateID) +func New(subscriptionID string) BaseClient { + return original.New(subscriptionID) } func NewAppListResultIterator(page AppListResultPage) AppListResultIterator { return original.NewAppListResultIterator(page) @@ -79,11 +79,11 @@ func NewAppTemplatesResultIterator(page AppTemplatesResultPage) AppTemplatesResu func NewAppTemplatesResultPage(getNextPage func(context.Context, AppTemplatesResult) (AppTemplatesResult, error)) AppTemplatesResultPage { return original.NewAppTemplatesResultPage(getNextPage) } -func NewAppsClient(subscriptionID string, applicationTemplateID string) AppsClient { - return original.NewAppsClient(subscriptionID, applicationTemplateID) +func NewAppsClient(subscriptionID string) AppsClient { + return original.NewAppsClient(subscriptionID) } -func NewAppsClientWithBaseURI(baseURI string, subscriptionID string, applicationTemplateID string) AppsClient { - return original.NewAppsClientWithBaseURI(baseURI, subscriptionID, applicationTemplateID) +func NewAppsClientWithBaseURI(baseURI string, subscriptionID string) AppsClient { + return original.NewAppsClientWithBaseURI(baseURI, subscriptionID) } func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { return original.NewOperationListResultIterator(page) @@ -91,14 +91,14 @@ func NewOperationListResultIterator(page OperationListResultPage) OperationListR func NewOperationListResultPage(getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { return original.NewOperationListResultPage(getNextPage) } -func NewOperationsClient(subscriptionID string, applicationTemplateID string) OperationsClient { - return original.NewOperationsClient(subscriptionID, applicationTemplateID) +func NewOperationsClient(subscriptionID string) OperationsClient { + return original.NewOperationsClient(subscriptionID) } -func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string, applicationTemplateID string) OperationsClient { - return original.NewOperationsClientWithBaseURI(baseURI, subscriptionID, applicationTemplateID) +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return original.NewOperationsClientWithBaseURI(baseURI, subscriptionID) } -func NewWithBaseURI(baseURI string, subscriptionID string, applicationTemplateID string) BaseClient { - return original.NewWithBaseURI(baseURI, subscriptionID, applicationTemplateID) +func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { + return original.NewWithBaseURI(baseURI, subscriptionID) } func PossibleAppSkuValues() []AppSku { return original.PossibleAppSkuValues() diff --git a/services/iotcentral/mgmt/2018-09-01/iotcentral/apps.go b/services/iotcentral/mgmt/2018-09-01/iotcentral/apps.go index d38c9acbdae5..ca9640a29538 100644 --- a/services/iotcentral/mgmt/2018-09-01/iotcentral/apps.go +++ b/services/iotcentral/mgmt/2018-09-01/iotcentral/apps.go @@ -32,13 +32,13 @@ type AppsClient struct { } // NewAppsClient creates an instance of the AppsClient client. -func NewAppsClient(subscriptionID string, applicationTemplateID string) AppsClient { - return NewAppsClientWithBaseURI(DefaultBaseURI, subscriptionID, applicationTemplateID) +func NewAppsClient(subscriptionID string) AppsClient { + return NewAppsClientWithBaseURI(DefaultBaseURI, subscriptionID) } // NewAppsClientWithBaseURI creates an instance of the AppsClient client. -func NewAppsClientWithBaseURI(baseURI string, subscriptionID string, applicationTemplateID string) AppsClient { - return AppsClient{NewWithBaseURI(baseURI, subscriptionID, applicationTemplateID)} +func NewAppsClientWithBaseURI(baseURI string, subscriptionID string) AppsClient { + return AppsClient{NewWithBaseURI(baseURI, subscriptionID)} } // CheckNameAvailability check if an IoT Central application name is available. @@ -790,7 +790,10 @@ func (client AppsClient) ListTemplatesComplete(ctx context.Context) (result AppT } // Template get a single application template. -func (client AppsClient) Template(ctx context.Context) (result AppTemplate, err error) { +// Parameters: +// applicationTemplateID - the combination id of manifestId and manifestVersion of the IoT Central application +// template. +func (client AppsClient) Template(ctx context.Context, applicationTemplateID string) (result AppTemplate, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.Template") defer func() { @@ -801,7 +804,7 @@ func (client AppsClient) Template(ctx context.Context) (result AppTemplate, err tracing.EndSpan(ctx, sc, err) }() } - req, err := client.TemplatePreparer(ctx) + req, err := client.TemplatePreparer(ctx, applicationTemplateID) if err != nil { err = autorest.NewErrorWithError(err, "iotcentral.AppsClient", "Template", nil, "Failure preparing request") return @@ -823,9 +826,9 @@ func (client AppsClient) Template(ctx context.Context) (result AppTemplate, err } // TemplatePreparer prepares the Template request. -func (client AppsClient) TemplatePreparer(ctx context.Context) (*http.Request, error) { +func (client AppsClient) TemplatePreparer(ctx context.Context, applicationTemplateID string) (*http.Request, error) { pathParameters := map[string]interface{}{ - "applicationTemplateId": autorest.Encode("path", client.ApplicationTemplateID), + "applicationTemplateId": autorest.Encode("path", applicationTemplateID), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } diff --git a/services/iotcentral/mgmt/2018-09-01/iotcentral/client.go b/services/iotcentral/mgmt/2018-09-01/iotcentral/client.go index a925cf1c0f32..2f1d8942ff70 100644 --- a/services/iotcentral/mgmt/2018-09-01/iotcentral/client.go +++ b/services/iotcentral/mgmt/2018-09-01/iotcentral/client.go @@ -32,22 +32,20 @@ const ( // BaseClient is the base client for Iotcentral. type BaseClient struct { autorest.Client - BaseURI string - SubscriptionID string - ApplicationTemplateID string + BaseURI string + SubscriptionID string } // New creates an instance of the BaseClient client. -func New(subscriptionID string, applicationTemplateID string) BaseClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID, applicationTemplateID) +func New(subscriptionID string) BaseClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) } // NewWithBaseURI creates an instance of the BaseClient client. -func NewWithBaseURI(baseURI string, subscriptionID string, applicationTemplateID string) BaseClient { +func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { return BaseClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - ApplicationTemplateID: applicationTemplateID, + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, } } diff --git a/services/iotcentral/mgmt/2018-09-01/iotcentral/iotcentralapi/interfaces.go b/services/iotcentral/mgmt/2018-09-01/iotcentral/iotcentralapi/interfaces.go index edd04c660b04..2fc64563d309 100644 --- a/services/iotcentral/mgmt/2018-09-01/iotcentral/iotcentralapi/interfaces.go +++ b/services/iotcentral/mgmt/2018-09-01/iotcentral/iotcentralapi/interfaces.go @@ -32,7 +32,7 @@ type AppsClientAPI interface { ListByResourceGroup(ctx context.Context, resourceGroupName string) (result iotcentral.AppListResultPage, err error) ListBySubscription(ctx context.Context) (result iotcentral.AppListResultPage, err error) ListTemplates(ctx context.Context) (result iotcentral.AppTemplatesResultPage, err error) - Template(ctx context.Context) (result iotcentral.AppTemplate, err error) + Template(ctx context.Context, applicationTemplateID string) (result iotcentral.AppTemplate, err error) Update(ctx context.Context, resourceGroupName string, resourceName string, appPatch iotcentral.AppPatch) (result iotcentral.AppsUpdateFuture, err error) } diff --git a/services/iotcentral/mgmt/2018-09-01/iotcentral/operations.go b/services/iotcentral/mgmt/2018-09-01/iotcentral/operations.go index 5c4f2dff75e3..257aac200406 100644 --- a/services/iotcentral/mgmt/2018-09-01/iotcentral/operations.go +++ b/services/iotcentral/mgmt/2018-09-01/iotcentral/operations.go @@ -31,13 +31,13 @@ type OperationsClient struct { } // NewOperationsClient creates an instance of the OperationsClient client. -func NewOperationsClient(subscriptionID string, applicationTemplateID string) OperationsClient { - return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID, applicationTemplateID) +func NewOperationsClient(subscriptionID string) OperationsClient { + return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) } // NewOperationsClientWithBaseURI creates an instance of the OperationsClient client. -func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string, applicationTemplateID string) OperationsClient { - return OperationsClient{NewWithBaseURI(baseURI, subscriptionID, applicationTemplateID)} +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} } // List lists all of the available IoT Central application REST API operations. From 7dfe3549722ba3021b470a84c9762ff48f9f6b8c Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Tue, 2 Apr 2019 00:35:18 +0000 Subject: [PATCH 04/10] Generated from 0f29b0bcc604ba3c29a2865ffe656068ef1268ad Add IOT central app templates api in swagger --- .../mgmt/2018-09-01/iotcentral/apps.go | 78 +------------------ .../iotcentral/iotcentralapi/interfaces.go | 1 - .../mgmt/2018-09-01/iotcentral/models.go | 37 ++++++--- 3 files changed, 26 insertions(+), 90 deletions(-) diff --git a/services/iotcentral/mgmt/2018-09-01/iotcentral/apps.go b/services/iotcentral/mgmt/2018-09-01/iotcentral/apps.go index ca9640a29538..48358dbe39e5 100644 --- a/services/iotcentral/mgmt/2018-09-01/iotcentral/apps.go +++ b/services/iotcentral/mgmt/2018-09-01/iotcentral/apps.go @@ -727,7 +727,7 @@ func (client AppsClient) ListTemplatesPreparer(ctx context.Context) (*http.Reque preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.IoTCentral/applicationTemplates", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.IoTCentral/IoTAppTemplates", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -789,82 +789,6 @@ func (client AppsClient) ListTemplatesComplete(ctx context.Context) (result AppT return } -// Template get a single application template. -// Parameters: -// applicationTemplateID - the combination id of manifestId and manifestVersion of the IoT Central application -// template. -func (client AppsClient) Template(ctx context.Context, applicationTemplateID string) (result AppTemplate, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.Template") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.TemplatePreparer(ctx, applicationTemplateID) - if err != nil { - err = autorest.NewErrorWithError(err, "iotcentral.AppsClient", "Template", nil, "Failure preparing request") - return - } - - resp, err := client.TemplateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "iotcentral.AppsClient", "Template", resp, "Failure sending request") - return - } - - result, err = client.TemplateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "iotcentral.AppsClient", "Template", resp, "Failure responding to request") - } - - return -} - -// TemplatePreparer prepares the Template request. -func (client AppsClient) TemplatePreparer(ctx context.Context, applicationTemplateID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationTemplateId": autorest.Encode("path", applicationTemplateID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.IoTCentral/applicationTemplates/{applicationTemplateId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// TemplateSender sends the Template request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) TemplateSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req, - azure.DoRetryWithRegistration(client.Client)) -} - -// TemplateResponder handles the response to the Template request. The method always -// closes the http.Response Body. -func (client AppsClient) TemplateResponder(resp *http.Response) (result AppTemplate, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - // Update update the metadata of an IoT Central application. // Parameters: // resourceGroupName - the name of the resource group that contains the IoT Central application. diff --git a/services/iotcentral/mgmt/2018-09-01/iotcentral/iotcentralapi/interfaces.go b/services/iotcentral/mgmt/2018-09-01/iotcentral/iotcentralapi/interfaces.go index 2fc64563d309..e29f9e512546 100644 --- a/services/iotcentral/mgmt/2018-09-01/iotcentral/iotcentralapi/interfaces.go +++ b/services/iotcentral/mgmt/2018-09-01/iotcentral/iotcentralapi/interfaces.go @@ -32,7 +32,6 @@ type AppsClientAPI interface { ListByResourceGroup(ctx context.Context, resourceGroupName string) (result iotcentral.AppListResultPage, err error) ListBySubscription(ctx context.Context) (result iotcentral.AppListResultPage, err error) ListTemplates(ctx context.Context) (result iotcentral.AppTemplatesResultPage, err error) - Template(ctx context.Context, applicationTemplateID string) (result iotcentral.AppTemplate, err error) Update(ctx context.Context, resourceGroupName string, resourceName string, appPatch iotcentral.AppPatch) (result iotcentral.AppsUpdateFuture, err error) } diff --git a/services/iotcentral/mgmt/2018-09-01/iotcentral/models.go b/services/iotcentral/mgmt/2018-09-01/iotcentral/models.go index 28dabef77130..b200a9425b50 100644 --- a/services/iotcentral/mgmt/2018-09-01/iotcentral/models.go +++ b/services/iotcentral/mgmt/2018-09-01/iotcentral/models.go @@ -479,19 +479,32 @@ func (future *AppsUpdateFuture) Result(client AppsClient) (a App, err error) { // AppTemplate ioT Central Application Template. type AppTemplate struct { - autorest.Response `json:"-"` - // ManifestID - The ID of the template. - ManifestID *string `json:"manifestId,omitempty"` - // ManifestVersion - The version of the template. - ManifestVersion *string `json:"manifestVersion,omitempty"` - // Name - The name of the template. + // ID - The application template identifier. + ID *string `json:"id,omitempty"` + // Name - The application template name. Name *string `json:"name,omitempty"` - // Title - The title of the template. - Title *string `json:"title,omitempty"` - // Order - The order of the template in the templates list. - Order *float64 `json:"order,omitempty"` - // Description - The description of the template. - Description *string `json:"description,omitempty"` + // Properties - The extra template properties. + Properties map[string]*string `json:"properties"` + // Type - the resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for AppTemplate. +func (at AppTemplate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if at.ID != nil { + objectMap["id"] = at.ID + } + if at.Name != nil { + objectMap["name"] = at.Name + } + if at.Properties != nil { + objectMap["properties"] = at.Properties + } + if at.Type != nil { + objectMap["type"] = at.Type + } + return json.Marshal(objectMap) } // AppTemplatesResult a list of IoT Central Application Templates with a next link. From 3620b87e8b68499a97dd7736d063350da83b8a8d Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Wed, 3 Apr 2019 00:47:29 +0000 Subject: [PATCH 05/10] Generated from 7745b03ac8bc3dd4f075b73c9dd4e1bc836af43c Add IOT central app templates api in swagger --- .../iotcentral/mgmt/iotcentral/models.go | 1 + .../iotcentral/mgmt/iotcentral/models.go | 1 + .../mgmt/2018-09-01/iotcentral/models.go | 35 +++++++++---------- 3 files changed, 18 insertions(+), 19 deletions(-) diff --git a/profiles/latest/iotcentral/mgmt/iotcentral/models.go b/profiles/latest/iotcentral/mgmt/iotcentral/models.go index 7d03f897bccd..533f4aab7e65 100644 --- a/profiles/latest/iotcentral/mgmt/iotcentral/models.go +++ b/profiles/latest/iotcentral/mgmt/iotcentral/models.go @@ -45,6 +45,7 @@ type AppPatch = original.AppPatch type AppProperties = original.AppProperties type AppSkuInfo = original.AppSkuInfo type AppTemplate = original.AppTemplate +type AppTemplateProperties = original.AppTemplateProperties type AppTemplatesResult = original.AppTemplatesResult type AppTemplatesResultIterator = original.AppTemplatesResultIterator type AppTemplatesResultPage = original.AppTemplatesResultPage diff --git a/profiles/preview/iotcentral/mgmt/iotcentral/models.go b/profiles/preview/iotcentral/mgmt/iotcentral/models.go index 820d6b91ec50..2ad5e84a8df2 100644 --- a/profiles/preview/iotcentral/mgmt/iotcentral/models.go +++ b/profiles/preview/iotcentral/mgmt/iotcentral/models.go @@ -45,6 +45,7 @@ type AppPatch = original.AppPatch type AppProperties = original.AppProperties type AppSkuInfo = original.AppSkuInfo type AppTemplate = original.AppTemplate +type AppTemplateProperties = original.AppTemplateProperties type AppTemplatesResult = original.AppTemplatesResult type AppTemplatesResultIterator = original.AppTemplatesResultIterator type AppTemplatesResultPage = original.AppTemplatesResultPage diff --git a/services/iotcentral/mgmt/2018-09-01/iotcentral/models.go b/services/iotcentral/mgmt/2018-09-01/iotcentral/models.go index b200a9425b50..35aa2c7c6ff1 100644 --- a/services/iotcentral/mgmt/2018-09-01/iotcentral/models.go +++ b/services/iotcentral/mgmt/2018-09-01/iotcentral/models.go @@ -482,29 +482,26 @@ type AppTemplate struct { // ID - The application template identifier. ID *string `json:"id,omitempty"` // Name - The application template name. - Name *string `json:"name,omitempty"` - // Properties - The extra template properties. - Properties map[string]*string `json:"properties"` + Name *string `json:"name,omitempty"` + Properties *AppTemplateProperties `json:"properties,omitempty"` // Type - the resource type. Type *string `json:"type,omitempty"` } -// MarshalJSON is the custom marshaler for AppTemplate. -func (at AppTemplate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if at.ID != nil { - objectMap["id"] = at.ID - } - if at.Name != nil { - objectMap["name"] = at.Name - } - if at.Properties != nil { - objectMap["properties"] = at.Properties - } - if at.Type != nil { - objectMap["type"] = at.Type - } - return json.Marshal(objectMap) +// AppTemplateProperties ioT Central Application Template extra properties. +type AppTemplateProperties struct { + // ManifestID - The ID of the template. + ManifestID *string `json:"manifestId,omitempty"` + // ManifestVersion - The version of the template. + ManifestVersion *string `json:"manifestVersion,omitempty"` + // AppTemplateName - The name of the template. + AppTemplateName *string `json:"appTemplateName,omitempty"` + // Title - The title of the template. + Title *string `json:"title,omitempty"` + // Order - The order of the template in the templates list. + Order *float64 `json:"order,omitempty"` + // Description - The description of the template. + Description *string `json:"description,omitempty"` } // AppTemplatesResult a list of IoT Central Application Templates with a next link. From 0ca6740a12223b002190acde6e3e851973c657e3 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Thu, 4 Apr 2019 18:39:44 +0000 Subject: [PATCH 06/10] Generated from ac2b292a363835a462b70d9584bf9ed034caaf79 Add IOT central app templates api in swagger --- services/iotcentral/mgmt/2018-09-01/iotcentral/apps.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/iotcentral/mgmt/2018-09-01/iotcentral/apps.go b/services/iotcentral/mgmt/2018-09-01/iotcentral/apps.go index 48358dbe39e5..8cef86c3771c 100644 --- a/services/iotcentral/mgmt/2018-09-01/iotcentral/apps.go +++ b/services/iotcentral/mgmt/2018-09-01/iotcentral/apps.go @@ -727,7 +727,7 @@ func (client AppsClient) ListTemplatesPreparer(ctx context.Context) (*http.Reque preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.IoTCentral/IoTAppTemplates", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.IoTCentral/iotAppTemplates", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } From 000fdbeab591142b982245a7bf7cae0d88f0b38f Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Fri, 5 Apr 2019 22:46:58 +0000 Subject: [PATCH 07/10] Generated from 66640921aa9ef9577358e42d8c391df9e3ef70f6 Add IOT central app templates api in swagger --- profiles/latest/iotcentral/mgmt/iotcentral/models.go | 1 - profiles/preview/iotcentral/mgmt/iotcentral/models.go | 1 - .../iotcentral/mgmt/2018-09-01/iotcentral/models.go | 11 ----------- 3 files changed, 13 deletions(-) diff --git a/profiles/latest/iotcentral/mgmt/iotcentral/models.go b/profiles/latest/iotcentral/mgmt/iotcentral/models.go index 533f4aab7e65..7d03f897bccd 100644 --- a/profiles/latest/iotcentral/mgmt/iotcentral/models.go +++ b/profiles/latest/iotcentral/mgmt/iotcentral/models.go @@ -45,7 +45,6 @@ type AppPatch = original.AppPatch type AppProperties = original.AppProperties type AppSkuInfo = original.AppSkuInfo type AppTemplate = original.AppTemplate -type AppTemplateProperties = original.AppTemplateProperties type AppTemplatesResult = original.AppTemplatesResult type AppTemplatesResultIterator = original.AppTemplatesResultIterator type AppTemplatesResultPage = original.AppTemplatesResultPage diff --git a/profiles/preview/iotcentral/mgmt/iotcentral/models.go b/profiles/preview/iotcentral/mgmt/iotcentral/models.go index 2ad5e84a8df2..820d6b91ec50 100644 --- a/profiles/preview/iotcentral/mgmt/iotcentral/models.go +++ b/profiles/preview/iotcentral/mgmt/iotcentral/models.go @@ -45,7 +45,6 @@ type AppPatch = original.AppPatch type AppProperties = original.AppProperties type AppSkuInfo = original.AppSkuInfo type AppTemplate = original.AppTemplate -type AppTemplateProperties = original.AppTemplateProperties type AppTemplatesResult = original.AppTemplatesResult type AppTemplatesResultIterator = original.AppTemplatesResultIterator type AppTemplatesResultPage = original.AppTemplatesResultPage diff --git a/services/iotcentral/mgmt/2018-09-01/iotcentral/models.go b/services/iotcentral/mgmt/2018-09-01/iotcentral/models.go index 35aa2c7c6ff1..0b7bf42aceee 100644 --- a/services/iotcentral/mgmt/2018-09-01/iotcentral/models.go +++ b/services/iotcentral/mgmt/2018-09-01/iotcentral/models.go @@ -479,17 +479,6 @@ func (future *AppsUpdateFuture) Result(client AppsClient) (a App, err error) { // AppTemplate ioT Central Application Template. type AppTemplate struct { - // ID - The application template identifier. - ID *string `json:"id,omitempty"` - // Name - The application template name. - Name *string `json:"name,omitempty"` - Properties *AppTemplateProperties `json:"properties,omitempty"` - // Type - the resource type. - Type *string `json:"type,omitempty"` -} - -// AppTemplateProperties ioT Central Application Template extra properties. -type AppTemplateProperties struct { // ManifestID - The ID of the template. ManifestID *string `json:"manifestId,omitempty"` // ManifestVersion - The version of the template. From 60edbdb11408f62bb92f1c79a39799848c0abe40 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Sat, 6 Apr 2019 00:33:36 +0000 Subject: [PATCH 08/10] Generated from 8efefea00974cba205037fb4f6aeb091f862797c Add IOT central app templates api in swagger --- services/iotcentral/mgmt/2018-09-01/iotcentral/apps.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/iotcentral/mgmt/2018-09-01/iotcentral/apps.go b/services/iotcentral/mgmt/2018-09-01/iotcentral/apps.go index 8cef86c3771c..48358dbe39e5 100644 --- a/services/iotcentral/mgmt/2018-09-01/iotcentral/apps.go +++ b/services/iotcentral/mgmt/2018-09-01/iotcentral/apps.go @@ -727,7 +727,7 @@ func (client AppsClient) ListTemplatesPreparer(ctx context.Context) (*http.Reque preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.IoTCentral/iotAppTemplates", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.IoTCentral/IoTAppTemplates", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } From 425cc8635e13ee57a0e2653475ac8153d3ff9381 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Tue, 9 Apr 2019 04:04:16 +0000 Subject: [PATCH 09/10] Generated from e912d4598cda4beb626ed7e33c59ff7bb89ef4d1 Add IOT central app templates api in swagger --- services/iotcentral/mgmt/2018-09-01/iotcentral/apps.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/iotcentral/mgmt/2018-09-01/iotcentral/apps.go b/services/iotcentral/mgmt/2018-09-01/iotcentral/apps.go index 48358dbe39e5..4c30bcdb90ed 100644 --- a/services/iotcentral/mgmt/2018-09-01/iotcentral/apps.go +++ b/services/iotcentral/mgmt/2018-09-01/iotcentral/apps.go @@ -725,7 +725,7 @@ func (client AppsClient) ListTemplatesPreparer(ctx context.Context) (*http.Reque } preparer := autorest.CreatePreparer( - autorest.AsGet(), + autorest.AsPost(), autorest.WithBaseURL(client.BaseURI), autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.IoTCentral/IoTAppTemplates", pathParameters), autorest.WithQueryParameters(queryParameters)) From d55e4793fc692bcb0661b875303da389ba507ec7 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Wed, 10 Apr 2019 20:44:11 +0000 Subject: [PATCH 10/10] Generated from 4fc48948542c87996ffc1db30e5b58f9697e97be Add IOT central app templates api in swagger --- services/iotcentral/mgmt/2018-09-01/iotcentral/apps.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/iotcentral/mgmt/2018-09-01/iotcentral/apps.go b/services/iotcentral/mgmt/2018-09-01/iotcentral/apps.go index 4c30bcdb90ed..3717054ff4c3 100644 --- a/services/iotcentral/mgmt/2018-09-01/iotcentral/apps.go +++ b/services/iotcentral/mgmt/2018-09-01/iotcentral/apps.go @@ -727,7 +727,7 @@ func (client AppsClient) ListTemplatesPreparer(ctx context.Context) (*http.Reque preparer := autorest.CreatePreparer( autorest.AsPost(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.IoTCentral/IoTAppTemplates", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.IoTCentral/appTemplates", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) }