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
+57
View File
@@ -0,0 +1,57 @@
// Package links implements the Azure ARM Links service API version 2016-09-01.
//
// Azure resources can be linked together to form logical relationships. You
// can establish links between resources belonging to different resource
// groups. However, all the linked resources must belong to the same
// subscription. Each resource can be linked to 50 other resources. If any of
// the linked resources are deleted or moved, the link owner must clean up the
// remaining link.
package links
// 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 Links
DefaultBaseURI = "https://management.azure.com"
)
// ManagementClient is the base client for Links.
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,
}
}
+72
View File
@@ -0,0 +1,72 @@
package links
// 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/to"
"net/http"
)
// Filter enumerates the values for filter.
type Filter string
const (
// AtScope specifies the at scope state for filter.
AtScope Filter = "atScope()"
)
// ResourceLink is the resource link.
type ResourceLink struct {
autorest.Response `json:"-"`
ID *string `json:"id,omitempty"`
Name *string `json:"name,omitempty"`
Properties *ResourceLinkProperties `json:"properties,omitempty"`
}
// ResourceLinkFilter is resource link filter.
type ResourceLinkFilter struct {
TargetID *string `json:"targetId,omitempty"`
}
// ResourceLinkProperties is the resource link properties.
type ResourceLinkProperties struct {
SourceID *string `json:"sourceId,omitempty"`
TargetID *string `json:"targetId,omitempty"`
Notes *string `json:"notes,omitempty"`
}
// ResourceLinkResult is list of resource links.
type ResourceLinkResult struct {
autorest.Response `json:"-"`
Value *[]ResourceLink `json:"value,omitempty"`
NextLink *string `json:"nextLink,omitempty"`
}
// ResourceLinkResultPreparer prepares a request to retrieve the next set of results. It returns
// nil if no more results exist.
func (client ResourceLinkResult) ResourceLinkResultPreparer() (*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)))
}
+442
View File
@@ -0,0 +1,442 @@
package links
// 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"
)
// ResourceLinksClient is the azure resources can be linked together to form
// logical relationships. You can establish links between resources belonging
// to different resource groups. However, all the linked resources must belong
// to the same subscription. Each resource can be linked to 50 other resources.
// If any of the linked resources are deleted or moved, the link owner must
// clean up the remaining link.
type ResourceLinksClient struct {
ManagementClient
}
// NewResourceLinksClient creates an instance of the ResourceLinksClient
// client.
func NewResourceLinksClient(subscriptionID string) ResourceLinksClient {
return NewResourceLinksClientWithBaseURI(DefaultBaseURI, subscriptionID)
}
// NewResourceLinksClientWithBaseURI creates an instance of the
// ResourceLinksClient client.
func NewResourceLinksClientWithBaseURI(baseURI string, subscriptionID string) ResourceLinksClient {
return ResourceLinksClient{NewWithBaseURI(baseURI, subscriptionID)}
}
// CreateOrUpdate creates or updates a resource link between the specified
// resources.
//
// linkID is the fully qualified ID of the resource link. Use the format,
// /subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/{provider-namespace}/{resource-type}/{resource-name}/Microsoft.Resources/links/{link-name}.
// For example,
// /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myGroup/Microsoft.Web/sites/mySite/Microsoft.Resources/links/myLink
// parameters is parameters for creating or updating a resource link.
func (client ResourceLinksClient) CreateOrUpdate(linkID string, parameters ResourceLink) (result ResourceLink, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: parameters,
Constraints: []validation.Constraint{{Target: "parameters.Properties", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "parameters.Properties.TargetID", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "links.ResourceLinksClient", "CreateOrUpdate")
}
req, err := client.CreateOrUpdatePreparer(linkID, parameters)
if err != nil {
err = autorest.NewErrorWithError(err, "links.ResourceLinksClient", "CreateOrUpdate", nil, "Failure preparing request")
return
}
resp, err := client.CreateOrUpdateSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "links.ResourceLinksClient", "CreateOrUpdate", resp, "Failure sending request")
return
}
result, err = client.CreateOrUpdateResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "links.ResourceLinksClient", "CreateOrUpdate", resp, "Failure responding to request")
}
return
}
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
func (client ResourceLinksClient) CreateOrUpdatePreparer(linkID string, parameters ResourceLink) (*http.Request, error) {
pathParameters := map[string]interface{}{
"linkId": linkID,
}
const APIVersion = "2016-09-01"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsJSON(),
autorest.AsPut(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/{linkId}", pathParameters),
autorest.WithJSON(parameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
// http.Response Body if it receives an error.
func (client ResourceLinksClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
// closes the http.Response Body.
func (client ResourceLinksClient) CreateOrUpdateResponder(resp *http.Response) (result ResourceLink, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// Delete deletes a resource link with the specified ID.
//
// linkID is the fully qualified ID of the resource link. Use the format,
// /subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/{provider-namespace}/{resource-type}/{resource-name}/Microsoft.Resources/links/{link-name}.
// For example,
// /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myGroup/Microsoft.Web/sites/mySite/Microsoft.Resources/links/myLink
func (client ResourceLinksClient) Delete(linkID string) (result autorest.Response, err error) {
req, err := client.DeletePreparer(linkID)
if err != nil {
err = autorest.NewErrorWithError(err, "links.ResourceLinksClient", "Delete", nil, "Failure preparing request")
return
}
resp, err := client.DeleteSender(req)
if err != nil {
result.Response = resp
err = autorest.NewErrorWithError(err, "links.ResourceLinksClient", "Delete", resp, "Failure sending request")
return
}
result, err = client.DeleteResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "links.ResourceLinksClient", "Delete", resp, "Failure responding to request")
}
return
}
// DeletePreparer prepares the Delete request.
func (client ResourceLinksClient) DeletePreparer(linkID string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"linkId": linkID,
}
const APIVersion = "2016-09-01"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsDelete(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/{linkId}", 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 ResourceLinksClient) 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 ResourceLinksClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
autorest.ByClosing())
result.Response = resp
return
}
// Get gets a resource link with the specified ID.
//
// linkID is the fully qualified Id of the resource link. For example,
// /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myGroup/Microsoft.Web/sites/mySite/Microsoft.Resources/links/myLink
func (client ResourceLinksClient) Get(linkID string) (result ResourceLink, err error) {
req, err := client.GetPreparer(linkID)
if err != nil {
err = autorest.NewErrorWithError(err, "links.ResourceLinksClient", "Get", nil, "Failure preparing request")
return
}
resp, err := client.GetSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "links.ResourceLinksClient", "Get", resp, "Failure sending request")
return
}
result, err = client.GetResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "links.ResourceLinksClient", "Get", resp, "Failure responding to request")
}
return
}
// GetPreparer prepares the Get request.
func (client ResourceLinksClient) GetPreparer(linkID string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"linkId": linkID,
}
const APIVersion = "2016-09-01"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/{linkId}", 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 ResourceLinksClient) 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 ResourceLinksClient) GetResponder(resp *http.Response) (result ResourceLink, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// ListAtSourceScope gets a list of resource links at and below the specified
// source scope.
//
// scope is the fully qualified ID of the scope for getting the resource links.
// For example, to list resource links at and under a resource group, set the
// scope to
// /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myGroup.
// filter is the filter to apply when getting resource links. To get links only
// at the specified scope (not below the scope), use Filter.atScope().
func (client ResourceLinksClient) ListAtSourceScope(scope string, filter Filter) (result ResourceLinkResult, err error) {
req, err := client.ListAtSourceScopePreparer(scope, filter)
if err != nil {
err = autorest.NewErrorWithError(err, "links.ResourceLinksClient", "ListAtSourceScope", nil, "Failure preparing request")
return
}
resp, err := client.ListAtSourceScopeSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "links.ResourceLinksClient", "ListAtSourceScope", resp, "Failure sending request")
return
}
result, err = client.ListAtSourceScopeResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "links.ResourceLinksClient", "ListAtSourceScope", resp, "Failure responding to request")
}
return
}
// ListAtSourceScopePreparer prepares the ListAtSourceScope request.
func (client ResourceLinksClient) ListAtSourceScopePreparer(scope string, filter Filter) (*http.Request, error) {
pathParameters := map[string]interface{}{
"scope": scope,
}
const APIVersion = "2016-09-01"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
if len(string(filter)) > 0 {
queryParameters["$filter"] = autorest.Encode("query", filter)
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/{scope}/providers/Microsoft.Resources/links", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// ListAtSourceScopeSender sends the ListAtSourceScope request. The method will close the
// http.Response Body if it receives an error.
func (client ResourceLinksClient) ListAtSourceScopeSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// ListAtSourceScopeResponder handles the response to the ListAtSourceScope request. The method always
// closes the http.Response Body.
func (client ResourceLinksClient) ListAtSourceScopeResponder(resp *http.Response) (result ResourceLinkResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// ListAtSourceScopeNextResults retrieves the next set of results, if any.
func (client ResourceLinksClient) ListAtSourceScopeNextResults(lastResults ResourceLinkResult) (result ResourceLinkResult, err error) {
req, err := lastResults.ResourceLinkResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "links.ResourceLinksClient", "ListAtSourceScope", nil, "Failure preparing next results request")
}
if req == nil {
return
}
resp, err := client.ListAtSourceScopeSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "links.ResourceLinksClient", "ListAtSourceScope", resp, "Failure sending next results request")
}
result, err = client.ListAtSourceScopeResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "links.ResourceLinksClient", "ListAtSourceScope", resp, "Failure responding to next results request")
}
return
}
// ListAtSubscription gets all the linked resources for the subscription.
//
// filter is the filter to apply on the list resource links operation. The
// supported filter for list resource links is targetid. For example,
// $filter=targetid eq {value}
func (client ResourceLinksClient) ListAtSubscription(filter string) (result ResourceLinkResult, err error) {
req, err := client.ListAtSubscriptionPreparer(filter)
if err != nil {
err = autorest.NewErrorWithError(err, "links.ResourceLinksClient", "ListAtSubscription", nil, "Failure preparing request")
return
}
resp, err := client.ListAtSubscriptionSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "links.ResourceLinksClient", "ListAtSubscription", resp, "Failure sending request")
return
}
result, err = client.ListAtSubscriptionResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "links.ResourceLinksClient", "ListAtSubscription", resp, "Failure responding to request")
}
return
}
// ListAtSubscriptionPreparer prepares the ListAtSubscription request.
func (client ResourceLinksClient) ListAtSubscriptionPreparer(filter string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2016-09-01"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
if len(filter) > 0 {
queryParameters["$filter"] = autorest.Encode("query", filter)
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Resources/links", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// ListAtSubscriptionSender sends the ListAtSubscription request. The method will close the
// http.Response Body if it receives an error.
func (client ResourceLinksClient) ListAtSubscriptionSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// ListAtSubscriptionResponder handles the response to the ListAtSubscription request. The method always
// closes the http.Response Body.
func (client ResourceLinksClient) ListAtSubscriptionResponder(resp *http.Response) (result ResourceLinkResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// ListAtSubscriptionNextResults retrieves the next set of results, if any.
func (client ResourceLinksClient) ListAtSubscriptionNextResults(lastResults ResourceLinkResult) (result ResourceLinkResult, err error) {
req, err := lastResults.ResourceLinkResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "links.ResourceLinksClient", "ListAtSubscription", nil, "Failure preparing next results request")
}
if req == nil {
return
}
resp, err := client.ListAtSubscriptionSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "links.ResourceLinksClient", "ListAtSubscription", resp, "Failure sending next results request")
}
result, err = client.ListAtSubscriptionResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "links.ResourceLinksClient", "ListAtSubscription", resp, "Failure responding to next results request")
}
return
}
+29
View File
@@ -0,0 +1,29 @@
package links
// 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-links/2016-09-01"
}
// Version returns the semantic version (see http://semver.org) of the client.
func Version() string {
return "v10.1.0-beta"
}