vendor: add github.com/Azure/azure-sdk-for-go and dependencies

This commit is contained in:
Nick Craig-Wood
2017-08-04 22:54:27 +01:00
parent 132f71d504
commit 91cfcc21ff
958 changed files with 320589 additions and 0 deletions
+352
View File
@@ -0,0 +1,352 @@
package hdinsight
// 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 1.0.1.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
import (
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure"
"net/http"
)
// ApplicationsClient is the the HDInsight Management Client.
type ApplicationsClient struct {
ManagementClient
}
// NewApplicationsClient creates an instance of the ApplicationsClient client.
func NewApplicationsClient(subscriptionID string) ApplicationsClient {
return NewApplicationsClientWithBaseURI(DefaultBaseURI, subscriptionID)
}
// NewApplicationsClientWithBaseURI creates an instance of the
// ApplicationsClient client.
func NewApplicationsClientWithBaseURI(baseURI string, subscriptionID string) ApplicationsClient {
return ApplicationsClient{NewWithBaseURI(baseURI, subscriptionID)}
}
// Create the operation creates applications for the HDInsight cluster.
//
// resourceGroupName is the name of the resource group. clusterName is the name
// of the cluster. applicationName is the constant value for the
// applicationName parameters is the application create request.
func (client ApplicationsClient) Create(resourceGroupName string, clusterName string, applicationName string, parameters ApplicationGetProperties) (result Application, err error) {
req, err := client.CreatePreparer(resourceGroupName, clusterName, applicationName, parameters)
if err != nil {
err = autorest.NewErrorWithError(err, "hdinsight.ApplicationsClient", "Create", nil, "Failure preparing request")
return
}
resp, err := client.CreateSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "hdinsight.ApplicationsClient", "Create", resp, "Failure sending request")
return
}
result, err = client.CreateResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "hdinsight.ApplicationsClient", "Create", resp, "Failure responding to request")
}
return
}
// CreatePreparer prepares the Create request.
func (client ApplicationsClient) CreatePreparer(resourceGroupName string, clusterName string, applicationName string, parameters ApplicationGetProperties) (*http.Request, error) {
pathParameters := map[string]interface{}{
"applicationName": autorest.Encode("path", applicationName),
"clusterName": autorest.Encode("path", clusterName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2015-03-01-preview"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsJSON(),
autorest.AsPut(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/applications/{applicationName}", pathParameters),
autorest.WithJSON(parameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// CreateSender sends the Create request. The method will close the
// http.Response Body if it receives an error.
func (client ApplicationsClient) CreateSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// CreateResponder handles the response to the Create request. The method always
// closes the http.Response Body.
func (client ApplicationsClient) CreateResponder(resp *http.Response) (result Application, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// Delete lists all of the applications HDInsight cluster. This method may poll
// for completion. Polling can be canceled by passing the cancel channel
// argument. The channel will be used to cancel polling and any outstanding
// HTTP requests.
//
// resourceGroupName is the name of the resource group. clusterName is the name
// of the cluster. applicationName is the constant value for the
// applicationName.
func (client ApplicationsClient) Delete(resourceGroupName string, clusterName string, applicationName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) {
resultChan := make(chan autorest.Response, 1)
errChan := make(chan error, 1)
go func() {
var err error
var result autorest.Response
defer func() {
resultChan <- result
errChan <- err
close(resultChan)
close(errChan)
}()
req, err := client.DeletePreparer(resourceGroupName, clusterName, applicationName, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "hdinsight.ApplicationsClient", "Delete", nil, "Failure preparing request")
return
}
resp, err := client.DeleteSender(req)
if err != nil {
result.Response = resp
err = autorest.NewErrorWithError(err, "hdinsight.ApplicationsClient", "Delete", resp, "Failure sending request")
return
}
result, err = client.DeleteResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "hdinsight.ApplicationsClient", "Delete", resp, "Failure responding to request")
}
}()
return resultChan, errChan
}
// DeletePreparer prepares the Delete request.
func (client ApplicationsClient) DeletePreparer(resourceGroupName string, clusterName string, applicationName string, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"applicationName": autorest.Encode("path", applicationName),
"clusterName": autorest.Encode("path", clusterName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2015-03-01-preview"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsDelete(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/applications/{applicationName}", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel})
}
// DeleteSender sends the Delete request. The method will close the
// http.Response Body if it receives an error.
func (client ApplicationsClient) DeleteSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// DeleteResponder handles the response to the Delete request. The method always
// closes the http.Response Body.
func (client ApplicationsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByClosing())
result.Response = resp
return
}
// Get lists properties of the application.
//
// resourceGroupName is the name of the resource group. clusterName is the name
// of the cluster. applicationName is the constant value for the
// applicationName
func (client ApplicationsClient) Get(resourceGroupName string, clusterName string, applicationName string) (result Application, err error) {
req, err := client.GetPreparer(resourceGroupName, clusterName, applicationName)
if err != nil {
err = autorest.NewErrorWithError(err, "hdinsight.ApplicationsClient", "Get", nil, "Failure preparing request")
return
}
resp, err := client.GetSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "hdinsight.ApplicationsClient", "Get", resp, "Failure sending request")
return
}
result, err = client.GetResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "hdinsight.ApplicationsClient", "Get", resp, "Failure responding to request")
}
return
}
// GetPreparer prepares the Get request.
func (client ApplicationsClient) GetPreparer(resourceGroupName string, clusterName string, applicationName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"applicationName": autorest.Encode("path", applicationName),
"clusterName": autorest.Encode("path", clusterName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2015-03-01-preview"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/applications/{applicationName}", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error.
func (client ApplicationsClient) GetSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// GetResponder handles the response to the Get request. The method always
// closes the http.Response Body.
func (client ApplicationsClient) GetResponder(resp *http.Response) (result Application, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// List lists all of the applications HDInsight cluster.
//
// resourceGroupName is the name of the resource group. clusterName is the name
// of the cluster.
func (client ApplicationsClient) List(resourceGroupName string, clusterName string) (result ApplicationListResult, err error) {
req, err := client.ListPreparer(resourceGroupName, clusterName)
if err != nil {
err = autorest.NewErrorWithError(err, "hdinsight.ApplicationsClient", "List", nil, "Failure preparing request")
return
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "hdinsight.ApplicationsClient", "List", resp, "Failure sending request")
return
}
result, err = client.ListResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "hdinsight.ApplicationsClient", "List", resp, "Failure responding to request")
}
return
}
// ListPreparer prepares the List request.
func (client ApplicationsClient) ListPreparer(resourceGroupName string, clusterName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"clusterName": autorest.Encode("path", clusterName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2015-03-01-preview"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/applications", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// ListSender sends the List request. The method will close the
// http.Response Body if it receives an error.
func (client ApplicationsClient) ListSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// ListResponder handles the response to the List request. The method always
// closes the http.Response Body.
func (client ApplicationsClient) ListResponder(resp *http.Response) (result ApplicationListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// ListNextResults retrieves the next set of results, if any.
func (client ApplicationsClient) ListNextResults(lastResults ApplicationListResult) (result ApplicationListResult, err error) {
req, err := lastResults.ApplicationListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "hdinsight.ApplicationsClient", "List", nil, "Failure preparing next results request")
}
if req == nil {
return
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "hdinsight.ApplicationsClient", "List", resp, "Failure sending next results request")
}
result, err = client.ListResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "hdinsight.ApplicationsClient", "List", resp, "Failure responding to next results request")
}
return
}
+52
View File
@@ -0,0 +1,52 @@
// Package hdinsight implements the Azure ARM Hdinsight service API version .
//
// The HDInsight Management Client.
package hdinsight
// 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 1.0.1.0
// 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 Hdinsight
DefaultBaseURI = "https://management.azure.com"
)
// ManagementClient is the base client for Hdinsight.
type ManagementClient struct {
autorest.Client
BaseURI string
SubscriptionID string
}
// New creates an instance of the ManagementClient client.
func New(subscriptionID string) ManagementClient {
return NewWithBaseURI(DefaultBaseURI, subscriptionID)
}
// NewWithBaseURI creates an instance of the ManagementClient client.
func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient {
return ManagementClient{
Client: autorest.NewClientWithUserAgent(UserAgent()),
BaseURI: baseURI,
SubscriptionID: subscriptionID,
}
}
+785
View File
@@ -0,0 +1,785 @@
package hdinsight
// 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 1.0.1.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
import (
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure"
"github.com/Azure/go-autorest/autorest/validation"
"net/http"
)
// ClustersClient is the the HDInsight Management Client.
type ClustersClient struct {
ManagementClient
}
// NewClustersClient creates an instance of the ClustersClient client.
func NewClustersClient(subscriptionID string) ClustersClient {
return NewClustersClientWithBaseURI(DefaultBaseURI, subscriptionID)
}
// NewClustersClientWithBaseURI creates an instance of the ClustersClient
// client.
func NewClustersClientWithBaseURI(baseURI string, subscriptionID string) ClustersClient {
return ClustersClient{NewWithBaseURI(baseURI, subscriptionID)}
}
// ChangeRdpSettings begins changing the RDP settings on the specified cluster.
// This method may poll for completion. Polling can be canceled by passing the
// cancel channel argument. The channel will be used to cancel polling and any
// outstanding HTTP requests.
//
// resourceGroupName is the name of the resource group. clusterName is the name
// of the cluster. parameters is the OS profile for RDP.
func (client ClustersClient) ChangeRdpSettings(resourceGroupName string, clusterName string, parameters RDPSettingsParameters, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) {
resultChan := make(chan autorest.Response, 1)
errChan := make(chan error, 1)
if err := validation.Validate([]validation.Validation{
{TargetValue: clusterName,
Constraints: []validation.Constraint{{Target: "clusterName", Name: validation.Pattern, Rule: `^[0-9a-zA-Z][0-9a-zA-Z-]*[a-zA-Z0-9]$`, Chain: nil}}},
{TargetValue: parameters,
Constraints: []validation.Constraint{{Target: "parameters.OsProfile", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
errChan <- validation.NewErrorWithValidationError(err, "hdinsight.ClustersClient", "ChangeRdpSettings")
close(errChan)
close(resultChan)
return resultChan, errChan
}
go func() {
var err error
var result autorest.Response
defer func() {
resultChan <- result
errChan <- err
close(resultChan)
close(errChan)
}()
req, err := client.ChangeRdpSettingsPreparer(resourceGroupName, clusterName, parameters, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "ChangeRdpSettings", nil, "Failure preparing request")
return
}
resp, err := client.ChangeRdpSettingsSender(req)
if err != nil {
result.Response = resp
err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "ChangeRdpSettings", resp, "Failure sending request")
return
}
result, err = client.ChangeRdpSettingsResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "ChangeRdpSettings", resp, "Failure responding to request")
}
}()
return resultChan, errChan
}
// ChangeRdpSettingsPreparer prepares the ChangeRdpSettings request.
func (client ClustersClient) ChangeRdpSettingsPreparer(resourceGroupName string, clusterName string, parameters RDPSettingsParameters, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"clusterName": autorest.Encode("path", clusterName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2015-03-01-preview"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsJSON(),
autorest.AsPost(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/changerdpsetting", pathParameters),
autorest.WithJSON(parameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel})
}
// ChangeRdpSettingsSender sends the ChangeRdpSettings request. The method will close the
// http.Response Body if it receives an error.
func (client ClustersClient) ChangeRdpSettingsSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// ChangeRdpSettingsResponder handles the response to the ChangeRdpSettings request. The method always
// closes the http.Response Body.
func (client ClustersClient) ChangeRdpSettingsResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
autorest.ByClosing())
result.Response = resp
return
}
// Create begins creating a new HDInsight cluster with the specified
// parameters. This method may poll for completion. Polling can be canceled by
// passing the cancel channel argument. The channel will be used to cancel
// polling and any outstanding HTTP requests.
//
// resourceGroupName is the name of the resource group. clusterName is the name
// of the cluster. parameters is the cluster create request.
func (client ClustersClient) Create(resourceGroupName string, clusterName string, parameters ClusterCreateParametersExtended, cancel <-chan struct{}) (<-chan Cluster, <-chan error) {
resultChan := make(chan Cluster, 1)
errChan := make(chan error, 1)
go func() {
var err error
var result Cluster
defer func() {
resultChan <- result
errChan <- err
close(resultChan)
close(errChan)
}()
req, err := client.CreatePreparer(resourceGroupName, clusterName, parameters, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "Create", nil, "Failure preparing request")
return
}
resp, err := client.CreateSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "Create", resp, "Failure sending request")
return
}
result, err = client.CreateResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "Create", resp, "Failure responding to request")
}
}()
return resultChan, errChan
}
// CreatePreparer prepares the Create request.
func (client ClustersClient) CreatePreparer(resourceGroupName string, clusterName string, parameters ClusterCreateParametersExtended, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"clusterName": autorest.Encode("path", clusterName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2015-03-01-preview"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsJSON(),
autorest.AsPut(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}", pathParameters),
autorest.WithJSON(parameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel})
}
// CreateSender sends the Create request. The method will close the
// http.Response Body if it receives an error.
func (client ClustersClient) CreateSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// CreateResponder handles the response to the Create request. The method always
// closes the http.Response Body.
func (client ClustersClient) CreateResponder(resp *http.Response) (result Cluster, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// Delete begins deleting the specified HDInsight cluster. This method may poll
// for completion. Polling can be canceled by passing the cancel channel
// argument. The channel will be used to cancel polling and any outstanding
// HTTP requests.
//
// resourceGroupName is the name of the resource group. clusterName is the name
// of the cluster.
func (client ClustersClient) Delete(resourceGroupName string, clusterName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) {
resultChan := make(chan autorest.Response, 1)
errChan := make(chan error, 1)
go func() {
var err error
var result autorest.Response
defer func() {
resultChan <- result
errChan <- err
close(resultChan)
close(errChan)
}()
req, err := client.DeletePreparer(resourceGroupName, clusterName, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "Delete", nil, "Failure preparing request")
return
}
resp, err := client.DeleteSender(req)
if err != nil {
result.Response = resp
err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "Delete", resp, "Failure sending request")
return
}
result, err = client.DeleteResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "Delete", resp, "Failure responding to request")
}
}()
return resultChan, errChan
}
// DeletePreparer prepares the Delete request.
func (client ClustersClient) DeletePreparer(resourceGroupName string, clusterName string, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"clusterName": autorest.Encode("path", clusterName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2015-03-01-preview"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsDelete(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel})
}
// DeleteSender sends the Delete request. The method will close the
// http.Response Body if it receives an error.
func (client ClustersClient) DeleteSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// DeleteResponder handles the response to the Delete request. The method always
// closes the http.Response Body.
func (client ClustersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusOK),
autorest.ByClosing())
result.Response = resp
return
}
// ExecuteScriptActions begins executing script actions on the specified
// HDInsight cluster. This method may poll for completion. Polling can be
// canceled by passing the cancel channel argument. The channel will be used to
// cancel polling and any outstanding HTTP requests.
//
// resourceGroupName is the name of the resource group. clusterName is the name
// of the cluster. parameters is the parameters for executing script actions.
func (client ClustersClient) ExecuteScriptActions(resourceGroupName string, clusterName string, parameters ExecuteScriptActionParameters, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) {
resultChan := make(chan autorest.Response, 1)
errChan := make(chan error, 1)
if err := validation.Validate([]validation.Validation{
{TargetValue: parameters,
Constraints: []validation.Constraint{{Target: "parameters.PersistOnSuccess", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
errChan <- validation.NewErrorWithValidationError(err, "hdinsight.ClustersClient", "ExecuteScriptActions")
close(errChan)
close(resultChan)
return resultChan, errChan
}
go func() {
var err error
var result autorest.Response
defer func() {
resultChan <- result
errChan <- err
close(resultChan)
close(errChan)
}()
req, err := client.ExecuteScriptActionsPreparer(resourceGroupName, clusterName, parameters, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "ExecuteScriptActions", nil, "Failure preparing request")
return
}
resp, err := client.ExecuteScriptActionsSender(req)
if err != nil {
result.Response = resp
err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "ExecuteScriptActions", resp, "Failure sending request")
return
}
result, err = client.ExecuteScriptActionsResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "ExecuteScriptActions", resp, "Failure responding to request")
}
}()
return resultChan, errChan
}
// ExecuteScriptActionsPreparer prepares the ExecuteScriptActions request.
func (client ClustersClient) ExecuteScriptActionsPreparer(resourceGroupName string, clusterName string, parameters ExecuteScriptActionParameters, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"clusterName": autorest.Encode("path", clusterName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2015-03-01-preview"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsJSON(),
autorest.AsPost(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/executeScriptActions", pathParameters),
autorest.WithJSON(parameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel})
}
// ExecuteScriptActionsSender sends the ExecuteScriptActions request. The method will close the
// http.Response Body if it receives an error.
func (client ClustersClient) ExecuteScriptActionsSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// ExecuteScriptActionsResponder handles the response to the ExecuteScriptActions request. The method always
// closes the http.Response Body.
func (client ClustersClient) ExecuteScriptActionsResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusOK),
autorest.ByClosing())
result.Response = resp
return
}
// Get gets the specified cluster.
//
// resourceGroupName is the name of the resource group. clusterName is the name
// of the cluster.
func (client ClustersClient) Get(resourceGroupName string, clusterName string) (result Cluster, err error) {
req, err := client.GetPreparer(resourceGroupName, clusterName)
if err != nil {
err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "Get", nil, "Failure preparing request")
return
}
resp, err := client.GetSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "Get", resp, "Failure sending request")
return
}
result, err = client.GetResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "Get", resp, "Failure responding to request")
}
return
}
// GetPreparer prepares the Get request.
func (client ClustersClient) GetPreparer(resourceGroupName string, clusterName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"clusterName": autorest.Encode("path", clusterName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2015-03-01-preview"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error.
func (client ClustersClient) GetSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// GetResponder handles the response to the Get request. The method always
// closes the http.Response Body.
func (client ClustersClient) GetResponder(resp *http.Response) (result Cluster, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// List lists HDInsight clusters under the subscription.
func (client ClustersClient) List() (result ClusterListResult, err error) {
req, err := client.ListPreparer()
if err != nil {
err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "List", nil, "Failure preparing request")
return
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "List", resp, "Failure sending request")
return
}
result, err = client.ListResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "List", resp, "Failure responding to request")
}
return
}
// ListPreparer prepares the List request.
func (client ClustersClient) ListPreparer() (*http.Request, error) {
pathParameters := map[string]interface{}{
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2015-03-01-preview"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/clusters", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// ListSender sends the List request. The method will close the
// http.Response Body if it receives an error.
func (client ClustersClient) ListSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// ListResponder handles the response to the List request. The method always
// closes the http.Response Body.
func (client ClustersClient) ListResponder(resp *http.Response) (result ClusterListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// ListNextResults retrieves the next set of results, if any.
func (client ClustersClient) ListNextResults(lastResults ClusterListResult) (result ClusterListResult, err error) {
req, err := lastResults.ClusterListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "List", nil, "Failure preparing next results request")
}
if req == nil {
return
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "List", resp, "Failure sending next results request")
}
result, err = client.ListResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "List", resp, "Failure responding to next results request")
}
return
}
// ListByResourceGroup list the HDInsight clusters in a resource group.
//
// resourceGroupName is the name of the resource group.
func (client ClustersClient) ListByResourceGroup(resourceGroupName string) (result ClusterListResult, err error) {
req, err := client.ListByResourceGroupPreparer(resourceGroupName)
if err != nil {
err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "ListByResourceGroup", nil, "Failure preparing request")
return
}
resp, err := client.ListByResourceGroupSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "ListByResourceGroup", resp, "Failure sending request")
return
}
result, err = client.ListByResourceGroupResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "ListByResourceGroup", resp, "Failure responding to request")
}
return
}
// ListByResourceGroupPreparer prepares the ListByResourceGroup request.
func (client ClustersClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2015-03-01-preview"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the
// http.Response Body if it receives an error.
func (client ClustersClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always
// closes the http.Response Body.
func (client ClustersClient) ListByResourceGroupResponder(resp *http.Response) (result ClusterListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// ListByResourceGroupNextResults retrieves the next set of results, if any.
func (client ClustersClient) ListByResourceGroupNextResults(lastResults ClusterListResult) (result ClusterListResult, err error) {
req, err := lastResults.ClusterListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "ListByResourceGroup", nil, "Failure preparing next results request")
}
if req == nil {
return
}
resp, err := client.ListByResourceGroupSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "ListByResourceGroup", resp, "Failure sending next results request")
}
result, err = client.ListByResourceGroupResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "ListByResourceGroup", resp, "Failure responding to next results request")
}
return
}
// Resize begins a resize operation on the specified HDInsight cluster. This
// method may poll for completion. Polling can be canceled by passing the
// cancel channel argument. The channel will be used to cancel polling and any
// outstanding HTTP requests.
//
// resourceGroupName is the name of the resource group. clusterName is the name
// of the cluster. roleName is the constant value for the roleName parameters
// is the parameters for the resize operation.
func (client ClustersClient) Resize(resourceGroupName string, clusterName string, roleName string, parameters ClusterResizeParameters, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) {
resultChan := make(chan autorest.Response, 1)
errChan := make(chan error, 1)
go func() {
var err error
var result autorest.Response
defer func() {
resultChan <- result
errChan <- err
close(resultChan)
close(errChan)
}()
req, err := client.ResizePreparer(resourceGroupName, clusterName, roleName, parameters, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "Resize", nil, "Failure preparing request")
return
}
resp, err := client.ResizeSender(req)
if err != nil {
result.Response = resp
err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "Resize", resp, "Failure sending request")
return
}
result, err = client.ResizeResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "Resize", resp, "Failure responding to request")
}
}()
return resultChan, errChan
}
// ResizePreparer prepares the Resize request.
func (client ClustersClient) ResizePreparer(resourceGroupName string, clusterName string, roleName string, parameters ClusterResizeParameters, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"clusterName": autorest.Encode("path", clusterName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"roleName": autorest.Encode("path", roleName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2015-03-01-preview"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsJSON(),
autorest.AsPost(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/roles/{roleName}/resize", pathParameters),
autorest.WithJSON(parameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel})
}
// ResizeSender sends the Resize request. The method will close the
// http.Response Body if it receives an error.
func (client ClustersClient) ResizeSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// ResizeResponder handles the response to the Resize request. The method always
// closes the http.Response Body.
func (client ClustersClient) ResizeResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusOK),
autorest.ByClosing())
result.Response = resp
return
}
// Update patch HDInsight cluster with the specified parameters.
//
// resourceGroupName is the name of the resource group. clusterName is the name
// of the cluster. parameters is the cluster patch request.
func (client ClustersClient) Update(resourceGroupName string, clusterName string, parameters ClusterPatchParameters) (result Cluster, err error) {
req, err := client.UpdatePreparer(resourceGroupName, clusterName, parameters)
if err != nil {
err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "Update", nil, "Failure preparing request")
return
}
resp, err := client.UpdateSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "Update", resp, "Failure sending request")
return
}
result, err = client.UpdateResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "hdinsight.ClustersClient", "Update", resp, "Failure responding to request")
}
return
}
// UpdatePreparer prepares the Update request.
func (client ClustersClient) UpdatePreparer(resourceGroupName string, clusterName string, parameters ClusterPatchParameters) (*http.Request, error) {
pathParameters := map[string]interface{}{
"clusterName": autorest.Encode("path", clusterName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2015-03-01-preview"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsJSON(),
autorest.AsPatch(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}", pathParameters),
autorest.WithJSON(parameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// UpdateSender sends the Update request. The method will close the
// http.Response Body if it receives an error.
func (client ClustersClient) UpdateSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// UpdateResponder handles the response to the Update request. The method always
// closes the http.Response Body.
func (client ClustersClient) UpdateResponder(resp *http.Response) (result Cluster, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
+195
View File
@@ -0,0 +1,195 @@
package hdinsight
// 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 1.0.1.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
import (
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure"
"net/http"
)
// ConfigurationsClient is the the HDInsight Management Client.
type ConfigurationsClient struct {
ManagementClient
}
// NewConfigurationsClient creates an instance of the ConfigurationsClient
// client.
func NewConfigurationsClient(subscriptionID string) ConfigurationsClient {
return NewConfigurationsClientWithBaseURI(DefaultBaseURI, subscriptionID)
}
// NewConfigurationsClientWithBaseURI creates an instance of the
// ConfigurationsClient client.
func NewConfigurationsClientWithBaseURI(baseURI string, subscriptionID string) ConfigurationsClient {
return ConfigurationsClient{NewWithBaseURI(baseURI, subscriptionID)}
}
// Get the configuration object for the specified cluster.
//
// resourceGroupName is the name of the resource group. clusterName is the name
// of the cluster. configurationName is the constant for configuration type of
// gateway.
func (client ConfigurationsClient) Get(resourceGroupName string, clusterName string, configurationName Configurationname) (result HTTPConnectivitySettings, err error) {
req, err := client.GetPreparer(resourceGroupName, clusterName, configurationName)
if err != nil {
err = autorest.NewErrorWithError(err, "hdinsight.ConfigurationsClient", "Get", nil, "Failure preparing request")
return
}
resp, err := client.GetSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "hdinsight.ConfigurationsClient", "Get", resp, "Failure sending request")
return
}
result, err = client.GetResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "hdinsight.ConfigurationsClient", "Get", resp, "Failure responding to request")
}
return
}
// GetPreparer prepares the Get request.
func (client ConfigurationsClient) GetPreparer(resourceGroupName string, clusterName string, configurationName Configurationname) (*http.Request, error) {
pathParameters := map[string]interface{}{
"clusterName": autorest.Encode("path", clusterName),
"configurationName": autorest.Encode("path", configurationName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2015-03-01-preview"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/configurations/{configurationName}", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error.
func (client ConfigurationsClient) GetSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// GetResponder handles the response to the Get request. The method always
// closes the http.Response Body.
func (client ConfigurationsClient) GetResponder(resp *http.Response) (result HTTPConnectivitySettings, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// UpdateHTTPSettings begins configuring the HTTP settings on the specified
// cluster. This method may poll for completion. Polling can be canceled by
// passing the cancel channel argument. The channel will be used to cancel
// polling and any outstanding HTTP requests.
//
// resourceGroupName is the name of the resource group. clusterName is the name
// of the cluster. configurationName is the constant for configuration type of
// gateway. parameters is the name of the resource group.
func (client ConfigurationsClient) UpdateHTTPSettings(resourceGroupName string, clusterName string, configurationName string, parameters HTTPConnectivitySettings, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) {
resultChan := make(chan autorest.Response, 1)
errChan := make(chan error, 1)
go func() {
var err error
var result autorest.Response
defer func() {
resultChan <- result
errChan <- err
close(resultChan)
close(errChan)
}()
req, err := client.UpdateHTTPSettingsPreparer(resourceGroupName, clusterName, configurationName, parameters, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "hdinsight.ConfigurationsClient", "UpdateHTTPSettings", nil, "Failure preparing request")
return
}
resp, err := client.UpdateHTTPSettingsSender(req)
if err != nil {
result.Response = resp
err = autorest.NewErrorWithError(err, "hdinsight.ConfigurationsClient", "UpdateHTTPSettings", resp, "Failure sending request")
return
}
result, err = client.UpdateHTTPSettingsResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "hdinsight.ConfigurationsClient", "UpdateHTTPSettings", resp, "Failure responding to request")
}
}()
return resultChan, errChan
}
// UpdateHTTPSettingsPreparer prepares the UpdateHTTPSettings request.
func (client ConfigurationsClient) UpdateHTTPSettingsPreparer(resourceGroupName string, clusterName string, configurationName string, parameters HTTPConnectivitySettings, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"clusterName": autorest.Encode("path", clusterName),
"configurationName": autorest.Encode("path", configurationName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2015-03-01-preview"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsJSON(),
autorest.AsPost(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/configurations/{configurationName}", pathParameters),
autorest.WithJSON(parameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel})
}
// UpdateHTTPSettingsSender sends the UpdateHTTPSettings request. The method will close the
// http.Response Body if it receives an error.
func (client ConfigurationsClient) UpdateHTTPSettingsSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// UpdateHTTPSettingsResponder handles the response to the UpdateHTTPSettings request. The method always
// closes the http.Response Body.
func (client ConfigurationsClient) UpdateHTTPSettingsResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
autorest.ByClosing())
result.Response = resp
return
}
+243
View File
@@ -0,0 +1,243 @@
package hdinsight
// 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 1.0.1.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
import (
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure"
"net/http"
)
// ExtensionClient is the the HDInsight Management Client.
type ExtensionClient struct {
ManagementClient
}
// NewExtensionClient creates an instance of the ExtensionClient client.
func NewExtensionClient(subscriptionID string) ExtensionClient {
return NewExtensionClientWithBaseURI(DefaultBaseURI, subscriptionID)
}
// NewExtensionClientWithBaseURI creates an instance of the ExtensionClient
// client.
func NewExtensionClientWithBaseURI(baseURI string, subscriptionID string) ExtensionClient {
return ExtensionClient{NewWithBaseURI(baseURI, subscriptionID)}
}
// Create create HDInsight cluster extension.
//
// resourceGroupName is the name of the resource group. clusterName is the name
// of the cluster. parameters is the cluster extensions create request.
// extensionName is the name of the cluster extension.
func (client ExtensionClient) Create(resourceGroupName string, clusterName string, parameters Extension, extensionName string) (result autorest.Response, err error) {
req, err := client.CreatePreparer(resourceGroupName, clusterName, parameters, extensionName)
if err != nil {
err = autorest.NewErrorWithError(err, "hdinsight.ExtensionClient", "Create", nil, "Failure preparing request")
return
}
resp, err := client.CreateSender(req)
if err != nil {
result.Response = resp
err = autorest.NewErrorWithError(err, "hdinsight.ExtensionClient", "Create", resp, "Failure sending request")
return
}
result, err = client.CreateResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "hdinsight.ExtensionClient", "Create", resp, "Failure responding to request")
}
return
}
// CreatePreparer prepares the Create request.
func (client ExtensionClient) CreatePreparer(resourceGroupName string, clusterName string, parameters Extension, extensionName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"clusterName": autorest.Encode("path", clusterName),
"extensionName": autorest.Encode("path", extensionName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2015-03-01-preview"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsJSON(),
autorest.AsPut(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/{extensionName}", pathParameters),
autorest.WithJSON(parameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// CreateSender sends the Create request. The method will close the
// http.Response Body if it receives an error.
func (client ExtensionClient) CreateSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// CreateResponder handles the response to the Create request. The method always
// closes the http.Response Body.
func (client ExtensionClient) CreateResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByClosing())
result.Response = resp
return
}
// Delete delete extension for HDInsight cluster.
//
// resourceGroupName is the name of the resource group. clusterName is the name
// of the cluster. extensionName is the name of the cluster extension.
func (client ExtensionClient) Delete(resourceGroupName string, clusterName string, extensionName string) (result autorest.Response, err error) {
req, err := client.DeletePreparer(resourceGroupName, clusterName, extensionName)
if err != nil {
err = autorest.NewErrorWithError(err, "hdinsight.ExtensionClient", "Delete", nil, "Failure preparing request")
return
}
resp, err := client.DeleteSender(req)
if err != nil {
result.Response = resp
err = autorest.NewErrorWithError(err, "hdinsight.ExtensionClient", "Delete", resp, "Failure sending request")
return
}
result, err = client.DeleteResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "hdinsight.ExtensionClient", "Delete", resp, "Failure responding to request")
}
return
}
// DeletePreparer prepares the Delete request.
func (client ExtensionClient) DeletePreparer(resourceGroupName string, clusterName string, extensionName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"clusterName": autorest.Encode("path", clusterName),
"extensionName": autorest.Encode("path", extensionName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2015-03-01-preview"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsDelete(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/{extensionName}", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// DeleteSender sends the Delete request. The method will close the
// http.Response Body if it receives an error.
func (client ExtensionClient) DeleteSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// DeleteResponder handles the response to the Delete request. The method always
// closes the http.Response Body.
func (client ExtensionClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByClosing())
result.Response = resp
return
}
// Get get extension properties for HDInsight cluster extension.
//
// resourceGroupName is the name of the resource group. clusterName is the name
// of the cluster. extensionName is the name of the cluster extension.
func (client ExtensionClient) Get(resourceGroupName string, clusterName string, extensionName string) (result Extension, err error) {
req, err := client.GetPreparer(resourceGroupName, clusterName, extensionName)
if err != nil {
err = autorest.NewErrorWithError(err, "hdinsight.ExtensionClient", "Get", nil, "Failure preparing request")
return
}
resp, err := client.GetSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "hdinsight.ExtensionClient", "Get", resp, "Failure sending request")
return
}
result, err = client.GetResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "hdinsight.ExtensionClient", "Get", resp, "Failure responding to request")
}
return
}
// GetPreparer prepares the Get request.
func (client ExtensionClient) GetPreparer(resourceGroupName string, clusterName string, extensionName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"clusterName": autorest.Encode("path", clusterName),
"extensionName": autorest.Encode("path", extensionName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2015-03-01-preview"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/{extensionName}", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error.
func (client ExtensionClient) GetSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// GetResponder handles the response to the Get request. The method always
// closes the http.Response Body.
func (client ExtensionClient) GetResponder(resp *http.Response) (result Extension, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
+105
View File
@@ -0,0 +1,105 @@
package hdinsight
// 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 1.0.1.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
import (
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure"
"net/http"
)
// LocationClient is the the HDInsight Management Client.
type LocationClient struct {
ManagementClient
}
// NewLocationClient creates an instance of the LocationClient client.
func NewLocationClient(subscriptionID string) LocationClient {
return NewLocationClientWithBaseURI(DefaultBaseURI, subscriptionID)
}
// NewLocationClientWithBaseURI creates an instance of the LocationClient
// client.
func NewLocationClientWithBaseURI(baseURI string, subscriptionID string) LocationClient {
return LocationClient{NewWithBaseURI(baseURI, subscriptionID)}
}
// GetCapabilities gets the capabilities for the specified location.
//
// location is the location to get capabilities for.
func (client LocationClient) GetCapabilities(location string) (result CapabilitiesResult, err error) {
req, err := client.GetCapabilitiesPreparer(location)
if err != nil {
err = autorest.NewErrorWithError(err, "hdinsight.LocationClient", "GetCapabilities", nil, "Failure preparing request")
return
}
resp, err := client.GetCapabilitiesSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "hdinsight.LocationClient", "GetCapabilities", resp, "Failure sending request")
return
}
result, err = client.GetCapabilitiesResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "hdinsight.LocationClient", "GetCapabilities", resp, "Failure responding to request")
}
return
}
// GetCapabilitiesPreparer prepares the GetCapabilities request.
func (client LocationClient) GetCapabilitiesPreparer(location string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"location": autorest.Encode("path", location),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2015-03-01-preview"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/capabilities", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// GetCapabilitiesSender sends the GetCapabilities request. The method will close the
// http.Response Body if it receives an error.
func (client LocationClient) GetCapabilitiesSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// GetCapabilitiesResponder handles the response to the GetCapabilities request. The method always
// closes the http.Response Body.
func (client LocationClient) GetCapabilitiesResponder(resp *http.Response) (result CapabilitiesResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
+602
View File
@@ -0,0 +1,602 @@
package hdinsight
// 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 1.0.1.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
import (
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/date"
"github.com/Azure/go-autorest/autorest/to"
"net/http"
)
// AsyncOperationState enumerates the values for async operation state.
type AsyncOperationState string
const (
// Failed specifies the failed state for async operation state.
Failed AsyncOperationState = "Failed"
// InProgress specifies the in progress state for async operation state.
InProgress AsyncOperationState = "InProgress"
// Succeeded specifies the succeeded state for async operation state.
Succeeded AsyncOperationState = "Succeeded"
)
// ClusterProvisioningState enumerates the values for cluster provisioning
// state.
type ClusterProvisioningState string
const (
// ClusterProvisioningStateCanceled specifies the cluster provisioning
// state canceled state for cluster provisioning state.
ClusterProvisioningStateCanceled ClusterProvisioningState = "Canceled"
// ClusterProvisioningStateDeleting specifies the cluster provisioning
// state deleting state for cluster provisioning state.
ClusterProvisioningStateDeleting ClusterProvisioningState = "Deleting"
// ClusterProvisioningStateFailed specifies the cluster provisioning state
// failed state for cluster provisioning state.
ClusterProvisioningStateFailed ClusterProvisioningState = "Failed"
// ClusterProvisioningStateInProgress specifies the cluster provisioning
// state in progress state for cluster provisioning state.
ClusterProvisioningStateInProgress ClusterProvisioningState = "InProgress"
// ClusterProvisioningStateSucceeded specifies the cluster provisioning
// state succeeded state for cluster provisioning state.
ClusterProvisioningStateSucceeded ClusterProvisioningState = "Succeeded"
)
// Configurationname enumerates the values for configurationname.
type Configurationname string
const (
// CoreSite specifies the core site state for configurationname.
CoreSite Configurationname = "core-site"
// Gateway specifies the gateway state for configurationname.
Gateway Configurationname = "gateway"
)
// DirectoryType enumerates the values for directory type.
type DirectoryType string
const (
// ActiveDirectory specifies the active directory state for directory type.
ActiveDirectory DirectoryType = "ActiveDirectory"
)
// OSType enumerates the values for os type.
type OSType string
const (
// Linux specifies the linux state for os type.
Linux OSType = "Linux"
// Windows specifies the windows state for os type.
Windows OSType = "Windows"
)
// Tier enumerates the values for tier.
type Tier string
const (
// Premium specifies the premium state for tier.
Premium Tier = "Premium"
// Standard specifies the standard state for tier.
Standard Tier = "Standard"
)
// Application is hDInsight cluster application
type Application struct {
autorest.Response `json:"-"`
ID *SubResource `json:"id,omitempty"`
Name *string `json:"name,omitempty"`
Type *string `json:"type,omitempty"`
Etag *string `json:"etag,omitempty"`
Tags *map[string]*string `json:"tags,omitempty"`
Properties *ApplicationGetProperties `json:"properties,omitempty"`
}
// ApplicationGetEndpoint is gets Application ssh endpoint
type ApplicationGetEndpoint struct {
Location *string `json:"location,omitempty"`
DestinationPort *int32 `json:"destinationPort,omitempty"`
PublicPort *int32 `json:"publicPort,omitempty"`
}
// ApplicationGetHTTPSEndpoint is gets application Http endpoints.
type ApplicationGetHTTPSEndpoint struct {
AdditionalProperties *map[string]*string `json:",omitempty"`
AccessModes *[]string `json:"accessModes,omitempty"`
Location *string `json:"location,omitempty"`
DestinationPort *int32 `json:"destinationPort,omitempty"`
PublicPort *int32 `json:"publicPort,omitempty"`
}
// ApplicationGetProperties is hDInsight cluster application.
type ApplicationGetProperties struct {
ComputeProfile *ComputeProfile `json:"computeProfile,omitempty"`
InstallScriptActions *[]RuntimeScriptAction `json:"installScriptActions,omitempty"`
UninstallScriptActions *[]RuntimeScriptAction `json:"uninstallScriptActions,omitempty"`
HTTPSEndpoints *[]ApplicationGetHTTPSEndpoint `json:"httpsEndpoints,omitempty"`
SSHEndpoints *[]ApplicationGetEndpoint `json:"sshEndpoints,omitempty"`
ProvisioningState *string `json:"provisioningState,omitempty"`
ApplicationType *string `json:"applicationType,omitempty"`
ApplicationState *string `json:"applicationState,omitempty"`
Errors *[]Errors `json:"errors,omitempty"`
CreatedDate *string `json:"createdDate,omitempty"`
MarketplaceIdentifier *string `json:"marketplaceIdentifier,omitempty"`
AdditionalProperties *string `json:"additionalProperties,omitempty"`
}
// ApplicationListResult is result of the request to list cluster Applications.
// It contains a list of operations and a URL link to get the next set of
// results.
type ApplicationListResult struct {
autorest.Response `json:"-"`
Value *[]Application `json:"value,omitempty"`
NextLink *string `json:"nextLink,omitempty"`
}
// ApplicationListResultPreparer prepares a request to retrieve the next set of results. It returns
// nil if no more results exist.
func (client ApplicationListResult) ApplicationListResultPreparer() (*http.Request, error) {
if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {
return nil, nil
}
return autorest.Prepare(&http.Request{},
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(to.String(client.NextLink)))
}
// CapabilitiesResult is the Get Capabilities operation response.
type CapabilitiesResult struct {
autorest.Response `json:"-"`
Versions *map[string]*VersionsCapability `json:"versions,omitempty"`
Regions *map[string]*RegionsCapability `json:"regions,omitempty"`
Vmsizes *map[string]*VMSizesCapability `json:"vmsizes,omitempty"`
VmsizeFilters *[]VMSizeCompatibilityFilter `json:"vmsize_filters,omitempty"`
Features *[]string `json:"features,omitempty"`
Quota *QuotaCapability `json:"quota,omitempty"`
}
// Cluster is describes the cluster.
type Cluster struct {
autorest.Response `json:"-"`
ID *string `json:"id,omitempty"`
Name *string `json:"name,omitempty"`
Type *string `json:"type,omitempty"`
Location *string `json:"location,omitempty"`
Tags *map[string]*string `json:"tags,omitempty"`
Etag *string `json:"etag,omitempty"`
Properties *ClusterGetProperties `json:"properties,omitempty"`
}
// ClusterCreateParametersExtended is the CreateCluster request parameters.
type ClusterCreateParametersExtended struct {
Location *string `json:"location,omitempty"`
Tags *map[string]*string `json:"tags,omitempty"`
Properties *ClusterCreateProperties `json:"properties,omitempty"`
}
// ClusterCreateProperties is the cluster create parameters.
type ClusterCreateProperties struct {
ClusterVersion *string `json:"clusterVersion,omitempty"`
OsType OSType `json:"osType,omitempty"`
Tier Tier `json:"tier,omitempty"`
ClusterDefinition *ClusterDefinition `json:"clusterDefinition,omitempty"`
SecurityProfile *SecurityProfile `json:"securityProfile,omitempty"`
ComputeProfile *ComputeProfile `json:"computeProfile,omitempty"`
StorageProfile *StorageProfile `json:"storageProfile,omitempty"`
}
// ClusterDefinition is the cluste definition.
type ClusterDefinition struct {
Blueprint *string `json:"blueprint,omitempty"`
Kind *string `json:"kind,omitempty"`
ComponentVersion *map[string]*string `json:"componentVersion,omitempty"`
Configurations *map[string]interface{} `json:"configurations,omitempty"`
}
// ClusterGetProperties is the properties of cluster.
type ClusterGetProperties struct {
ClusterVersion *string `json:"clusterVersion,omitempty"`
OsType OSType `json:"osType,omitempty"`
Tier Tier `json:"tier,omitempty"`
ClusterDefinition *ClusterDefinition `json:"clusterDefinition,omitempty"`
SecurityProfile *SecurityProfile `json:"securityProfile,omitempty"`
ComputeProfile *ComputeProfile `json:"computeProfile,omitempty"`
ProvisioningState ClusterProvisioningState `json:"provisioningState,omitempty"`
CreatedDate *string `json:"createdDate,omitempty"`
ClusterState *string `json:"clusterState,omitempty"`
QuotaInfo *QuotaInfo `json:"quotaInfo,omitempty"`
Errors *[]Errors `json:"errors,omitempty"`
ConnectivityEndpoints *[]ConnectivityEndpoint `json:"connectivityEndpoints,omitempty"`
}
// ClusterListPersistedScriptActionsResult is list PersistedScriptActions
// operations response.
type ClusterListPersistedScriptActionsResult struct {
Value *[]RuntimeScriptAction `json:"value,omitempty"`
NextLink *string `json:"nextLink,omitempty"`
}
// ClusterListResult is the List Cluster operation response.
type ClusterListResult struct {
autorest.Response `json:"-"`
Value *[]Cluster `json:"value,omitempty"`
NextLink *string `json:"nextLink,omitempty"`
}
// ClusterListResultPreparer prepares a request to retrieve the next set of results. It returns
// nil if no more results exist.
func (client ClusterListResult) ClusterListResultPreparer() (*http.Request, error) {
if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {
return nil, nil
}
return autorest.Prepare(&http.Request{},
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(to.String(client.NextLink)))
}
// ClusterListRuntimeScriptActionDetailResult is the ListScriptExecutionHistory
// response.
type ClusterListRuntimeScriptActionDetailResult struct {
Value *[]RuntimeScriptActionDetail `json:"value,omitempty"`
NextLink *string `json:"nextLink,omitempty"`
}
// ClusterPatchParameters is the PatchCluster request parameters
type ClusterPatchParameters struct {
Tags *map[string]*string `json:"tags,omitempty"`
}
// ClusterResizeParameters is the Resize Cluster request parameters.
type ClusterResizeParameters struct {
TargetInstanceCount *int32 `json:"targetInstanceCount,omitempty"`
}
// ComputeProfile is describes the compute profile.
type ComputeProfile struct {
Roles *[]Role `json:"roles,omitempty"`
}
// ConnectivityEndpoint is the connectivity properties
type ConnectivityEndpoint struct {
Name *string `json:"name,omitempty"`
Protocol *string `json:"protocol,omitempty"`
Location *string `json:"location,omitempty"`
Port *int32 `json:"port,omitempty"`
}
// Errors is the error message associated with the cluster creation.
type Errors struct {
Code *string `json:"code,omitempty"`
Message *string `json:"message,omitempty"`
}
// ExecuteScriptActionParameters is describes the script actions on a running
// cluster.
type ExecuteScriptActionParameters struct {
ScriptActions *[]RuntimeScriptAction `json:"scriptActions,omitempty"`
PersistOnSuccess *string `json:"persistOnSuccess,omitempty"`
}
// Extension is cluster monitoring extensions
type Extension struct {
autorest.Response `json:"-"`
WorkspaceID *string `json:"workspaceId,omitempty"`
PrimaryKey *string `json:"primaryKey,omitempty"`
}
// HardwareProfile is describes the hardware profile.
type HardwareProfile struct {
VMSize *string `json:"vmSize,omitempty"`
}
// HTTPConnectivitySettings is the payload for a Configure HTTP settings
// request.
type HTTPConnectivitySettings struct {
autorest.Response `json:"-"`
EnabledCredential *string `json:"restAuthCredential.isEnabled,omitempty"`
Username *string `json:"restAuthCredential.username,omitempty"`
Password *string `json:"restAuthCredential.password,omitempty"`
}
// HTTPSettingsParameters is the payload for a Configure HTTP settings request.
type HTTPSettingsParameters struct {
RestAuthCredentialisEnabled *string `json:"restAuthCredential.isEnabled,omitempty"`
RestAuthCredentialusername *string `json:"restAuthCredential.username,omitempty"`
RestAuthCredentialpassword *string `json:"restAuthCredential.password,omitempty"`
}
// LinuxOperatingSystemProfile is the ssh username, password, and ssh public
// key.
type LinuxOperatingSystemProfile struct {
Username *string `json:"username,omitempty"`
Password *string `json:"password,omitempty"`
SSHProfile *SSHProfile `json:"sshProfile,omitempty"`
}
// Operation is hDInsight REST API operation
type Operation struct {
Name *string `json:"name,omitempty"`
Display *OperationDisplay `json:"display,omitempty"`
}
// OperationDisplay is the object that represents the operation.
type OperationDisplay struct {
Provider *string `json:"provider,omitempty"`
Resource *string `json:"resource,omitempty"`
Operation *string `json:"operation,omitempty"`
}
// OperationListResult is result of the request to list HDInsight operations.
// It contains a list of operations and a URL link to get the next set of
// results.
type OperationListResult struct {
autorest.Response `json:"-"`
Value *[]Operation `json:"value,omitempty"`
NextLink *string `json:"nextLink,omitempty"`
}
// OperationListResultPreparer prepares a request to retrieve the next set of results. It returns
// nil if no more results exist.
func (client OperationListResult) OperationListResultPreparer() (*http.Request, error) {
if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {
return nil, nil
}
return autorest.Prepare(&http.Request{},
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(to.String(client.NextLink)))
}
// OperationResource is the azure async operation response.
type OperationResource struct {
Status AsyncOperationState `json:"status,omitempty"`
Error *Errors `json:"error,omitempty"`
}
// OsProfile is the Windows operation systems profile, and configure remote
// desktop settings.
type OsProfile struct {
WindowsOperatingSystemProfile *WindowsOperatingSystemProfile `json:"windowsOperatingSystemProfile,omitempty"`
LinuxOperatingSystemProfile *LinuxOperatingSystemProfile `json:"linuxOperatingSystemProfile,omitempty"`
}
// QuotaCapability is the regional quota capability.
type QuotaCapability struct {
RegionalQuotas *[]RegionalQuotaCapability `json:"regionalQuotas,omitempty"`
}
// QuotaInfo is gets or sets Quota properties for the cluster.
type QuotaInfo struct {
CoresUsed *int32 `json:"coresUsed,omitempty"`
}
// RdpSettings is the RDP settings for the windows cluster.
type RdpSettings struct {
Username *string `json:"username,omitempty"`
Password *string `json:"password,omitempty"`
ExpiryDate *date.Date `json:"expiryDate,omitempty"`
}
// RDPSettingsParameters is parameters specifying the data factory gateway
// definition for a create or update operation.
type RDPSettingsParameters struct {
OsProfile *OsProfile `json:"osProfile,omitempty"`
}
// RegionalQuotaCapability is the regional quota capacity.
type RegionalQuotaCapability struct {
RegionName *string `json:"region_name,omitempty"`
CoresUsed *int64 `json:"cores_used,omitempty"`
CoresAvailable *int64 `json:"cores_available,omitempty"`
}
// RegionsCapability is the regions capability.
type RegionsCapability struct {
Available *[]string `json:"available,omitempty"`
}
// Resource is the resource definition.
type Resource struct {
ID *string `json:"id,omitempty"`
Name *string `json:"name,omitempty"`
Type *string `json:"type,omitempty"`
Location *string `json:"location,omitempty"`
Tags *map[string]*string `json:"tags,omitempty"`
}
// Role is describes a role on the cluster.
type Role struct {
Name *string `json:"name,omitempty"`
MinInstanceCount *int32 `json:"minInstanceCount,omitempty"`
TargetInstanceCount *int32 `json:"targetInstanceCount,omitempty"`
HardwareProfile *HardwareProfile `json:"hardwareProfile,omitempty"`
OsProfile *OsProfile `json:"osProfile,omitempty"`
VirtualNetworkProfile *VirtualNetworkProfile `json:"virtualNetworkProfile,omitempty"`
ScriptActions *[]ScriptAction `json:"scriptActions,omitempty"`
}
// RuntimeScriptAction is describes a script action on a running cluster.
type RuntimeScriptAction struct {
Name *string `json:"name,omitempty"`
URI *string `json:"uri,omitempty"`
Parameters *string `json:"parameters,omitempty"`
Roles *[]string `json:"roles,omitempty"`
ApplicationName *string `json:"applicationName,omitempty"`
}
// RuntimeScriptActionDetail is describes the execution details of a script
// action.
type RuntimeScriptActionDetail struct {
autorest.Response `json:"-"`
ScriptExecutionID *int64 `json:"scriptExecutionId,omitempty"`
StartTime *string `json:"startTime,omitempty"`
EndTime *string `json:"endTime,omitempty"`
Status *string `json:"status,omitempty"`
Operation *string `json:"operation,omitempty"`
ExecutionSummary *[]ScriptActionExecutionSummary `json:"executionSummary,omitempty"`
DebugInformation *string `json:"debugInformation,omitempty"`
Name *string `json:"name,omitempty"`
URI *string `json:"uri,omitempty"`
Parameters *string `json:"parameters,omitempty"`
Roles *[]string `json:"roles,omitempty"`
ApplicationName *string `json:"applicationName,omitempty"`
}
// ScriptAction is describes a script action on role on the cluster.
type ScriptAction struct {
Name *string `json:"name,omitempty"`
URI *string `json:"uri,omitempty"`
Parameters *string `json:"parameters,omitempty"`
}
// ScriptActionExecutionHistoryList is the ListScriptExecutionHistory response.
type ScriptActionExecutionHistoryList struct {
autorest.Response `json:"-"`
Value *[]RuntimeScriptActionDetail `json:"value,omitempty"`
NextLink *string `json:"nextLink,omitempty"`
}
// ScriptActionExecutionHistoryListPreparer prepares a request to retrieve the next set of results. It returns
// nil if no more results exist.
func (client ScriptActionExecutionHistoryList) ScriptActionExecutionHistoryListPreparer() (*http.Request, error) {
if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {
return nil, nil
}
return autorest.Prepare(&http.Request{},
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(to.String(client.NextLink)))
}
// ScriptActionExecutionSummary is describes the execution summary of a script
// action.
type ScriptActionExecutionSummary struct {
Status *string `json:"status,omitempty"`
InstanceCount *int32 `json:"instanceCount,omitempty"`
}
// ScriptActionPersistedGetResponseSpec is the persisted script action for
// cluster
type ScriptActionPersistedGetResponseSpec struct {
Name *string `json:"name,omitempty"`
URI *string `json:"uri,omitempty"`
Parameters *string `json:"parameters,omitempty"`
Roles *[]string `json:"roles,omitempty"`
ApplicationName *string `json:"applicationName,omitempty"`
}
// ScriptActionsList is all persisted script action for the cluster.
type ScriptActionsList struct {
autorest.Response `json:"-"`
Value *[]RuntimeScriptActionDetail `json:"value,omitempty"`
NextLink *string `json:"nextLink,omitempty"`
}
// ScriptActionsListPreparer prepares a request to retrieve the next set of results. It returns
// nil if no more results exist.
func (client ScriptActionsList) ScriptActionsListPreparer() (*http.Request, error) {
if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {
return nil, nil
}
return autorest.Prepare(&http.Request{},
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(to.String(client.NextLink)))
}
// SecurityProfile is the security profile which contains Ssh public key for
// the HDInsight cluster.
type SecurityProfile struct {
DirectoryType DirectoryType `json:"directoryType,omitempty"`
Domain *string `json:"domain,omitempty"`
OrganizationalUnitDN *string `json:"organizationalUnitDN,omitempty"`
LdapsUrls *[]string `json:"ldapsUrls,omitempty"`
DomainUsername *string `json:"domainUsername,omitempty"`
DomainUserPassword *string `json:"domainUserPassword,omitempty"`
ClusterUsersGroupDNS *[]string `json:"clusterUsersGroupDNs,omitempty"`
}
// SSHProfile is the list of Ssh public keys.
type SSHProfile struct {
PublicKeys *[]SSHPublicKey `json:"publicKeys,omitempty"`
}
// SSHPublicKey is the Ssh public key for the cluster nodes.
type SSHPublicKey struct {
CertificateData *string `json:"certificateData,omitempty"`
}
// StorageAccount is describes the storage Account.
type StorageAccount struct {
Name *string `json:"name,omitempty"`
IsDefault *bool `json:"isDefault,omitempty"`
Container *string `json:"container,omitempty"`
Key *string `json:"key,omitempty"`
}
// StorageProfile is describes the storage profile.
type StorageProfile struct {
Storageaccounts *[]StorageAccount `json:"storageaccounts,omitempty"`
}
// SubResource is the sub resource definition.
type SubResource struct {
ID *string `json:"id,omitempty"`
}
// VersionsCapability is the version capability.
type VersionsCapability struct {
Available *[]VersionSpec `json:"available,omitempty"`
}
// VersionSpec is gets or sets Version spec properties.
type VersionSpec struct {
FriendlyName *string `json:"friendlyName,omitempty"`
DisplayName *string `json:"displayName,omitempty"`
IsDefault *string `json:"isDefault,omitempty"`
ComponentVersions *map[string]*string `json:"componentVersions,omitempty"`
}
// VirtualNetworkProfile is the Virtual network properties.
type VirtualNetworkProfile struct {
ID *string `json:"id,omitempty"`
Subnet *string `json:"subnet,omitempty"`
}
// VMSizeCompatibilityFilter is the virtual machine type compatibility filter.
type VMSizeCompatibilityFilter struct {
FilterMode *string `json:"FilterMode,omitempty"`
Regions *[]string `json:"Regions,omitempty"`
ClusterFlavors *[]string `json:"ClusterFlavors,omitempty"`
NodeTypes *[]string `json:"NodeTypes,omitempty"`
ClusterVersions *[]string `json:"ClusterVersions,omitempty"`
Vmsizes *[]string `json:"vmsizes,omitempty"`
}
// VMSizesCapability is the virtual machine sizes capability.
type VMSizesCapability struct {
Available *[]string `json:"available,omitempty"`
}
// WindowsOperatingSystemProfile is the Windows operation system settings.
type WindowsOperatingSystemProfile struct {
RdpSettings *RdpSettings `json:"rdpSettings,omitempty"`
}
+122
View File
@@ -0,0 +1,122 @@
package hdinsight
// 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 1.0.1.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
import (
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure"
"net/http"
)
// OperationsClient is the the HDInsight Management Client.
type OperationsClient struct {
ManagementClient
}
// NewOperationsClient creates an instance of the OperationsClient client.
func NewOperationsClient(subscriptionID string) OperationsClient {
return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID)
}
// NewOperationsClientWithBaseURI creates an instance of the OperationsClient
// client.
func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient {
return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)}
}
// List lists all of the available HDInsight REST API operations.
func (client OperationsClient) List() (result OperationListResult, err error) {
req, err := client.ListPreparer()
if err != nil {
err = autorest.NewErrorWithError(err, "hdinsight.OperationsClient", "List", nil, "Failure preparing request")
return
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "hdinsight.OperationsClient", "List", resp, "Failure sending request")
return
}
result, err = client.ListResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "hdinsight.OperationsClient", "List", resp, "Failure responding to request")
}
return
}
// ListPreparer prepares the List request.
func (client OperationsClient) ListPreparer() (*http.Request, error) {
const APIVersion = "2015-03-01-preview"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPath("/providers/Microsoft.HDInsight/operations"),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// ListSender sends the List request. The method will close the
// http.Response Body if it receives an error.
func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// ListResponder handles the response to the List request. The method always
// closes the http.Response Body.
func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// ListNextResults retrieves the next set of results, if any.
func (client OperationsClient) ListNextResults(lastResults OperationListResult) (result OperationListResult, err error) {
req, err := lastResults.OperationListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "hdinsight.OperationsClient", "List", nil, "Failure preparing next results request")
}
if req == nil {
return
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "hdinsight.OperationsClient", "List", resp, "Failure sending next results request")
}
result, err = client.ListResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "hdinsight.OperationsClient", "List", resp, "Failure responding to next results request")
}
return
}
+198
View File
@@ -0,0 +1,198 @@
package hdinsight
// 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 1.0.1.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
import (
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure"
"net/http"
)
// ScriptActionsClient is the the HDInsight Management Client.
type ScriptActionsClient struct {
ManagementClient
}
// NewScriptActionsClient creates an instance of the ScriptActionsClient
// client.
func NewScriptActionsClient(subscriptionID string) ScriptActionsClient {
return NewScriptActionsClientWithBaseURI(DefaultBaseURI, subscriptionID)
}
// NewScriptActionsClientWithBaseURI creates an instance of the
// ScriptActionsClient client.
func NewScriptActionsClientWithBaseURI(baseURI string, subscriptionID string) ScriptActionsClient {
return ScriptActionsClient{NewWithBaseURI(baseURI, subscriptionID)}
}
// Delete deletes a given persisted script action of the cluster.
//
// resourceGroupName is the name of the resource group. clusterName is the name
// of the cluster. scriptName is the name of the script.
func (client ScriptActionsClient) Delete(resourceGroupName string, clusterName string, scriptName string) (result autorest.Response, err error) {
req, err := client.DeletePreparer(resourceGroupName, clusterName, scriptName)
if err != nil {
err = autorest.NewErrorWithError(err, "hdinsight.ScriptActionsClient", "Delete", nil, "Failure preparing request")
return
}
resp, err := client.DeleteSender(req)
if err != nil {
result.Response = resp
err = autorest.NewErrorWithError(err, "hdinsight.ScriptActionsClient", "Delete", resp, "Failure sending request")
return
}
result, err = client.DeleteResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "hdinsight.ScriptActionsClient", "Delete", resp, "Failure responding to request")
}
return
}
// DeletePreparer prepares the Delete request.
func (client ScriptActionsClient) DeletePreparer(resourceGroupName string, clusterName string, scriptName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"clusterName": autorest.Encode("path", clusterName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"scriptName": autorest.Encode("path", scriptName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2015-03-01-preview"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsDelete(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/scriptActions/{scriptName}", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// DeleteSender sends the Delete request. The method will close the
// http.Response Body if it receives an error.
func (client ScriptActionsClient) DeleteSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// DeleteResponder handles the response to the Delete request. The method always
// closes the http.Response Body.
func (client ScriptActionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByClosing())
result.Response = resp
return
}
// List lists all persisted script actions for the given cluster.
//
// resourceGroupName is the name of the resource group. clusterName is the name
// of the cluster.
func (client ScriptActionsClient) List(resourceGroupName string, clusterName string) (result ScriptActionsList, err error) {
req, err := client.ListPreparer(resourceGroupName, clusterName)
if err != nil {
err = autorest.NewErrorWithError(err, "hdinsight.ScriptActionsClient", "List", nil, "Failure preparing request")
return
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "hdinsight.ScriptActionsClient", "List", resp, "Failure sending request")
return
}
result, err = client.ListResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "hdinsight.ScriptActionsClient", "List", resp, "Failure responding to request")
}
return
}
// ListPreparer prepares the List request.
func (client ScriptActionsClient) ListPreparer(resourceGroupName string, clusterName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"clusterName": autorest.Encode("path", clusterName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2015-03-01-preview"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/scriptActions", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// ListSender sends the List request. The method will close the
// http.Response Body if it receives an error.
func (client ScriptActionsClient) ListSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// ListResponder handles the response to the List request. The method always
// closes the http.Response Body.
func (client ScriptActionsClient) ListResponder(resp *http.Response) (result ScriptActionsList, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// ListNextResults retrieves the next set of results, if any.
func (client ScriptActionsClient) ListNextResults(lastResults ScriptActionsList) (result ScriptActionsList, err error) {
req, err := lastResults.ScriptActionsListPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "hdinsight.ScriptActionsClient", "List", nil, "Failure preparing next results request")
}
if req == nil {
return
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "hdinsight.ScriptActionsClient", "List", resp, "Failure sending next results request")
}
result, err = client.ListResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "hdinsight.ScriptActionsClient", "List", resp, "Failure responding to next results request")
}
return
}
+265
View File
@@ -0,0 +1,265 @@
package hdinsight
// 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 1.0.1.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
import (
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure"
"net/http"
)
// ScriptExecutionHistoryClient is the the HDInsight Management Client.
type ScriptExecutionHistoryClient struct {
ManagementClient
}
// NewScriptExecutionHistoryClient creates an instance of the
// ScriptExecutionHistoryClient client.
func NewScriptExecutionHistoryClient(subscriptionID string) ScriptExecutionHistoryClient {
return NewScriptExecutionHistoryClientWithBaseURI(DefaultBaseURI, subscriptionID)
}
// NewScriptExecutionHistoryClientWithBaseURI creates an instance of the
// ScriptExecutionHistoryClient client.
func NewScriptExecutionHistoryClientWithBaseURI(baseURI string, subscriptionID string) ScriptExecutionHistoryClient {
return ScriptExecutionHistoryClient{NewWithBaseURI(baseURI, subscriptionID)}
}
// Get gets the script execution detail for the given script execution id.
//
// resourceGroupName is the name of the resource group. clusterName is the name
// of the cluster. scriptExecutionID is the script execution Id
func (client ScriptExecutionHistoryClient) Get(resourceGroupName string, clusterName string, scriptExecutionID string) (result RuntimeScriptActionDetail, err error) {
req, err := client.GetPreparer(resourceGroupName, clusterName, scriptExecutionID)
if err != nil {
err = autorest.NewErrorWithError(err, "hdinsight.ScriptExecutionHistoryClient", "Get", nil, "Failure preparing request")
return
}
resp, err := client.GetSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "hdinsight.ScriptExecutionHistoryClient", "Get", resp, "Failure sending request")
return
}
result, err = client.GetResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "hdinsight.ScriptExecutionHistoryClient", "Get", resp, "Failure responding to request")
}
return
}
// GetPreparer prepares the Get request.
func (client ScriptExecutionHistoryClient) GetPreparer(resourceGroupName string, clusterName string, scriptExecutionID string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"clusterName": autorest.Encode("path", clusterName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"scriptExecutionId": autorest.Encode("path", scriptExecutionID),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2015-03-01-preview"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/scriptExecutionHistory/{scriptExecutionId}", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error.
func (client ScriptExecutionHistoryClient) GetSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// GetResponder handles the response to the Get request. The method always
// closes the http.Response Body.
func (client ScriptExecutionHistoryClient) GetResponder(resp *http.Response) (result RuntimeScriptActionDetail, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// List lists all scripts execution history for the given cluster.
//
// resourceGroupName is the name of the resource group. clusterName is the name
// of the cluster.
func (client ScriptExecutionHistoryClient) List(resourceGroupName string, clusterName string) (result ScriptActionExecutionHistoryList, err error) {
req, err := client.ListPreparer(resourceGroupName, clusterName)
if err != nil {
err = autorest.NewErrorWithError(err, "hdinsight.ScriptExecutionHistoryClient", "List", nil, "Failure preparing request")
return
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "hdinsight.ScriptExecutionHistoryClient", "List", resp, "Failure sending request")
return
}
result, err = client.ListResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "hdinsight.ScriptExecutionHistoryClient", "List", resp, "Failure responding to request")
}
return
}
// ListPreparer prepares the List request.
func (client ScriptExecutionHistoryClient) ListPreparer(resourceGroupName string, clusterName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"clusterName": autorest.Encode("path", clusterName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2015-03-01-preview"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/scriptExecutionHistory", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// ListSender sends the List request. The method will close the
// http.Response Body if it receives an error.
func (client ScriptExecutionHistoryClient) ListSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// ListResponder handles the response to the List request. The method always
// closes the http.Response Body.
func (client ScriptExecutionHistoryClient) ListResponder(resp *http.Response) (result ScriptActionExecutionHistoryList, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// ListNextResults retrieves the next set of results, if any.
func (client ScriptExecutionHistoryClient) ListNextResults(lastResults ScriptActionExecutionHistoryList) (result ScriptActionExecutionHistoryList, err error) {
req, err := lastResults.ScriptActionExecutionHistoryListPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "hdinsight.ScriptExecutionHistoryClient", "List", nil, "Failure preparing next results request")
}
if req == nil {
return
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "hdinsight.ScriptExecutionHistoryClient", "List", resp, "Failure sending next results request")
}
result, err = client.ListResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "hdinsight.ScriptExecutionHistoryClient", "List", resp, "Failure responding to next results request")
}
return
}
// Promote promote ad-hoc script execution to a persisted script.
//
// resourceGroupName is the name of the resource group. clusterName is the name
// of the cluster. scriptExecutionID is the script execution Id
func (client ScriptExecutionHistoryClient) Promote(resourceGroupName string, clusterName string, scriptExecutionID int64) (result autorest.Response, err error) {
req, err := client.PromotePreparer(resourceGroupName, clusterName, scriptExecutionID)
if err != nil {
err = autorest.NewErrorWithError(err, "hdinsight.ScriptExecutionHistoryClient", "Promote", nil, "Failure preparing request")
return
}
resp, err := client.PromoteSender(req)
if err != nil {
result.Response = resp
err = autorest.NewErrorWithError(err, "hdinsight.ScriptExecutionHistoryClient", "Promote", resp, "Failure sending request")
return
}
result, err = client.PromoteResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "hdinsight.ScriptExecutionHistoryClient", "Promote", resp, "Failure responding to request")
}
return
}
// PromotePreparer prepares the Promote request.
func (client ScriptExecutionHistoryClient) PromotePreparer(resourceGroupName string, clusterName string, scriptExecutionID int64) (*http.Request, error) {
pathParameters := map[string]interface{}{
"clusterName": autorest.Encode("path", clusterName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"scriptExecutionId": autorest.Encode("path", scriptExecutionID),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2015-03-01-preview"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsPost(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/scriptExecutionHistory/{scriptExecutionId}/promote", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// PromoteSender sends the Promote request. The method will close the
// http.Response Body if it receives an error.
func (client ScriptExecutionHistoryClient) PromoteSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// PromoteResponder handles the response to the Promote request. The method always
// closes the http.Response Body.
func (client ScriptExecutionHistoryClient) PromoteResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByClosing())
result.Response = resp
return
}
+29
View File
@@ -0,0 +1,29 @@
package hdinsight
// 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 1.0.1.0
// 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/v10.1.0-beta arm-hdinsight/"
}
// Version returns the semantic version (see http://semver.org) of the client.
func Version() string {
return "v10.1.0-beta"
}