diff --git a/profiles/latest/serialconsole/mgmt/serialconsole/models.go b/profiles/latest/serialconsole/mgmt/serialconsole/models.go new file mode 100644 index 000000000000..01d78fe04ae4 --- /dev/null +++ b/profiles/latest/serialconsole/mgmt/serialconsole/models.go @@ -0,0 +1,67 @@ +// +build go1.9 + +// Copyright 2019 Microsoft Corporation +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// This code was auto-generated by: +// github.com/Azure/azure-sdk-for-go/tools/profileBuilder + +package serialconsole + +import original "github.com/Azure/azure-sdk-for-go/services/serialconsole/mgmt/2018-05-01/serialconsole" + +const ( + DefaultBaseURI = original.DefaultBaseURI +) + +type BaseClient = original.BaseClient +type ConsoleClient = original.ConsoleClient +type DeploymentValidateResult = original.DeploymentValidateResult +type GetDisabledResult = original.GetDisabledResult +type GetResult = original.GetResult +type ListClient = original.ListClient +type ListConsoleClient = original.ListConsoleClient +type Operations = original.Operations +type SetDisabledResult = original.SetDisabledResult + +func New(subscriptionID string) BaseClient { + return original.New(subscriptionID) +} +func NewConsoleClient(subscriptionID string) ConsoleClient { + return original.NewConsoleClient(subscriptionID) +} +func NewConsoleClientWithBaseURI(baseURI string, subscriptionID string) ConsoleClient { + return original.NewConsoleClientWithBaseURI(baseURI, subscriptionID) +} +func NewListClient(subscriptionID string) ListClient { + return original.NewListClient(subscriptionID) +} +func NewListClientWithBaseURI(baseURI string, subscriptionID string) ListClient { + return original.NewListClientWithBaseURI(baseURI, subscriptionID) +} +func NewListConsoleClient(subscriptionID string) ListConsoleClient { + return original.NewListConsoleClient(subscriptionID) +} +func NewListConsoleClientWithBaseURI(baseURI string, subscriptionID string) ListConsoleClient { + return original.NewListConsoleClientWithBaseURI(baseURI, subscriptionID) +} +func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { + return original.NewWithBaseURI(baseURI, subscriptionID) +} +func UserAgent() string { + return original.UserAgent() + " profiles/latest" +} +func Version() string { + return original.Version() +} diff --git a/profiles/latest/serialconsole/mgmt/serialconsole/serialconsoleapi/models.go b/profiles/latest/serialconsole/mgmt/serialconsole/serialconsoleapi/models.go new file mode 100644 index 000000000000..1d3c2872f688 --- /dev/null +++ b/profiles/latest/serialconsole/mgmt/serialconsole/serialconsoleapi/models.go @@ -0,0 +1,26 @@ +// +build go1.9 + +// Copyright 2019 Microsoft Corporation +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// This code was auto-generated by: +// github.com/Azure/azure-sdk-for-go/tools/profileBuilder + +package serialconsoleapi + +import original "github.com/Azure/azure-sdk-for-go/services/serialconsole/mgmt/2018-05-01/serialconsole/serialconsoleapi" + +type ConsoleClientAPI = original.ConsoleClientAPI +type ListClientAPI = original.ListClientAPI +type ListConsoleClientAPI = original.ListConsoleClientAPI diff --git a/profiles/preview/serialconsole/mgmt/serialconsole/models.go b/profiles/preview/serialconsole/mgmt/serialconsole/models.go new file mode 100644 index 000000000000..7ef307a409a5 --- /dev/null +++ b/profiles/preview/serialconsole/mgmt/serialconsole/models.go @@ -0,0 +1,67 @@ +// +build go1.9 + +// Copyright 2019 Microsoft Corporation +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// This code was auto-generated by: +// github.com/Azure/azure-sdk-for-go/tools/profileBuilder + +package serialconsole + +import original "github.com/Azure/azure-sdk-for-go/services/serialconsole/mgmt/2018-05-01/serialconsole" + +const ( + DefaultBaseURI = original.DefaultBaseURI +) + +type BaseClient = original.BaseClient +type ConsoleClient = original.ConsoleClient +type DeploymentValidateResult = original.DeploymentValidateResult +type GetDisabledResult = original.GetDisabledResult +type GetResult = original.GetResult +type ListClient = original.ListClient +type ListConsoleClient = original.ListConsoleClient +type Operations = original.Operations +type SetDisabledResult = original.SetDisabledResult + +func New(subscriptionID string) BaseClient { + return original.New(subscriptionID) +} +func NewConsoleClient(subscriptionID string) ConsoleClient { + return original.NewConsoleClient(subscriptionID) +} +func NewConsoleClientWithBaseURI(baseURI string, subscriptionID string) ConsoleClient { + return original.NewConsoleClientWithBaseURI(baseURI, subscriptionID) +} +func NewListClient(subscriptionID string) ListClient { + return original.NewListClient(subscriptionID) +} +func NewListClientWithBaseURI(baseURI string, subscriptionID string) ListClient { + return original.NewListClientWithBaseURI(baseURI, subscriptionID) +} +func NewListConsoleClient(subscriptionID string) ListConsoleClient { + return original.NewListConsoleClient(subscriptionID) +} +func NewListConsoleClientWithBaseURI(baseURI string, subscriptionID string) ListConsoleClient { + return original.NewListConsoleClientWithBaseURI(baseURI, subscriptionID) +} +func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { + return original.NewWithBaseURI(baseURI, subscriptionID) +} +func UserAgent() string { + return original.UserAgent() + " profiles/preview" +} +func Version() string { + return original.Version() +} diff --git a/profiles/preview/serialconsole/mgmt/serialconsole/serialconsoleapi/models.go b/profiles/preview/serialconsole/mgmt/serialconsole/serialconsoleapi/models.go new file mode 100644 index 000000000000..1d3c2872f688 --- /dev/null +++ b/profiles/preview/serialconsole/mgmt/serialconsole/serialconsoleapi/models.go @@ -0,0 +1,26 @@ +// +build go1.9 + +// Copyright 2019 Microsoft Corporation +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// This code was auto-generated by: +// github.com/Azure/azure-sdk-for-go/tools/profileBuilder + +package serialconsoleapi + +import original "github.com/Azure/azure-sdk-for-go/services/serialconsole/mgmt/2018-05-01/serialconsole/serialconsoleapi" + +type ConsoleClientAPI = original.ConsoleClientAPI +type ListClientAPI = original.ListClientAPI +type ListConsoleClientAPI = original.ListConsoleClientAPI diff --git a/services/serialconsole/mgmt/2018-05-01/serialconsole/client.go b/services/serialconsole/mgmt/2018-05-01/serialconsole/client.go new file mode 100644 index 000000000000..33d59a00a544 --- /dev/null +++ b/services/serialconsole/mgmt/2018-05-01/serialconsole/client.go @@ -0,0 +1,51 @@ +// Package serialconsole implements the Azure ARM Serialconsole service API version 2018-05-01. +// +// Azure Virtual Machine Serial Console allows you to access serial console of a Virtual Machine +package serialconsole + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Serialconsole + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Serialconsole. +type BaseClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the BaseClient client. +func New(subscriptionID string) BaseClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the BaseClient client. +func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { + return BaseClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/services/serialconsole/mgmt/2018-05-01/serialconsole/console.go b/services/serialconsole/mgmt/2018-05-01/serialconsole/console.go new file mode 100644 index 000000000000..1eccba23e1b2 --- /dev/null +++ b/services/serialconsole/mgmt/2018-05-01/serialconsole/console.go @@ -0,0 +1,187 @@ +package serialconsole + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ConsoleClient is the azure Virtual Machine Serial Console allows you to access serial console of a Virtual Machine +type ConsoleClient struct { + BaseClient +} + +// NewConsoleClient creates an instance of the ConsoleClient client. +func NewConsoleClient(subscriptionID string) ConsoleClient { + return NewConsoleClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewConsoleClientWithBaseURI creates an instance of the ConsoleClient client. +func NewConsoleClientWithBaseURI(baseURI string, subscriptionID string) ConsoleClient { + return ConsoleClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// DisableConsole disables Serial Console for a subscription +func (client ConsoleClient) DisableConsole(ctx context.Context) (result SetDisabledResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ConsoleClient.DisableConsole") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DisableConsolePreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "serialconsole.ConsoleClient", "DisableConsole", nil, "Failure preparing request") + return + } + + resp, err := client.DisableConsoleSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "serialconsole.ConsoleClient", "DisableConsole", resp, "Failure sending request") + return + } + + result, err = client.DisableConsoleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "serialconsole.ConsoleClient", "DisableConsole", resp, "Failure responding to request") + } + + return +} + +// DisableConsolePreparer prepares the DisableConsole request. +func (client ConsoleClient) DisableConsolePreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "default": autorest.Encode("path", "default"), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.SerialConsole/consoleServices/{default}/disableConsole", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DisableConsoleSender sends the DisableConsole request. The method will close the +// http.Response Body if it receives an error. +func (client ConsoleClient) DisableConsoleSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// DisableConsoleResponder handles the response to the DisableConsole request. The method always +// closes the http.Response Body. +func (client ConsoleClient) DisableConsoleResponder(resp *http.Response) (result SetDisabledResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// EnableConsole enables Serial Console for a subscription +func (client ConsoleClient) EnableConsole(ctx context.Context) (result SetDisabledResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ConsoleClient.EnableConsole") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.EnableConsolePreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "serialconsole.ConsoleClient", "EnableConsole", nil, "Failure preparing request") + return + } + + resp, err := client.EnableConsoleSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "serialconsole.ConsoleClient", "EnableConsole", resp, "Failure sending request") + return + } + + result, err = client.EnableConsoleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "serialconsole.ConsoleClient", "EnableConsole", resp, "Failure responding to request") + } + + return +} + +// EnableConsolePreparer prepares the EnableConsole request. +func (client ConsoleClient) EnableConsolePreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "default": autorest.Encode("path", "default"), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.SerialConsole/consoleServices/{default}/enableConsole", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// EnableConsoleSender sends the EnableConsole request. The method will close the +// http.Response Body if it receives an error. +func (client ConsoleClient) EnableConsoleSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// EnableConsoleResponder handles the response to the EnableConsole request. The method always +// closes the http.Response Body. +func (client ConsoleClient) EnableConsoleResponder(resp *http.Response) (result SetDisabledResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/serialconsole/mgmt/2018-05-01/serialconsole/list.go b/services/serialconsole/mgmt/2018-05-01/serialconsole/list.go new file mode 100644 index 000000000000..23c03bdba50d --- /dev/null +++ b/services/serialconsole/mgmt/2018-05-01/serialconsole/list.go @@ -0,0 +1,113 @@ +package serialconsole + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ListClient is the azure Virtual Machine Serial Console allows you to access serial console of a Virtual Machine +type ListClient struct { + BaseClient +} + +// NewListClient creates an instance of the ListClient client. +func NewListClient(subscriptionID string) ListClient { + return NewListClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewListClientWithBaseURI creates an instance of the ListClient client. +func NewListClientWithBaseURI(baseURI string, subscriptionID string) ListClient { + return ListClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Operations gets a list of Serial Console API operations. +func (client ListClient) Operations(ctx context.Context) (result Operations, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListClient.Operations") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.OperationsPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "serialconsole.ListClient", "Operations", nil, "Failure preparing request") + return + } + + resp, err := client.OperationsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "serialconsole.ListClient", "Operations", resp, "Failure sending request") + return + } + + result, err = client.OperationsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "serialconsole.ListClient", "Operations", resp, "Failure responding to request") + } + + return +} + +// OperationsPreparer prepares the Operations request. +func (client ListClient) OperationsPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.SerialConsole/operations", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// OperationsSender sends the Operations request. The method will close the +// http.Response Body if it receives an error. +func (client ListClient) OperationsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// OperationsResponder handles the response to the Operations request. The method always +// closes the http.Response Body. +func (client ListClient) OperationsResponder(resp *http.Response) (result Operations, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/serialconsole/mgmt/2018-05-01/serialconsole/listconsole.go b/services/serialconsole/mgmt/2018-05-01/serialconsole/listconsole.go new file mode 100644 index 000000000000..eebfd35bcc2d --- /dev/null +++ b/services/serialconsole/mgmt/2018-05-01/serialconsole/listconsole.go @@ -0,0 +1,115 @@ +package serialconsole + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ListConsoleClient is the azure Virtual Machine Serial Console allows you to access serial console of a Virtual +// Machine +type ListConsoleClient struct { + BaseClient +} + +// NewListConsoleClient creates an instance of the ListConsoleClient client. +func NewListConsoleClient(subscriptionID string) ListConsoleClient { + return NewListConsoleClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewListConsoleClientWithBaseURI creates an instance of the ListConsoleClient client. +func NewListConsoleClientWithBaseURI(baseURI string, subscriptionID string) ListConsoleClient { + return ListConsoleClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Disabled gets if Serial Console is disabled for a subscription. +func (client ListConsoleClient) Disabled(ctx context.Context) (result GetDisabledResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListConsoleClient.Disabled") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DisabledPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "serialconsole.ListConsoleClient", "Disabled", nil, "Failure preparing request") + return + } + + resp, err := client.DisabledSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "serialconsole.ListConsoleClient", "Disabled", resp, "Failure sending request") + return + } + + result, err = client.DisabledResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "serialconsole.ListConsoleClient", "Disabled", resp, "Failure responding to request") + } + + return +} + +// DisabledPreparer prepares the Disabled request. +func (client ListConsoleClient) DisabledPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "default": autorest.Encode("path", "default"), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.SerialConsole/consoleServices/{default}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DisabledSender sends the Disabled request. The method will close the +// http.Response Body if it receives an error. +func (client ListConsoleClient) DisabledSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// DisabledResponder handles the response to the Disabled request. The method always +// closes the http.Response Body. +func (client ListConsoleClient) DisabledResponder(resp *http.Response) (result GetDisabledResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/serialconsole/mgmt/2018-05-01/serialconsole/models.go b/services/serialconsole/mgmt/2018-05-01/serialconsole/models.go new file mode 100644 index 000000000000..9f8a937e42d5 --- /dev/null +++ b/services/serialconsole/mgmt/2018-05-01/serialconsole/models.go @@ -0,0 +1,59 @@ +package serialconsole + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +// The package's fully qualified name. +const fqdn = "github.com/Azure/azure-sdk-for-go/services/serialconsole/mgmt/2018-05-01/serialconsole" + +// DeploymentValidateResult details on Failure +type DeploymentValidateResult struct { + // ErrorMessage - Error message + ErrorMessage *string `json:"errorMessage,omitempty"` +} + +// GetDisabledResult returns whether or not Serial Console is disabled for this given subscription +type GetDisabledResult struct { + autorest.Response `json:"-"` + // Disabled - Disabled result + Disabled *bool `json:"disabled,omitempty"` +} + +// GetResult returns whether or not Serial Console is disabled. +type GetResult struct { + // Value - Whether or not Serial Console is disabled. + Value *bool `json:"value,omitempty"` +} + +// Operations serial Console operations +type Operations struct { + autorest.Response `json:"-"` + // Value - Serial Console operations + Value *string `json:"value,omitempty"` +} + +// SetDisabledResult sets disable status and returns whether or not Serial Console is now disabled for this +// given subscription +type SetDisabledResult struct { + autorest.Response `json:"-"` + // Disabled - Disabled result + Disabled *bool `json:"disabled,omitempty"` +} diff --git a/services/serialconsole/mgmt/2018-05-01/serialconsole/serialconsoleapi/interfaces.go b/services/serialconsole/mgmt/2018-05-01/serialconsole/serialconsoleapi/interfaces.go new file mode 100644 index 000000000000..085688c7f15c --- /dev/null +++ b/services/serialconsole/mgmt/2018-05-01/serialconsole/serialconsoleapi/interfaces.go @@ -0,0 +1,45 @@ +package serialconsoleapi + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/services/serialconsole/mgmt/2018-05-01/serialconsole" +) + +// ListClientAPI contains the set of methods on the ListClient type. +type ListClientAPI interface { + Operations(ctx context.Context) (result serialconsole.Operations, err error) +} + +var _ ListClientAPI = (*serialconsole.ListClient)(nil) + +// ListConsoleClientAPI contains the set of methods on the ListConsoleClient type. +type ListConsoleClientAPI interface { + Disabled(ctx context.Context) (result serialconsole.GetDisabledResult, err error) +} + +var _ ListConsoleClientAPI = (*serialconsole.ListConsoleClient)(nil) + +// ConsoleClientAPI contains the set of methods on the ConsoleClient type. +type ConsoleClientAPI interface { + DisableConsole(ctx context.Context) (result serialconsole.SetDisabledResult, err error) + EnableConsole(ctx context.Context) (result serialconsole.SetDisabledResult, err error) +} + +var _ ConsoleClientAPI = (*serialconsole.ConsoleClient)(nil) diff --git a/services/serialconsole/mgmt/2018-05-01/serialconsole/version.go b/services/serialconsole/mgmt/2018-05-01/serialconsole/version.go new file mode 100644 index 000000000000..4a5667d91d6c --- /dev/null +++ b/services/serialconsole/mgmt/2018-05-01/serialconsole/version.go @@ -0,0 +1,30 @@ +package serialconsole + +import "github.com/Azure/azure-sdk-for-go/version" + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/" + version.Number + " serialconsole/2018-05-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +}