Merge pull request #294 from jeremyrickard/update-azure-go-sdk
Update dependencies to add service fabric mesh via new azure-sdk-go
This commit is contained in:
431
Gopkg.lock
generated
431
Gopkg.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -57,7 +57,7 @@
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/Azure/azure-sdk-for-go"
|
||||
version = "15.1.1"
|
||||
version = "19.1.0"
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/lawrencegripper/pod2docker"
|
||||
|
||||
@@ -49,7 +49,7 @@ type VicProvider struct {
|
||||
client *client.PortLayer
|
||||
imageStore proxy.ImageStore
|
||||
isolationProxy proxy.IsolationProxy
|
||||
systemProxy vicproxy.VicSystemProxy
|
||||
systemProxy *vicproxy.VicSystemProxy
|
||||
}
|
||||
|
||||
const (
|
||||
|
||||
233
vendor/github.com/Azure/azure-sdk-for-go/profiles/preview/preview/servicefabricmesh/mgmt/servicefabricmesh/models.go
generated
vendored
Normal file
233
vendor/github.com/Azure/azure-sdk-for-go/profiles/preview/preview/servicefabricmesh/mgmt/servicefabricmesh/models.go
generated
vendored
Normal file
@@ -0,0 +1,233 @@
|
||||
// +build go1.9
|
||||
|
||||
// Copyright 2018 Microsoft Corporation
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// This code was auto-generated by:
|
||||
// github.com/Azure/azure-sdk-for-go/tools/profileBuilder
|
||||
|
||||
package servicefabricmesh
|
||||
|
||||
import original "github.com/Azure/azure-sdk-for-go/services/preview/servicefabricmesh/mgmt/2018-07-01-preview/servicefabricmesh"
|
||||
|
||||
type ApplicationClient = original.ApplicationClient
|
||||
|
||||
const (
|
||||
DefaultBaseURI = original.DefaultBaseURI
|
||||
)
|
||||
|
||||
type BaseClient = original.BaseClient
|
||||
type CodePackageClient = original.CodePackageClient
|
||||
type ApplicationResourceStatus = original.ApplicationResourceStatus
|
||||
|
||||
const (
|
||||
Creating ApplicationResourceStatus = original.Creating
|
||||
Deleting ApplicationResourceStatus = original.Deleting
|
||||
Failed ApplicationResourceStatus = original.Failed
|
||||
Invalid ApplicationResourceStatus = original.Invalid
|
||||
Ready ApplicationResourceStatus = original.Ready
|
||||
Upgrading ApplicationResourceStatus = original.Upgrading
|
||||
)
|
||||
|
||||
type DiagnosticsSinkKind = original.DiagnosticsSinkKind
|
||||
|
||||
const (
|
||||
DiagnosticsSinkKindAzureInternalMonitoringPipeline DiagnosticsSinkKind = original.DiagnosticsSinkKindAzureInternalMonitoringPipeline
|
||||
DiagnosticsSinkKindInvalid DiagnosticsSinkKind = original.DiagnosticsSinkKindInvalid
|
||||
)
|
||||
|
||||
type HealthState = original.HealthState
|
||||
|
||||
const (
|
||||
HealthStateError HealthState = original.HealthStateError
|
||||
HealthStateInvalid HealthState = original.HealthStateInvalid
|
||||
HealthStateOk HealthState = original.HealthStateOk
|
||||
HealthStateUnknown HealthState = original.HealthStateUnknown
|
||||
HealthStateWarning HealthState = original.HealthStateWarning
|
||||
)
|
||||
|
||||
type IngressQoSLevel = original.IngressQoSLevel
|
||||
|
||||
const (
|
||||
Bronze IngressQoSLevel = original.Bronze
|
||||
)
|
||||
|
||||
type Kind = original.Kind
|
||||
|
||||
const (
|
||||
KindAzureInternalMonitoringPipeline Kind = original.KindAzureInternalMonitoringPipeline
|
||||
KindDiagnosticsSinkProperties Kind = original.KindDiagnosticsSinkProperties
|
||||
)
|
||||
|
||||
type OperatingSystemTypes = original.OperatingSystemTypes
|
||||
|
||||
const (
|
||||
Linux OperatingSystemTypes = original.Linux
|
||||
Windows OperatingSystemTypes = original.Windows
|
||||
)
|
||||
|
||||
type ServiceResourceStatus = original.ServiceResourceStatus
|
||||
|
||||
const (
|
||||
ServiceResourceStatusActive ServiceResourceStatus = original.ServiceResourceStatusActive
|
||||
ServiceResourceStatusCreating ServiceResourceStatus = original.ServiceResourceStatusCreating
|
||||
ServiceResourceStatusDeleting ServiceResourceStatus = original.ServiceResourceStatusDeleting
|
||||
ServiceResourceStatusFailed ServiceResourceStatus = original.ServiceResourceStatusFailed
|
||||
ServiceResourceStatusUnknown ServiceResourceStatus = original.ServiceResourceStatusUnknown
|
||||
ServiceResourceStatusUpgrading ServiceResourceStatus = original.ServiceResourceStatusUpgrading
|
||||
)
|
||||
|
||||
type ApplicationProperties = original.ApplicationProperties
|
||||
type ApplicationResourceDescription = original.ApplicationResourceDescription
|
||||
type ApplicationResourceDescriptionList = original.ApplicationResourceDescriptionList
|
||||
type ApplicationResourceDescriptionListIterator = original.ApplicationResourceDescriptionListIterator
|
||||
type ApplicationResourceDescriptionListPage = original.ApplicationResourceDescriptionListPage
|
||||
type ApplicationResourceProperties = original.ApplicationResourceProperties
|
||||
type AvailableOperationDisplay = original.AvailableOperationDisplay
|
||||
type AzureInternalMonitoringPipelineSinkDescription = original.AzureInternalMonitoringPipelineSinkDescription
|
||||
type ContainerCodePackageProperties = original.ContainerCodePackageProperties
|
||||
type ContainerEvent = original.ContainerEvent
|
||||
type ContainerInstanceView = original.ContainerInstanceView
|
||||
type ContainerLabel = original.ContainerLabel
|
||||
type ContainerLogs = original.ContainerLogs
|
||||
type ContainerState = original.ContainerState
|
||||
type ContainerVolume = original.ContainerVolume
|
||||
type DiagnosticsDescription = original.DiagnosticsDescription
|
||||
type DiagnosticsRef = original.DiagnosticsRef
|
||||
type BasicDiagnosticsSinkProperties = original.BasicDiagnosticsSinkProperties
|
||||
type DiagnosticsSinkProperties = original.DiagnosticsSinkProperties
|
||||
type EndpointProperties = original.EndpointProperties
|
||||
type EnvironmentVariable = original.EnvironmentVariable
|
||||
type ErrorModel = original.ErrorModel
|
||||
type ImageRegistryCredential = original.ImageRegistryCredential
|
||||
type IngressConfig = original.IngressConfig
|
||||
type Layer4IngressConfig = original.Layer4IngressConfig
|
||||
type ManagedProxyResource = original.ManagedProxyResource
|
||||
type NetworkProperties = original.NetworkProperties
|
||||
type NetworkRef = original.NetworkRef
|
||||
type NetworkResourceDescription = original.NetworkResourceDescription
|
||||
type NetworkResourceDescriptionList = original.NetworkResourceDescriptionList
|
||||
type NetworkResourceDescriptionListIterator = original.NetworkResourceDescriptionListIterator
|
||||
type NetworkResourceDescriptionListPage = original.NetworkResourceDescriptionListPage
|
||||
type NetworkResourceProperties = original.NetworkResourceProperties
|
||||
type OperationListResult = original.OperationListResult
|
||||
type OperationListResultIterator = original.OperationListResultIterator
|
||||
type OperationListResultPage = original.OperationListResultPage
|
||||
type OperationResult = original.OperationResult
|
||||
type ProvisionedResourceProperties = original.ProvisionedResourceProperties
|
||||
type ProxyResource = original.ProxyResource
|
||||
type Resource = original.Resource
|
||||
type ResourceLimits = original.ResourceLimits
|
||||
type ResourceRequests = original.ResourceRequests
|
||||
type ResourceRequirements = original.ResourceRequirements
|
||||
type ServiceList = original.ServiceList
|
||||
type ServiceListIterator = original.ServiceListIterator
|
||||
type ServiceListPage = original.ServiceListPage
|
||||
type ServiceReplicaDescription = original.ServiceReplicaDescription
|
||||
type ServiceReplicaList = original.ServiceReplicaList
|
||||
type ServiceReplicaListIterator = original.ServiceReplicaListIterator
|
||||
type ServiceReplicaListPage = original.ServiceReplicaListPage
|
||||
type ServiceReplicaProperties = original.ServiceReplicaProperties
|
||||
type ServiceResourceDescription = original.ServiceResourceDescription
|
||||
type ServiceResourceProperties = original.ServiceResourceProperties
|
||||
type Setting = original.Setting
|
||||
type TrackedResource = original.TrackedResource
|
||||
type VolumeProperties = original.VolumeProperties
|
||||
type VolumeProviderParametersAzureFile = original.VolumeProviderParametersAzureFile
|
||||
type VolumeResourceDescription = original.VolumeResourceDescription
|
||||
type VolumeResourceDescriptionList = original.VolumeResourceDescriptionList
|
||||
type VolumeResourceDescriptionListIterator = original.VolumeResourceDescriptionListIterator
|
||||
type VolumeResourceDescriptionListPage = original.VolumeResourceDescriptionListPage
|
||||
type VolumeResourceProperties = original.VolumeResourceProperties
|
||||
type NetworkClient = original.NetworkClient
|
||||
type OperationsClient = original.OperationsClient
|
||||
type ReplicaClient = original.ReplicaClient
|
||||
type ServiceClient = original.ServiceClient
|
||||
type VolumeClient = original.VolumeClient
|
||||
|
||||
func NewApplicationClient(subscriptionID string) ApplicationClient {
|
||||
return original.NewApplicationClient(subscriptionID)
|
||||
}
|
||||
func NewApplicationClientWithBaseURI(baseURI string, subscriptionID string) ApplicationClient {
|
||||
return original.NewApplicationClientWithBaseURI(baseURI, subscriptionID)
|
||||
}
|
||||
func New(subscriptionID string) BaseClient {
|
||||
return original.New(subscriptionID)
|
||||
}
|
||||
func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient {
|
||||
return original.NewWithBaseURI(baseURI, subscriptionID)
|
||||
}
|
||||
func NewCodePackageClient(subscriptionID string) CodePackageClient {
|
||||
return original.NewCodePackageClient(subscriptionID)
|
||||
}
|
||||
func NewCodePackageClientWithBaseURI(baseURI string, subscriptionID string) CodePackageClient {
|
||||
return original.NewCodePackageClientWithBaseURI(baseURI, subscriptionID)
|
||||
}
|
||||
func PossibleApplicationResourceStatusValues() []ApplicationResourceStatus {
|
||||
return original.PossibleApplicationResourceStatusValues()
|
||||
}
|
||||
func PossibleDiagnosticsSinkKindValues() []DiagnosticsSinkKind {
|
||||
return original.PossibleDiagnosticsSinkKindValues()
|
||||
}
|
||||
func PossibleHealthStateValues() []HealthState {
|
||||
return original.PossibleHealthStateValues()
|
||||
}
|
||||
func PossibleIngressQoSLevelValues() []IngressQoSLevel {
|
||||
return original.PossibleIngressQoSLevelValues()
|
||||
}
|
||||
func PossibleKindValues() []Kind {
|
||||
return original.PossibleKindValues()
|
||||
}
|
||||
func PossibleOperatingSystemTypesValues() []OperatingSystemTypes {
|
||||
return original.PossibleOperatingSystemTypesValues()
|
||||
}
|
||||
func PossibleServiceResourceStatusValues() []ServiceResourceStatus {
|
||||
return original.PossibleServiceResourceStatusValues()
|
||||
}
|
||||
func NewNetworkClient(subscriptionID string) NetworkClient {
|
||||
return original.NewNetworkClient(subscriptionID)
|
||||
}
|
||||
func NewNetworkClientWithBaseURI(baseURI string, subscriptionID string) NetworkClient {
|
||||
return original.NewNetworkClientWithBaseURI(baseURI, subscriptionID)
|
||||
}
|
||||
func NewOperationsClient(subscriptionID string) OperationsClient {
|
||||
return original.NewOperationsClient(subscriptionID)
|
||||
}
|
||||
func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient {
|
||||
return original.NewOperationsClientWithBaseURI(baseURI, subscriptionID)
|
||||
}
|
||||
func NewReplicaClient(subscriptionID string) ReplicaClient {
|
||||
return original.NewReplicaClient(subscriptionID)
|
||||
}
|
||||
func NewReplicaClientWithBaseURI(baseURI string, subscriptionID string) ReplicaClient {
|
||||
return original.NewReplicaClientWithBaseURI(baseURI, subscriptionID)
|
||||
}
|
||||
func NewServiceClient(subscriptionID string) ServiceClient {
|
||||
return original.NewServiceClient(subscriptionID)
|
||||
}
|
||||
func NewServiceClientWithBaseURI(baseURI string, subscriptionID string) ServiceClient {
|
||||
return original.NewServiceClientWithBaseURI(baseURI, subscriptionID)
|
||||
}
|
||||
func UserAgent() string {
|
||||
return original.UserAgent() + " profiles/preview"
|
||||
}
|
||||
func Version() string {
|
||||
return original.Version()
|
||||
}
|
||||
func NewVolumeClient(subscriptionID string) VolumeClient {
|
||||
return original.NewVolumeClient(subscriptionID)
|
||||
}
|
||||
func NewVolumeClientWithBaseURI(baseURI string, subscriptionID string) VolumeClient {
|
||||
return original.NewVolumeClientWithBaseURI(baseURI, subscriptionID)
|
||||
}
|
||||
439
vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicefabricmesh/mgmt/2018-07-01-preview/servicefabricmesh/application.go
generated
vendored
Normal file
439
vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicefabricmesh/mgmt/2018-07-01-preview/servicefabricmesh/application.go
generated
vendored
Normal file
@@ -0,0 +1,439 @@
|
||||
package servicefabricmesh
|
||||
|
||||
// Copyright (c) Microsoft and contributors. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
//
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/Azure/go-autorest/autorest"
|
||||
"github.com/Azure/go-autorest/autorest/azure"
|
||||
"github.com/Azure/go-autorest/autorest/validation"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// ApplicationClient is the service Fabric Mesh Management Client
|
||||
type ApplicationClient struct {
|
||||
BaseClient
|
||||
}
|
||||
|
||||
// NewApplicationClient creates an instance of the ApplicationClient client.
|
||||
func NewApplicationClient(subscriptionID string) ApplicationClient {
|
||||
return NewApplicationClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||
}
|
||||
|
||||
// NewApplicationClientWithBaseURI creates an instance of the ApplicationClient client.
|
||||
func NewApplicationClientWithBaseURI(baseURI string, subscriptionID string) ApplicationClient {
|
||||
return ApplicationClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||
}
|
||||
|
||||
// Create creates an application resource with the specified name and description. If an application with the same name
|
||||
// already exists, then its description is updated to the one indicated in this request.
|
||||
//
|
||||
// Use network resources to provide public connectivity to the services of an application.
|
||||
// Parameters:
|
||||
// resourceGroupName - azure resource group name
|
||||
// applicationName - the identity of the application.
|
||||
// applicationResourceDescription - description for creating an application resource.
|
||||
func (client ApplicationClient) Create(ctx context.Context, resourceGroupName string, applicationName string, applicationResourceDescription ApplicationResourceDescription) (result ApplicationResourceDescription, err error) {
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: applicationResourceDescription,
|
||||
Constraints: []validation.Constraint{{Target: "applicationResourceDescription.ApplicationResourceProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewError("servicefabricmesh.ApplicationClient", "Create", err.Error())
|
||||
}
|
||||
|
||||
req, err := client.CreatePreparer(ctx, resourceGroupName, applicationName, applicationResourceDescription)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicefabricmesh.ApplicationClient", "Create", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.CreateSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "servicefabricmesh.ApplicationClient", "Create", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.CreateResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicefabricmesh.ApplicationClient", "Create", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// CreatePreparer prepares the Create request.
|
||||
func (client ApplicationClient) CreatePreparer(ctx context.Context, resourceGroupName string, applicationName string, applicationResourceDescription ApplicationResourceDescription) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"applicationName": applicationName,
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
const APIVersion = "2018-07-01-preview"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsContentType("application/json; charset=utf-8"),
|
||||
autorest.AsPut(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh/applications/{applicationName}", pathParameters),
|
||||
autorest.WithJSON(applicationResourceDescription),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||
}
|
||||
|
||||
// CreateSender sends the Create request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client ApplicationClient) CreateSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req,
|
||||
azure.DoRetryWithRegistration(client.Client))
|
||||
}
|
||||
|
||||
// CreateResponder handles the response to the Create request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client ApplicationClient) CreateResponder(resp *http.Response) (result ApplicationResourceDescription, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// Delete deletes the application resource identified by the name.
|
||||
// Parameters:
|
||||
// resourceGroupName - azure resource group name
|
||||
// applicationName - the identity of the application.
|
||||
func (client ApplicationClient) Delete(ctx context.Context, resourceGroupName string, applicationName string) (result autorest.Response, err error) {
|
||||
req, err := client.DeletePreparer(ctx, resourceGroupName, applicationName)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicefabricmesh.ApplicationClient", "Delete", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.DeleteSender(req)
|
||||
if err != nil {
|
||||
result.Response = resp
|
||||
err = autorest.NewErrorWithError(err, "servicefabricmesh.ApplicationClient", "Delete", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.DeleteResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicefabricmesh.ApplicationClient", "Delete", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// DeletePreparer prepares the Delete request.
|
||||
func (client ApplicationClient) DeletePreparer(ctx context.Context, resourceGroupName string, applicationName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"applicationName": applicationName,
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
const APIVersion = "2018-07-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.ServiceFabricMesh/applications/{applicationName}", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||
}
|
||||
|
||||
// DeleteSender sends the Delete request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client ApplicationClient) DeleteSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req,
|
||||
azure.DoRetryWithRegistration(client.Client))
|
||||
}
|
||||
|
||||
// DeleteResponder handles the response to the Delete request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client ApplicationClient) 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 the information about the application resource with a given name. The information includes the information
|
||||
// about the application's services and other runtime properties.
|
||||
// Parameters:
|
||||
// resourceGroupName - azure resource group name
|
||||
// applicationName - the identity of the application.
|
||||
func (client ApplicationClient) Get(ctx context.Context, resourceGroupName string, applicationName string) (result ApplicationResourceDescription, err error) {
|
||||
req, err := client.GetPreparer(ctx, resourceGroupName, applicationName)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicefabricmesh.ApplicationClient", "Get", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.GetSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "servicefabricmesh.ApplicationClient", "Get", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.GetResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicefabricmesh.ApplicationClient", "Get", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// GetPreparer prepares the Get request.
|
||||
func (client ApplicationClient) GetPreparer(ctx context.Context, resourceGroupName string, applicationName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"applicationName": applicationName,
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
const APIVersion = "2018-07-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.ServiceFabricMesh/applications/{applicationName}", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||
}
|
||||
|
||||
// GetSender sends the Get request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client ApplicationClient) GetSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req,
|
||||
azure.DoRetryWithRegistration(client.Client))
|
||||
}
|
||||
|
||||
// GetResponder handles the response to the Get request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client ApplicationClient) GetResponder(resp *http.Response) (result ApplicationResourceDescription, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// ListByResourceGroup gets the information about all application resources in a given resource group. The information
|
||||
// includes the information about the application's services and other runtime properties.
|
||||
// Parameters:
|
||||
// resourceGroupName - azure resource group name
|
||||
func (client ApplicationClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ApplicationResourceDescriptionListPage, err error) {
|
||||
result.fn = client.listByResourceGroupNextResults
|
||||
req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicefabricmesh.ApplicationClient", "ListByResourceGroup", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListByResourceGroupSender(req)
|
||||
if err != nil {
|
||||
result.ardl.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "servicefabricmesh.ApplicationClient", "ListByResourceGroup", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result.ardl, err = client.ListByResourceGroupResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicefabricmesh.ApplicationClient", "ListByResourceGroup", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListByResourceGroupPreparer prepares the ListByResourceGroup request.
|
||||
func (client ApplicationClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
const APIVersion = "2018-07-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.ServiceFabricMesh/applications", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||
}
|
||||
|
||||
// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client ApplicationClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req,
|
||||
azure.DoRetryWithRegistration(client.Client))
|
||||
}
|
||||
|
||||
// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client ApplicationClient) ListByResourceGroupResponder(resp *http.Response) (result ApplicationResourceDescriptionList, 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 ApplicationClient) listByResourceGroupNextResults(lastResults ApplicationResourceDescriptionList) (result ApplicationResourceDescriptionList, err error) {
|
||||
req, err := lastResults.applicationResourceDescriptionListPreparer()
|
||||
if err != nil {
|
||||
return result, autorest.NewErrorWithError(err, "servicefabricmesh.ApplicationClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request")
|
||||
}
|
||||
if req == nil {
|
||||
return
|
||||
}
|
||||
resp, err := client.ListByResourceGroupSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return result, autorest.NewErrorWithError(err, "servicefabricmesh.ApplicationClient", "listByResourceGroupNextResults", resp, "Failure sending next results request")
|
||||
}
|
||||
result, err = client.ListByResourceGroupResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicefabricmesh.ApplicationClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required.
|
||||
func (client ApplicationClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result ApplicationResourceDescriptionListIterator, err error) {
|
||||
result.page, err = client.ListByResourceGroup(ctx, resourceGroupName)
|
||||
return
|
||||
}
|
||||
|
||||
// ListBySubscription gets the information about all application resources in a given subscription. The information
|
||||
// includes the information about the application's services and other runtime properties.
|
||||
func (client ApplicationClient) ListBySubscription(ctx context.Context) (result ApplicationResourceDescriptionListPage, err error) {
|
||||
result.fn = client.listBySubscriptionNextResults
|
||||
req, err := client.ListBySubscriptionPreparer(ctx)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicefabricmesh.ApplicationClient", "ListBySubscription", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListBySubscriptionSender(req)
|
||||
if err != nil {
|
||||
result.ardl.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "servicefabricmesh.ApplicationClient", "ListBySubscription", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result.ardl, err = client.ListBySubscriptionResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicefabricmesh.ApplicationClient", "ListBySubscription", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListBySubscriptionPreparer prepares the ListBySubscription request.
|
||||
func (client ApplicationClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
const APIVersion = "2018-07-01-preview"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabricMesh/applications", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||
}
|
||||
|
||||
// ListBySubscriptionSender sends the ListBySubscription request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client ApplicationClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req,
|
||||
azure.DoRetryWithRegistration(client.Client))
|
||||
}
|
||||
|
||||
// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client ApplicationClient) ListBySubscriptionResponder(resp *http.Response) (result ApplicationResourceDescriptionList, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// listBySubscriptionNextResults retrieves the next set of results, if any.
|
||||
func (client ApplicationClient) listBySubscriptionNextResults(lastResults ApplicationResourceDescriptionList) (result ApplicationResourceDescriptionList, err error) {
|
||||
req, err := lastResults.applicationResourceDescriptionListPreparer()
|
||||
if err != nil {
|
||||
return result, autorest.NewErrorWithError(err, "servicefabricmesh.ApplicationClient", "listBySubscriptionNextResults", nil, "Failure preparing next results request")
|
||||
}
|
||||
if req == nil {
|
||||
return
|
||||
}
|
||||
resp, err := client.ListBySubscriptionSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return result, autorest.NewErrorWithError(err, "servicefabricmesh.ApplicationClient", "listBySubscriptionNextResults", resp, "Failure sending next results request")
|
||||
}
|
||||
result, err = client.ListBySubscriptionResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicefabricmesh.ApplicationClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required.
|
||||
func (client ApplicationClient) ListBySubscriptionComplete(ctx context.Context) (result ApplicationResourceDescriptionListIterator, err error) {
|
||||
result.page, err = client.ListBySubscription(ctx)
|
||||
return
|
||||
}
|
||||
51
vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicefabricmesh/mgmt/2018-07-01-preview/servicefabricmesh/client.go
generated
vendored
Normal file
51
vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicefabricmesh/mgmt/2018-07-01-preview/servicefabricmesh/client.go
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
// Package servicefabricmesh implements the Azure ARM Servicefabricmesh service API version 2018-07-01-preview.
|
||||
//
|
||||
// Service Fabric Mesh Management Client
|
||||
package servicefabricmesh
|
||||
|
||||
// Copyright (c) Microsoft and contributors. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
//
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
import (
|
||||
"github.com/Azure/go-autorest/autorest"
|
||||
)
|
||||
|
||||
const (
|
||||
// DefaultBaseURI is the default URI used for the service Servicefabricmesh
|
||||
DefaultBaseURI = "https://management.azure.com"
|
||||
)
|
||||
|
||||
// BaseClient is the base client for Servicefabricmesh.
|
||||
type BaseClient struct {
|
||||
autorest.Client
|
||||
BaseURI string
|
||||
SubscriptionID string
|
||||
}
|
||||
|
||||
// New creates an instance of the BaseClient client.
|
||||
func New(subscriptionID string) BaseClient {
|
||||
return NewWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||
}
|
||||
|
||||
// NewWithBaseURI creates an instance of the BaseClient client.
|
||||
func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient {
|
||||
return BaseClient{
|
||||
Client: autorest.NewClientWithUserAgent(UserAgent()),
|
||||
BaseURI: baseURI,
|
||||
SubscriptionID: subscriptionID,
|
||||
}
|
||||
}
|
||||
117
vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicefabricmesh/mgmt/2018-07-01-preview/servicefabricmesh/codepackage.go
generated
vendored
Normal file
117
vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicefabricmesh/mgmt/2018-07-01-preview/servicefabricmesh/codepackage.go
generated
vendored
Normal file
@@ -0,0 +1,117 @@
|
||||
package servicefabricmesh
|
||||
|
||||
// Copyright (c) Microsoft and contributors. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
//
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/Azure/go-autorest/autorest"
|
||||
"github.com/Azure/go-autorest/autorest/azure"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// CodePackageClient is the service Fabric Mesh Management Client
|
||||
type CodePackageClient struct {
|
||||
BaseClient
|
||||
}
|
||||
|
||||
// NewCodePackageClient creates an instance of the CodePackageClient client.
|
||||
func NewCodePackageClient(subscriptionID string) CodePackageClient {
|
||||
return NewCodePackageClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||
}
|
||||
|
||||
// NewCodePackageClientWithBaseURI creates an instance of the CodePackageClient client.
|
||||
func NewCodePackageClientWithBaseURI(baseURI string, subscriptionID string) CodePackageClient {
|
||||
return CodePackageClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||
}
|
||||
|
||||
// GetContainerLog get the logs for the container of a given code package of an application.
|
||||
// Parameters:
|
||||
// resourceGroupName - azure resource group name
|
||||
// applicationName - the identity of the application.
|
||||
// serviceName - the identity of the service.
|
||||
// replicaName - the identity of the service replica.
|
||||
// codePackageName - the name of the code package.
|
||||
// tail - number of lines to show from the end of the logs. Default is 100.
|
||||
func (client CodePackageClient) GetContainerLog(ctx context.Context, resourceGroupName string, applicationName string, serviceName string, replicaName string, codePackageName string, tail *int32) (result ContainerLogs, err error) {
|
||||
req, err := client.GetContainerLogPreparer(ctx, resourceGroupName, applicationName, serviceName, replicaName, codePackageName, tail)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicefabricmesh.CodePackageClient", "GetContainerLog", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.GetContainerLogSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "servicefabricmesh.CodePackageClient", "GetContainerLog", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.GetContainerLogResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicefabricmesh.CodePackageClient", "GetContainerLog", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// GetContainerLogPreparer prepares the GetContainerLog request.
|
||||
func (client CodePackageClient) GetContainerLogPreparer(ctx context.Context, resourceGroupName string, applicationName string, serviceName string, replicaName string, codePackageName string, tail *int32) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"applicationName": applicationName,
|
||||
"codePackageName": codePackageName,
|
||||
"replicaName": replicaName,
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"serviceName": serviceName,
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
const APIVersion = "2018-07-01-preview"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
if tail != nil {
|
||||
queryParameters["tail"] = autorest.Encode("query", *tail)
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh/applications/{applicationName}/services/{serviceName}/replicas/{replicaName}/codePackages/{codePackageName}/logs", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||
}
|
||||
|
||||
// GetContainerLogSender sends the GetContainerLog request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client CodePackageClient) GetContainerLogSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req,
|
||||
azure.DoRetryWithRegistration(client.Client))
|
||||
}
|
||||
|
||||
// GetContainerLogResponder handles the response to the GetContainerLog request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client CodePackageClient) GetContainerLogResponder(resp *http.Response) (result ContainerLogs, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
1835
vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicefabricmesh/mgmt/2018-07-01-preview/servicefabricmesh/models.go
generated
vendored
Normal file
1835
vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicefabricmesh/mgmt/2018-07-01-preview/servicefabricmesh/models.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
441
vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicefabricmesh/mgmt/2018-07-01-preview/servicefabricmesh/network.go
generated
vendored
Normal file
441
vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicefabricmesh/mgmt/2018-07-01-preview/servicefabricmesh/network.go
generated
vendored
Normal file
@@ -0,0 +1,441 @@
|
||||
package servicefabricmesh
|
||||
|
||||
// Copyright (c) Microsoft and contributors. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
//
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/Azure/go-autorest/autorest"
|
||||
"github.com/Azure/go-autorest/autorest/azure"
|
||||
"github.com/Azure/go-autorest/autorest/validation"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// NetworkClient is the service Fabric Mesh Management Client
|
||||
type NetworkClient struct {
|
||||
BaseClient
|
||||
}
|
||||
|
||||
// NewNetworkClient creates an instance of the NetworkClient client.
|
||||
func NewNetworkClient(subscriptionID string) NetworkClient {
|
||||
return NewNetworkClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||
}
|
||||
|
||||
// NewNetworkClientWithBaseURI creates an instance of the NetworkClient client.
|
||||
func NewNetworkClientWithBaseURI(baseURI string, subscriptionID string) NetworkClient {
|
||||
return NetworkClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||
}
|
||||
|
||||
// Create creates a network resource with the specified name and description. If a network with the same name already
|
||||
// exists, then its description is updated to the one indicated in this request.
|
||||
//
|
||||
// Use network resources to create private network and configure public connectivity for services within your
|
||||
// application.
|
||||
// Parameters:
|
||||
// resourceGroupName - azure resource group name
|
||||
// networkName - the identity of the network.
|
||||
// networkResourceDescription - description for creating a network resource.
|
||||
func (client NetworkClient) Create(ctx context.Context, resourceGroupName string, networkName string, networkResourceDescription NetworkResourceDescription) (result NetworkResourceDescription, err error) {
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: networkResourceDescription,
|
||||
Constraints: []validation.Constraint{{Target: "networkResourceDescription.NetworkResourceProperties", Name: validation.Null, Rule: true,
|
||||
Chain: []validation.Constraint{{Target: "networkResourceDescription.NetworkResourceProperties.AddressPrefix", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil {
|
||||
return result, validation.NewError("servicefabricmesh.NetworkClient", "Create", err.Error())
|
||||
}
|
||||
|
||||
req, err := client.CreatePreparer(ctx, resourceGroupName, networkName, networkResourceDescription)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicefabricmesh.NetworkClient", "Create", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.CreateSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "servicefabricmesh.NetworkClient", "Create", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.CreateResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicefabricmesh.NetworkClient", "Create", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// CreatePreparer prepares the Create request.
|
||||
func (client NetworkClient) CreatePreparer(ctx context.Context, resourceGroupName string, networkName string, networkResourceDescription NetworkResourceDescription) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"networkName": networkName,
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
const APIVersion = "2018-07-01-preview"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsContentType("application/json; charset=utf-8"),
|
||||
autorest.AsPut(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh/networks/{networkName}", pathParameters),
|
||||
autorest.WithJSON(networkResourceDescription),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||
}
|
||||
|
||||
// CreateSender sends the Create request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client NetworkClient) CreateSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req,
|
||||
azure.DoRetryWithRegistration(client.Client))
|
||||
}
|
||||
|
||||
// CreateResponder handles the response to the Create request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client NetworkClient) CreateResponder(resp *http.Response) (result NetworkResourceDescription, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// Delete deletes the network resource identified by the name.
|
||||
// Parameters:
|
||||
// resourceGroupName - azure resource group name
|
||||
// networkName - the identity of the network.
|
||||
func (client NetworkClient) Delete(ctx context.Context, resourceGroupName string, networkName string) (result autorest.Response, err error) {
|
||||
req, err := client.DeletePreparer(ctx, resourceGroupName, networkName)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicefabricmesh.NetworkClient", "Delete", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.DeleteSender(req)
|
||||
if err != nil {
|
||||
result.Response = resp
|
||||
err = autorest.NewErrorWithError(err, "servicefabricmesh.NetworkClient", "Delete", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.DeleteResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicefabricmesh.NetworkClient", "Delete", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// DeletePreparer prepares the Delete request.
|
||||
func (client NetworkClient) DeletePreparer(ctx context.Context, resourceGroupName string, networkName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"networkName": networkName,
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
const APIVersion = "2018-07-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.ServiceFabricMesh/networks/{networkName}", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||
}
|
||||
|
||||
// DeleteSender sends the Delete request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client NetworkClient) DeleteSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req,
|
||||
azure.DoRetryWithRegistration(client.Client))
|
||||
}
|
||||
|
||||
// DeleteResponder handles the response to the Delete request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client NetworkClient) 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 the information about the network resource with a given name. This information includes the network
|
||||
// description and other runtime information.
|
||||
// Parameters:
|
||||
// resourceGroupName - azure resource group name
|
||||
// networkName - the identity of the network.
|
||||
func (client NetworkClient) Get(ctx context.Context, resourceGroupName string, networkName string) (result NetworkResourceDescription, err error) {
|
||||
req, err := client.GetPreparer(ctx, resourceGroupName, networkName)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicefabricmesh.NetworkClient", "Get", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.GetSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "servicefabricmesh.NetworkClient", "Get", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.GetResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicefabricmesh.NetworkClient", "Get", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// GetPreparer prepares the Get request.
|
||||
func (client NetworkClient) GetPreparer(ctx context.Context, resourceGroupName string, networkName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"networkName": networkName,
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
const APIVersion = "2018-07-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.ServiceFabricMesh/networks/{networkName}", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||
}
|
||||
|
||||
// GetSender sends the Get request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client NetworkClient) GetSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req,
|
||||
azure.DoRetryWithRegistration(client.Client))
|
||||
}
|
||||
|
||||
// GetResponder handles the response to the Get request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client NetworkClient) GetResponder(resp *http.Response) (result NetworkResourceDescription, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// ListByResourceGroup gets the information about all network resources in a given resource group. The information
|
||||
// includes the network description and other runtime properties.
|
||||
// Parameters:
|
||||
// resourceGroupName - azure resource group name
|
||||
func (client NetworkClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result NetworkResourceDescriptionListPage, err error) {
|
||||
result.fn = client.listByResourceGroupNextResults
|
||||
req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicefabricmesh.NetworkClient", "ListByResourceGroup", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListByResourceGroupSender(req)
|
||||
if err != nil {
|
||||
result.nrdl.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "servicefabricmesh.NetworkClient", "ListByResourceGroup", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result.nrdl, err = client.ListByResourceGroupResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicefabricmesh.NetworkClient", "ListByResourceGroup", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListByResourceGroupPreparer prepares the ListByResourceGroup request.
|
||||
func (client NetworkClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
const APIVersion = "2018-07-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.ServiceFabricMesh/networks", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||
}
|
||||
|
||||
// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client NetworkClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req,
|
||||
azure.DoRetryWithRegistration(client.Client))
|
||||
}
|
||||
|
||||
// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client NetworkClient) ListByResourceGroupResponder(resp *http.Response) (result NetworkResourceDescriptionList, 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 NetworkClient) listByResourceGroupNextResults(lastResults NetworkResourceDescriptionList) (result NetworkResourceDescriptionList, err error) {
|
||||
req, err := lastResults.networkResourceDescriptionListPreparer()
|
||||
if err != nil {
|
||||
return result, autorest.NewErrorWithError(err, "servicefabricmesh.NetworkClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request")
|
||||
}
|
||||
if req == nil {
|
||||
return
|
||||
}
|
||||
resp, err := client.ListByResourceGroupSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return result, autorest.NewErrorWithError(err, "servicefabricmesh.NetworkClient", "listByResourceGroupNextResults", resp, "Failure sending next results request")
|
||||
}
|
||||
result, err = client.ListByResourceGroupResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicefabricmesh.NetworkClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required.
|
||||
func (client NetworkClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result NetworkResourceDescriptionListIterator, err error) {
|
||||
result.page, err = client.ListByResourceGroup(ctx, resourceGroupName)
|
||||
return
|
||||
}
|
||||
|
||||
// ListBySubscription gets the information about all network resources in a given subscription. The information
|
||||
// includes the network description and other runtime properties.
|
||||
func (client NetworkClient) ListBySubscription(ctx context.Context) (result NetworkResourceDescriptionListPage, err error) {
|
||||
result.fn = client.listBySubscriptionNextResults
|
||||
req, err := client.ListBySubscriptionPreparer(ctx)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicefabricmesh.NetworkClient", "ListBySubscription", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListBySubscriptionSender(req)
|
||||
if err != nil {
|
||||
result.nrdl.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "servicefabricmesh.NetworkClient", "ListBySubscription", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result.nrdl, err = client.ListBySubscriptionResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicefabricmesh.NetworkClient", "ListBySubscription", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListBySubscriptionPreparer prepares the ListBySubscription request.
|
||||
func (client NetworkClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
const APIVersion = "2018-07-01-preview"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabricMesh/networks", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||
}
|
||||
|
||||
// ListBySubscriptionSender sends the ListBySubscription request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client NetworkClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req,
|
||||
azure.DoRetryWithRegistration(client.Client))
|
||||
}
|
||||
|
||||
// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client NetworkClient) ListBySubscriptionResponder(resp *http.Response) (result NetworkResourceDescriptionList, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// listBySubscriptionNextResults retrieves the next set of results, if any.
|
||||
func (client NetworkClient) listBySubscriptionNextResults(lastResults NetworkResourceDescriptionList) (result NetworkResourceDescriptionList, err error) {
|
||||
req, err := lastResults.networkResourceDescriptionListPreparer()
|
||||
if err != nil {
|
||||
return result, autorest.NewErrorWithError(err, "servicefabricmesh.NetworkClient", "listBySubscriptionNextResults", nil, "Failure preparing next results request")
|
||||
}
|
||||
if req == nil {
|
||||
return
|
||||
}
|
||||
resp, err := client.ListBySubscriptionSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return result, autorest.NewErrorWithError(err, "servicefabricmesh.NetworkClient", "listBySubscriptionNextResults", resp, "Failure sending next results request")
|
||||
}
|
||||
result, err = client.ListBySubscriptionResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicefabricmesh.NetworkClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required.
|
||||
func (client NetworkClient) ListBySubscriptionComplete(ctx context.Context) (result NetworkResourceDescriptionListIterator, err error) {
|
||||
result.page, err = client.ListBySubscription(ctx)
|
||||
return
|
||||
}
|
||||
126
vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicefabricmesh/mgmt/2018-07-01-preview/servicefabricmesh/operations.go
generated
vendored
Normal file
126
vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicefabricmesh/mgmt/2018-07-01-preview/servicefabricmesh/operations.go
generated
vendored
Normal file
@@ -0,0 +1,126 @@
|
||||
package servicefabricmesh
|
||||
|
||||
// Copyright (c) Microsoft and contributors. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
//
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/Azure/go-autorest/autorest"
|
||||
"github.com/Azure/go-autorest/autorest/azure"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// OperationsClient is the service Fabric Mesh Management Client
|
||||
type OperationsClient struct {
|
||||
BaseClient
|
||||
}
|
||||
|
||||
// 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 the available operations provided by Service Fabric SeaBreeze resource provider.
|
||||
func (client OperationsClient) List(ctx context.Context) (result OperationListResultPage, err error) {
|
||||
result.fn = client.listNextResults
|
||||
req, err := client.ListPreparer(ctx)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicefabricmesh.OperationsClient", "List", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListSender(req)
|
||||
if err != nil {
|
||||
result.olr.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "servicefabricmesh.OperationsClient", "List", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result.olr, err = client.ListResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicefabricmesh.OperationsClient", "List", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListPreparer prepares the List request.
|
||||
func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) {
|
||||
const APIVersion = "2018-07-01-preview"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/providers/Microsoft.ServiceFabricMesh/operations"),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||
}
|
||||
|
||||
// ListSender sends the List request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req,
|
||||
autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
|
||||
}
|
||||
|
||||
// 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, "servicefabricmesh.OperationsClient", "listNextResults", nil, "Failure preparing next results request")
|
||||
}
|
||||
if req == nil {
|
||||
return
|
||||
}
|
||||
resp, err := client.ListSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return result, autorest.NewErrorWithError(err, "servicefabricmesh.OperationsClient", "listNextResults", resp, "Failure sending next results request")
|
||||
}
|
||||
result, err = client.ListResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicefabricmesh.OperationsClient", "listNextResults", resp, "Failure responding to next results request")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// ListComplete enumerates all values, automatically crossing page boundaries as required.
|
||||
func (client OperationsClient) ListComplete(ctx context.Context) (result OperationListResultIterator, err error) {
|
||||
result.page, err = client.List(ctx)
|
||||
return
|
||||
}
|
||||
210
vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicefabricmesh/mgmt/2018-07-01-preview/servicefabricmesh/replica.go
generated
vendored
Normal file
210
vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicefabricmesh/mgmt/2018-07-01-preview/servicefabricmesh/replica.go
generated
vendored
Normal file
@@ -0,0 +1,210 @@
|
||||
package servicefabricmesh
|
||||
|
||||
// Copyright (c) Microsoft and contributors. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
//
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/Azure/go-autorest/autorest"
|
||||
"github.com/Azure/go-autorest/autorest/azure"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// ReplicaClient is the service Fabric Mesh Management Client
|
||||
type ReplicaClient struct {
|
||||
BaseClient
|
||||
}
|
||||
|
||||
// NewReplicaClient creates an instance of the ReplicaClient client.
|
||||
func NewReplicaClient(subscriptionID string) ReplicaClient {
|
||||
return NewReplicaClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||
}
|
||||
|
||||
// NewReplicaClientWithBaseURI creates an instance of the ReplicaClient client.
|
||||
func NewReplicaClientWithBaseURI(baseURI string, subscriptionID string) ReplicaClient {
|
||||
return ReplicaClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||
}
|
||||
|
||||
// Get gets the information about the specified replica of a given service of an application. The information includes
|
||||
// the runtime properties of the replica instance.
|
||||
// Parameters:
|
||||
// resourceGroupName - azure resource group name
|
||||
// applicationName - the identity of the application.
|
||||
// serviceName - the identity of the service.
|
||||
// replicaName - the identity of the service replica.
|
||||
func (client ReplicaClient) Get(ctx context.Context, resourceGroupName string, applicationName string, serviceName string, replicaName string) (result ServiceReplicaDescription, err error) {
|
||||
req, err := client.GetPreparer(ctx, resourceGroupName, applicationName, serviceName, replicaName)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicefabricmesh.ReplicaClient", "Get", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.GetSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "servicefabricmesh.ReplicaClient", "Get", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.GetResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicefabricmesh.ReplicaClient", "Get", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// GetPreparer prepares the Get request.
|
||||
func (client ReplicaClient) GetPreparer(ctx context.Context, resourceGroupName string, applicationName string, serviceName string, replicaName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"applicationName": applicationName,
|
||||
"replicaName": replicaName,
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"serviceName": serviceName,
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
const APIVersion = "2018-07-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.ServiceFabricMesh/applications/{applicationName}/services/{serviceName}/replicas/{replicaName}", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||
}
|
||||
|
||||
// GetSender sends the Get request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client ReplicaClient) GetSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req,
|
||||
azure.DoRetryWithRegistration(client.Client))
|
||||
}
|
||||
|
||||
// GetResponder handles the response to the Get request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client ReplicaClient) GetResponder(resp *http.Response) (result ServiceReplicaDescription, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// ListByServiceName gets the information about all replicas of a given service of an application. The information
|
||||
// includes the runtime properties of the replica instance.
|
||||
// Parameters:
|
||||
// resourceGroupName - azure resource group name
|
||||
// applicationName - the identity of the application.
|
||||
// serviceName - the identity of the service.
|
||||
func (client ReplicaClient) ListByServiceName(ctx context.Context, resourceGroupName string, applicationName string, serviceName string) (result ServiceReplicaListPage, err error) {
|
||||
result.fn = client.listByServiceNameNextResults
|
||||
req, err := client.ListByServiceNamePreparer(ctx, resourceGroupName, applicationName, serviceName)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicefabricmesh.ReplicaClient", "ListByServiceName", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListByServiceNameSender(req)
|
||||
if err != nil {
|
||||
result.srl.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "servicefabricmesh.ReplicaClient", "ListByServiceName", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result.srl, err = client.ListByServiceNameResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicefabricmesh.ReplicaClient", "ListByServiceName", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListByServiceNamePreparer prepares the ListByServiceName request.
|
||||
func (client ReplicaClient) ListByServiceNamePreparer(ctx context.Context, resourceGroupName string, applicationName string, serviceName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"applicationName": applicationName,
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"serviceName": serviceName,
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
const APIVersion = "2018-07-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.ServiceFabricMesh/applications/{applicationName}/services/{serviceName}/replicas", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||
}
|
||||
|
||||
// ListByServiceNameSender sends the ListByServiceName request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client ReplicaClient) ListByServiceNameSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req,
|
||||
azure.DoRetryWithRegistration(client.Client))
|
||||
}
|
||||
|
||||
// ListByServiceNameResponder handles the response to the ListByServiceName request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client ReplicaClient) ListByServiceNameResponder(resp *http.Response) (result ServiceReplicaList, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// listByServiceNameNextResults retrieves the next set of results, if any.
|
||||
func (client ReplicaClient) listByServiceNameNextResults(lastResults ServiceReplicaList) (result ServiceReplicaList, err error) {
|
||||
req, err := lastResults.serviceReplicaListPreparer()
|
||||
if err != nil {
|
||||
return result, autorest.NewErrorWithError(err, "servicefabricmesh.ReplicaClient", "listByServiceNameNextResults", nil, "Failure preparing next results request")
|
||||
}
|
||||
if req == nil {
|
||||
return
|
||||
}
|
||||
resp, err := client.ListByServiceNameSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return result, autorest.NewErrorWithError(err, "servicefabricmesh.ReplicaClient", "listByServiceNameNextResults", resp, "Failure sending next results request")
|
||||
}
|
||||
result, err = client.ListByServiceNameResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicefabricmesh.ReplicaClient", "listByServiceNameNextResults", resp, "Failure responding to next results request")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// ListByServiceNameComplete enumerates all values, automatically crossing page boundaries as required.
|
||||
func (client ReplicaClient) ListByServiceNameComplete(ctx context.Context, resourceGroupName string, applicationName string, serviceName string) (result ServiceReplicaListIterator, err error) {
|
||||
result.page, err = client.ListByServiceName(ctx, resourceGroupName, applicationName, serviceName)
|
||||
return
|
||||
}
|
||||
205
vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicefabricmesh/mgmt/2018-07-01-preview/servicefabricmesh/service.go
generated
vendored
Normal file
205
vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicefabricmesh/mgmt/2018-07-01-preview/servicefabricmesh/service.go
generated
vendored
Normal file
@@ -0,0 +1,205 @@
|
||||
package servicefabricmesh
|
||||
|
||||
// Copyright (c) Microsoft and contributors. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
//
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/Azure/go-autorest/autorest"
|
||||
"github.com/Azure/go-autorest/autorest/azure"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// ServiceClient is the service Fabric Mesh Management Client
|
||||
type ServiceClient struct {
|
||||
BaseClient
|
||||
}
|
||||
|
||||
// NewServiceClient creates an instance of the ServiceClient client.
|
||||
func NewServiceClient(subscriptionID string) ServiceClient {
|
||||
return NewServiceClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||
}
|
||||
|
||||
// NewServiceClientWithBaseURI creates an instance of the ServiceClient client.
|
||||
func NewServiceClientWithBaseURI(baseURI string, subscriptionID string) ServiceClient {
|
||||
return ServiceClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||
}
|
||||
|
||||
// Get the operation returns the properties of the service.
|
||||
// Parameters:
|
||||
// resourceGroupName - azure resource group name
|
||||
// applicationName - the identity of the application.
|
||||
// serviceName - the identity of the service.
|
||||
func (client ServiceClient) Get(ctx context.Context, resourceGroupName string, applicationName string, serviceName string) (result ServiceResourceDescription, err error) {
|
||||
req, err := client.GetPreparer(ctx, resourceGroupName, applicationName, serviceName)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicefabricmesh.ServiceClient", "Get", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.GetSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "servicefabricmesh.ServiceClient", "Get", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.GetResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicefabricmesh.ServiceClient", "Get", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// GetPreparer prepares the Get request.
|
||||
func (client ServiceClient) GetPreparer(ctx context.Context, resourceGroupName string, applicationName string, serviceName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"applicationName": applicationName,
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"serviceName": serviceName,
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
const APIVersion = "2018-07-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.ServiceFabricMesh/applications/{applicationName}/services/{serviceName}", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||
}
|
||||
|
||||
// GetSender sends the Get request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client ServiceClient) GetSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req,
|
||||
azure.DoRetryWithRegistration(client.Client))
|
||||
}
|
||||
|
||||
// GetResponder handles the response to the Get request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client ServiceClient) GetResponder(resp *http.Response) (result ServiceResourceDescription, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// ListByApplicationName gets the information about all services of a given service of an application. The information
|
||||
// includes the runtime properties of the service instance.
|
||||
// Parameters:
|
||||
// resourceGroupName - azure resource group name
|
||||
// applicationName - the identity of the application.
|
||||
func (client ServiceClient) ListByApplicationName(ctx context.Context, resourceGroupName string, applicationName string) (result ServiceListPage, err error) {
|
||||
result.fn = client.listByApplicationNameNextResults
|
||||
req, err := client.ListByApplicationNamePreparer(ctx, resourceGroupName, applicationName)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicefabricmesh.ServiceClient", "ListByApplicationName", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListByApplicationNameSender(req)
|
||||
if err != nil {
|
||||
result.sl.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "servicefabricmesh.ServiceClient", "ListByApplicationName", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result.sl, err = client.ListByApplicationNameResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicefabricmesh.ServiceClient", "ListByApplicationName", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListByApplicationNamePreparer prepares the ListByApplicationName request.
|
||||
func (client ServiceClient) ListByApplicationNamePreparer(ctx context.Context, resourceGroupName string, applicationName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"applicationName": applicationName,
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
const APIVersion = "2018-07-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.ServiceFabricMesh/applications/{applicationName}/services", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||
}
|
||||
|
||||
// ListByApplicationNameSender sends the ListByApplicationName request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client ServiceClient) ListByApplicationNameSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req,
|
||||
azure.DoRetryWithRegistration(client.Client))
|
||||
}
|
||||
|
||||
// ListByApplicationNameResponder handles the response to the ListByApplicationName request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client ServiceClient) ListByApplicationNameResponder(resp *http.Response) (result ServiceList, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// listByApplicationNameNextResults retrieves the next set of results, if any.
|
||||
func (client ServiceClient) listByApplicationNameNextResults(lastResults ServiceList) (result ServiceList, err error) {
|
||||
req, err := lastResults.serviceListPreparer()
|
||||
if err != nil {
|
||||
return result, autorest.NewErrorWithError(err, "servicefabricmesh.ServiceClient", "listByApplicationNameNextResults", nil, "Failure preparing next results request")
|
||||
}
|
||||
if req == nil {
|
||||
return
|
||||
}
|
||||
resp, err := client.ListByApplicationNameSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return result, autorest.NewErrorWithError(err, "servicefabricmesh.ServiceClient", "listByApplicationNameNextResults", resp, "Failure sending next results request")
|
||||
}
|
||||
result, err = client.ListByApplicationNameResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicefabricmesh.ServiceClient", "listByApplicationNameNextResults", resp, "Failure responding to next results request")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// ListByApplicationNameComplete enumerates all values, automatically crossing page boundaries as required.
|
||||
func (client ServiceClient) ListByApplicationNameComplete(ctx context.Context, resourceGroupName string, applicationName string) (result ServiceListIterator, err error) {
|
||||
result.page, err = client.ListByApplicationName(ctx, resourceGroupName, applicationName)
|
||||
return
|
||||
}
|
||||
30
vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicefabricmesh/mgmt/2018-07-01-preview/servicefabricmesh/version.go
generated
vendored
Normal file
30
vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicefabricmesh/mgmt/2018-07-01-preview/servicefabricmesh/version.go
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
package servicefabricmesh
|
||||
|
||||
import "github.com/Azure/azure-sdk-for-go/version"
|
||||
|
||||
// Copyright (c) Microsoft and contributors. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
//
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
// UserAgent returns the UserAgent string to use when sending http.Requests.
|
||||
func UserAgent() string {
|
||||
return "Azure-SDK-For-Go/" + version.Number + " servicefabricmesh/2018-07-01-preview"
|
||||
}
|
||||
|
||||
// Version returns the semantic version (see http://semver.org) of the client.
|
||||
func Version() string {
|
||||
return version.Number
|
||||
}
|
||||
443
vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicefabricmesh/mgmt/2018-07-01-preview/servicefabricmesh/volume.go
generated
vendored
Normal file
443
vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicefabricmesh/mgmt/2018-07-01-preview/servicefabricmesh/volume.go
generated
vendored
Normal file
@@ -0,0 +1,443 @@
|
||||
package servicefabricmesh
|
||||
|
||||
// Copyright (c) Microsoft and contributors. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
//
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/Azure/go-autorest/autorest"
|
||||
"github.com/Azure/go-autorest/autorest/azure"
|
||||
"github.com/Azure/go-autorest/autorest/validation"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// VolumeClient is the service Fabric Mesh Management Client
|
||||
type VolumeClient struct {
|
||||
BaseClient
|
||||
}
|
||||
|
||||
// NewVolumeClient creates an instance of the VolumeClient client.
|
||||
func NewVolumeClient(subscriptionID string) VolumeClient {
|
||||
return NewVolumeClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||
}
|
||||
|
||||
// NewVolumeClientWithBaseURI creates an instance of the VolumeClient client.
|
||||
func NewVolumeClientWithBaseURI(baseURI string, subscriptionID string) VolumeClient {
|
||||
return VolumeClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||
}
|
||||
|
||||
// Create creates a volume resource with the specified name and description. If a volume with the same name already
|
||||
// exists, then its description is updated to the one indicated in this request.
|
||||
// Parameters:
|
||||
// resourceGroupName - azure resource group name
|
||||
// volumeName - the identity of the volume.
|
||||
// volumeResourceDescription - description for creating a volume resource.
|
||||
func (client VolumeClient) Create(ctx context.Context, resourceGroupName string, volumeName string, volumeResourceDescription VolumeResourceDescription) (result VolumeResourceDescription, err error) {
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: volumeResourceDescription,
|
||||
Constraints: []validation.Constraint{{Target: "volumeResourceDescription.VolumeResourceProperties", Name: validation.Null, Rule: true,
|
||||
Chain: []validation.Constraint{{Target: "volumeResourceDescription.VolumeResourceProperties.Provider", Name: validation.Null, Rule: true, Chain: nil},
|
||||
{Target: "volumeResourceDescription.VolumeResourceProperties.AzureFileParameters", Name: validation.Null, Rule: false,
|
||||
Chain: []validation.Constraint{{Target: "volumeResourceDescription.VolumeResourceProperties.AzureFileParameters.AccountName", Name: validation.Null, Rule: true, Chain: nil},
|
||||
{Target: "volumeResourceDescription.VolumeResourceProperties.AzureFileParameters.ShareName", Name: validation.Null, Rule: true, Chain: nil},
|
||||
}},
|
||||
}}}}}); err != nil {
|
||||
return result, validation.NewError("servicefabricmesh.VolumeClient", "Create", err.Error())
|
||||
}
|
||||
|
||||
req, err := client.CreatePreparer(ctx, resourceGroupName, volumeName, volumeResourceDescription)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicefabricmesh.VolumeClient", "Create", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.CreateSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "servicefabricmesh.VolumeClient", "Create", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.CreateResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicefabricmesh.VolumeClient", "Create", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// CreatePreparer prepares the Create request.
|
||||
func (client VolumeClient) CreatePreparer(ctx context.Context, resourceGroupName string, volumeName string, volumeResourceDescription VolumeResourceDescription) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
"volumeName": volumeName,
|
||||
}
|
||||
|
||||
const APIVersion = "2018-07-01-preview"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsContentType("application/json; charset=utf-8"),
|
||||
autorest.AsPut(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh/volumes/{volumeName}", pathParameters),
|
||||
autorest.WithJSON(volumeResourceDescription),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||
}
|
||||
|
||||
// CreateSender sends the Create request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client VolumeClient) CreateSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req,
|
||||
azure.DoRetryWithRegistration(client.Client))
|
||||
}
|
||||
|
||||
// CreateResponder handles the response to the Create request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client VolumeClient) CreateResponder(resp *http.Response) (result VolumeResourceDescription, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// Delete deletes the volume identified by the name.
|
||||
// Parameters:
|
||||
// resourceGroupName - azure resource group name
|
||||
// volumeName - the identity of the volume.
|
||||
func (client VolumeClient) Delete(ctx context.Context, resourceGroupName string, volumeName string) (result autorest.Response, err error) {
|
||||
req, err := client.DeletePreparer(ctx, resourceGroupName, volumeName)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicefabricmesh.VolumeClient", "Delete", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.DeleteSender(req)
|
||||
if err != nil {
|
||||
result.Response = resp
|
||||
err = autorest.NewErrorWithError(err, "servicefabricmesh.VolumeClient", "Delete", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.DeleteResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicefabricmesh.VolumeClient", "Delete", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// DeletePreparer prepares the Delete request.
|
||||
func (client VolumeClient) DeletePreparer(ctx context.Context, resourceGroupName string, volumeName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
"volumeName": volumeName,
|
||||
}
|
||||
|
||||
const APIVersion = "2018-07-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.ServiceFabricMesh/volumes/{volumeName}", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||
}
|
||||
|
||||
// DeleteSender sends the Delete request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client VolumeClient) DeleteSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req,
|
||||
azure.DoRetryWithRegistration(client.Client))
|
||||
}
|
||||
|
||||
// DeleteResponder handles the response to the Delete request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client VolumeClient) 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 the information about the volume resource with a given name. This information includes the volume
|
||||
// description and other runtime information.
|
||||
// Parameters:
|
||||
// resourceGroupName - azure resource group name
|
||||
// volumeName - the identity of the volume.
|
||||
func (client VolumeClient) Get(ctx context.Context, resourceGroupName string, volumeName string) (result VolumeResourceDescription, err error) {
|
||||
req, err := client.GetPreparer(ctx, resourceGroupName, volumeName)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicefabricmesh.VolumeClient", "Get", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.GetSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "servicefabricmesh.VolumeClient", "Get", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.GetResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicefabricmesh.VolumeClient", "Get", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// GetPreparer prepares the Get request.
|
||||
func (client VolumeClient) GetPreparer(ctx context.Context, resourceGroupName string, volumeName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
"volumeName": volumeName,
|
||||
}
|
||||
|
||||
const APIVersion = "2018-07-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.ServiceFabricMesh/volumes/{volumeName}", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||
}
|
||||
|
||||
// GetSender sends the Get request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client VolumeClient) GetSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req,
|
||||
azure.DoRetryWithRegistration(client.Client))
|
||||
}
|
||||
|
||||
// GetResponder handles the response to the Get request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client VolumeClient) GetResponder(resp *http.Response) (result VolumeResourceDescription, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// ListByResourceGroup gets the information about all volume resources in a given resource group. The information
|
||||
// includes the volume description and other runtime information.
|
||||
// Parameters:
|
||||
// resourceGroupName - azure resource group name
|
||||
func (client VolumeClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result VolumeResourceDescriptionListPage, err error) {
|
||||
result.fn = client.listByResourceGroupNextResults
|
||||
req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicefabricmesh.VolumeClient", "ListByResourceGroup", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListByResourceGroupSender(req)
|
||||
if err != nil {
|
||||
result.vrdl.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "servicefabricmesh.VolumeClient", "ListByResourceGroup", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result.vrdl, err = client.ListByResourceGroupResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicefabricmesh.VolumeClient", "ListByResourceGroup", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListByResourceGroupPreparer prepares the ListByResourceGroup request.
|
||||
func (client VolumeClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
const APIVersion = "2018-07-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.ServiceFabricMesh/volumes", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||
}
|
||||
|
||||
// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client VolumeClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req,
|
||||
azure.DoRetryWithRegistration(client.Client))
|
||||
}
|
||||
|
||||
// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client VolumeClient) ListByResourceGroupResponder(resp *http.Response) (result VolumeResourceDescriptionList, 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 VolumeClient) listByResourceGroupNextResults(lastResults VolumeResourceDescriptionList) (result VolumeResourceDescriptionList, err error) {
|
||||
req, err := lastResults.volumeResourceDescriptionListPreparer()
|
||||
if err != nil {
|
||||
return result, autorest.NewErrorWithError(err, "servicefabricmesh.VolumeClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request")
|
||||
}
|
||||
if req == nil {
|
||||
return
|
||||
}
|
||||
resp, err := client.ListByResourceGroupSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return result, autorest.NewErrorWithError(err, "servicefabricmesh.VolumeClient", "listByResourceGroupNextResults", resp, "Failure sending next results request")
|
||||
}
|
||||
result, err = client.ListByResourceGroupResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicefabricmesh.VolumeClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required.
|
||||
func (client VolumeClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result VolumeResourceDescriptionListIterator, err error) {
|
||||
result.page, err = client.ListByResourceGroup(ctx, resourceGroupName)
|
||||
return
|
||||
}
|
||||
|
||||
// ListBySubscription gets the information about all volume resources in a given subscription. The information includes
|
||||
// the volume description and other runtime information.
|
||||
func (client VolumeClient) ListBySubscription(ctx context.Context) (result VolumeResourceDescriptionListPage, err error) {
|
||||
result.fn = client.listBySubscriptionNextResults
|
||||
req, err := client.ListBySubscriptionPreparer(ctx)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicefabricmesh.VolumeClient", "ListBySubscription", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListBySubscriptionSender(req)
|
||||
if err != nil {
|
||||
result.vrdl.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "servicefabricmesh.VolumeClient", "ListBySubscription", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result.vrdl, err = client.ListBySubscriptionResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicefabricmesh.VolumeClient", "ListBySubscription", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListBySubscriptionPreparer prepares the ListBySubscription request.
|
||||
func (client VolumeClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
const APIVersion = "2018-07-01-preview"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabricMesh/volumes", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||
}
|
||||
|
||||
// ListBySubscriptionSender sends the ListBySubscription request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client VolumeClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req,
|
||||
azure.DoRetryWithRegistration(client.Client))
|
||||
}
|
||||
|
||||
// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client VolumeClient) ListBySubscriptionResponder(resp *http.Response) (result VolumeResourceDescriptionList, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// listBySubscriptionNextResults retrieves the next set of results, if any.
|
||||
func (client VolumeClient) listBySubscriptionNextResults(lastResults VolumeResourceDescriptionList) (result VolumeResourceDescriptionList, err error) {
|
||||
req, err := lastResults.volumeResourceDescriptionListPreparer()
|
||||
if err != nil {
|
||||
return result, autorest.NewErrorWithError(err, "servicefabricmesh.VolumeClient", "listBySubscriptionNextResults", nil, "Failure preparing next results request")
|
||||
}
|
||||
if req == nil {
|
||||
return
|
||||
}
|
||||
resp, err := client.ListBySubscriptionSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return result, autorest.NewErrorWithError(err, "servicefabricmesh.VolumeClient", "listBySubscriptionNextResults", resp, "Failure sending next results request")
|
||||
}
|
||||
result, err = client.ListBySubscriptionResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicefabricmesh.VolumeClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required.
|
||||
func (client VolumeClient) ListBySubscriptionComplete(ctx context.Context) (result VolumeResourceDescriptionListIterator, err error) {
|
||||
result.page, err = client.ListBySubscription(ctx)
|
||||
return
|
||||
}
|
||||
2
vendor/github.com/Azure/azure-sdk-for-go/version/version.go
generated
vendored
2
vendor/github.com/Azure/azure-sdk-for-go/version/version.go
generated
vendored
@@ -18,4 +18,4 @@ package version
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
// Number contains the semantic version of this SDK.
|
||||
const Number = "v15.1.1"
|
||||
const Number = "v19.1.0"
|
||||
|
||||
8
vendor/github.com/Azure/go-autorest/autorest/adal/config.go
generated
vendored
8
vendor/github.com/Azure/go-autorest/autorest/adal/config.go
generated
vendored
@@ -26,10 +26,10 @@ const (
|
||||
// OAuthConfig represents the endpoints needed
|
||||
// in OAuth operations
|
||||
type OAuthConfig struct {
|
||||
AuthorityEndpoint url.URL
|
||||
AuthorizeEndpoint url.URL
|
||||
TokenEndpoint url.URL
|
||||
DeviceCodeEndpoint url.URL
|
||||
AuthorityEndpoint url.URL `json:"authorityEndpoint"`
|
||||
AuthorizeEndpoint url.URL `json:"authorizeEndpoint"`
|
||||
TokenEndpoint url.URL `json:"tokenEndpoint"`
|
||||
DeviceCodeEndpoint url.URL `json:"deviceCodeEndpoint"`
|
||||
}
|
||||
|
||||
// IsZero returns true if the OAuthConfig object is zero-initialized.
|
||||
|
||||
417
vendor/github.com/Azure/go-autorest/autorest/adal/token.go
generated
vendored
417
vendor/github.com/Azure/go-autorest/autorest/adal/token.go
generated
vendored
@@ -22,8 +22,10 @@ import (
|
||||
"crypto/x509"
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"math"
|
||||
"net"
|
||||
"net/http"
|
||||
"net/url"
|
||||
@@ -33,6 +35,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/Azure/go-autorest/autorest/date"
|
||||
"github.com/Azure/go-autorest/version"
|
||||
"github.com/dgrijalva/jwt-go"
|
||||
)
|
||||
|
||||
@@ -59,6 +62,9 @@ const (
|
||||
|
||||
// msiEndpoint is the well known endpoint for getting MSI authentications tokens
|
||||
msiEndpoint = "http://169.254.169.254/metadata/identity/oauth2/token"
|
||||
|
||||
// the default number of attempts to refresh an MSI authentication token
|
||||
defaultMaxMSIRefreshAttempts = 5
|
||||
)
|
||||
|
||||
// OAuthTokenProvider is an interface which should be implemented by an access token retriever
|
||||
@@ -136,6 +142,12 @@ func (t *Token) OAuthToken() string {
|
||||
return t.AccessToken
|
||||
}
|
||||
|
||||
// ServicePrincipalSecret is an interface that allows various secret mechanism to fill the form
|
||||
// that is submitted when acquiring an oAuth token.
|
||||
type ServicePrincipalSecret interface {
|
||||
SetAuthenticationValues(spt *ServicePrincipalToken, values *url.Values) error
|
||||
}
|
||||
|
||||
// ServicePrincipalNoSecret represents a secret type that contains no secret
|
||||
// meaning it is not valid for fetching a fresh token. This is used by Manual
|
||||
type ServicePrincipalNoSecret struct {
|
||||
@@ -147,15 +159,19 @@ func (noSecret *ServicePrincipalNoSecret) SetAuthenticationValues(spt *ServicePr
|
||||
return fmt.Errorf("Manually created ServicePrincipalToken does not contain secret material to retrieve a new access token")
|
||||
}
|
||||
|
||||
// ServicePrincipalSecret is an interface that allows various secret mechanism to fill the form
|
||||
// that is submitted when acquiring an oAuth token.
|
||||
type ServicePrincipalSecret interface {
|
||||
SetAuthenticationValues(spt *ServicePrincipalToken, values *url.Values) error
|
||||
// MarshalJSON implements the json.Marshaler interface.
|
||||
func (noSecret ServicePrincipalNoSecret) MarshalJSON() ([]byte, error) {
|
||||
type tokenType struct {
|
||||
Type string `json:"type"`
|
||||
}
|
||||
return json.Marshal(tokenType{
|
||||
Type: "ServicePrincipalNoSecret",
|
||||
})
|
||||
}
|
||||
|
||||
// ServicePrincipalTokenSecret implements ServicePrincipalSecret for client_secret type authorization.
|
||||
type ServicePrincipalTokenSecret struct {
|
||||
ClientSecret string
|
||||
ClientSecret string `json:"value"`
|
||||
}
|
||||
|
||||
// SetAuthenticationValues is a method of the interface ServicePrincipalSecret.
|
||||
@@ -165,49 +181,24 @@ func (tokenSecret *ServicePrincipalTokenSecret) SetAuthenticationValues(spt *Ser
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalJSON implements the json.Marshaler interface.
|
||||
func (tokenSecret ServicePrincipalTokenSecret) MarshalJSON() ([]byte, error) {
|
||||
type tokenType struct {
|
||||
Type string `json:"type"`
|
||||
Value string `json:"value"`
|
||||
}
|
||||
return json.Marshal(tokenType{
|
||||
Type: "ServicePrincipalTokenSecret",
|
||||
Value: tokenSecret.ClientSecret,
|
||||
})
|
||||
}
|
||||
|
||||
// ServicePrincipalCertificateSecret implements ServicePrincipalSecret for generic RSA cert auth with signed JWTs.
|
||||
type ServicePrincipalCertificateSecret struct {
|
||||
Certificate *x509.Certificate
|
||||
PrivateKey *rsa.PrivateKey
|
||||
}
|
||||
|
||||
// ServicePrincipalMSISecret implements ServicePrincipalSecret for machines running the MSI Extension.
|
||||
type ServicePrincipalMSISecret struct {
|
||||
}
|
||||
|
||||
// ServicePrincipalUsernamePasswordSecret implements ServicePrincipalSecret for username and password auth.
|
||||
type ServicePrincipalUsernamePasswordSecret struct {
|
||||
Username string
|
||||
Password string
|
||||
}
|
||||
|
||||
// ServicePrincipalAuthorizationCodeSecret implements ServicePrincipalSecret for authorization code auth.
|
||||
type ServicePrincipalAuthorizationCodeSecret struct {
|
||||
ClientSecret string
|
||||
AuthorizationCode string
|
||||
RedirectURI string
|
||||
}
|
||||
|
||||
// SetAuthenticationValues is a method of the interface ServicePrincipalSecret.
|
||||
func (secret *ServicePrincipalAuthorizationCodeSecret) SetAuthenticationValues(spt *ServicePrincipalToken, v *url.Values) error {
|
||||
v.Set("code", secret.AuthorizationCode)
|
||||
v.Set("client_secret", secret.ClientSecret)
|
||||
v.Set("redirect_uri", secret.RedirectURI)
|
||||
return nil
|
||||
}
|
||||
|
||||
// SetAuthenticationValues is a method of the interface ServicePrincipalSecret.
|
||||
func (secret *ServicePrincipalUsernamePasswordSecret) SetAuthenticationValues(spt *ServicePrincipalToken, v *url.Values) error {
|
||||
v.Set("username", secret.Username)
|
||||
v.Set("password", secret.Password)
|
||||
return nil
|
||||
}
|
||||
|
||||
// SetAuthenticationValues is a method of the interface ServicePrincipalSecret.
|
||||
func (msiSecret *ServicePrincipalMSISecret) SetAuthenticationValues(spt *ServicePrincipalToken, v *url.Values) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// SignJwt returns the JWT signed with the certificate's private key.
|
||||
func (secret *ServicePrincipalCertificateSecret) SignJwt(spt *ServicePrincipalToken) (string, error) {
|
||||
hasher := sha1.New()
|
||||
@@ -228,9 +219,9 @@ func (secret *ServicePrincipalCertificateSecret) SignJwt(spt *ServicePrincipalTo
|
||||
token := jwt.New(jwt.SigningMethodRS256)
|
||||
token.Header["x5t"] = thumbprint
|
||||
token.Claims = jwt.MapClaims{
|
||||
"aud": spt.oauthConfig.TokenEndpoint.String(),
|
||||
"iss": spt.clientID,
|
||||
"sub": spt.clientID,
|
||||
"aud": spt.inner.OauthConfig.TokenEndpoint.String(),
|
||||
"iss": spt.inner.ClientID,
|
||||
"sub": spt.inner.ClientID,
|
||||
"jti": base64.URLEncoding.EncodeToString(jti),
|
||||
"nbf": time.Now().Unix(),
|
||||
"exp": time.Now().Add(time.Hour * 24).Unix(),
|
||||
@@ -253,19 +244,151 @@ func (secret *ServicePrincipalCertificateSecret) SetAuthenticationValues(spt *Se
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalJSON implements the json.Marshaler interface.
|
||||
func (secret ServicePrincipalCertificateSecret) MarshalJSON() ([]byte, error) {
|
||||
return nil, errors.New("marshalling ServicePrincipalCertificateSecret is not supported")
|
||||
}
|
||||
|
||||
// ServicePrincipalMSISecret implements ServicePrincipalSecret for machines running the MSI Extension.
|
||||
type ServicePrincipalMSISecret struct {
|
||||
}
|
||||
|
||||
// SetAuthenticationValues is a method of the interface ServicePrincipalSecret.
|
||||
func (msiSecret *ServicePrincipalMSISecret) SetAuthenticationValues(spt *ServicePrincipalToken, v *url.Values) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalJSON implements the json.Marshaler interface.
|
||||
func (msiSecret ServicePrincipalMSISecret) MarshalJSON() ([]byte, error) {
|
||||
return nil, errors.New("marshalling ServicePrincipalMSISecret is not supported")
|
||||
}
|
||||
|
||||
// ServicePrincipalUsernamePasswordSecret implements ServicePrincipalSecret for username and password auth.
|
||||
type ServicePrincipalUsernamePasswordSecret struct {
|
||||
Username string `json:"username"`
|
||||
Password string `json:"password"`
|
||||
}
|
||||
|
||||
// SetAuthenticationValues is a method of the interface ServicePrincipalSecret.
|
||||
func (secret *ServicePrincipalUsernamePasswordSecret) SetAuthenticationValues(spt *ServicePrincipalToken, v *url.Values) error {
|
||||
v.Set("username", secret.Username)
|
||||
v.Set("password", secret.Password)
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalJSON implements the json.Marshaler interface.
|
||||
func (secret ServicePrincipalUsernamePasswordSecret) MarshalJSON() ([]byte, error) {
|
||||
type tokenType struct {
|
||||
Type string `json:"type"`
|
||||
Username string `json:"username"`
|
||||
Password string `json:"password"`
|
||||
}
|
||||
return json.Marshal(tokenType{
|
||||
Type: "ServicePrincipalUsernamePasswordSecret",
|
||||
Username: secret.Username,
|
||||
Password: secret.Password,
|
||||
})
|
||||
}
|
||||
|
||||
// ServicePrincipalAuthorizationCodeSecret implements ServicePrincipalSecret for authorization code auth.
|
||||
type ServicePrincipalAuthorizationCodeSecret struct {
|
||||
ClientSecret string `json:"value"`
|
||||
AuthorizationCode string `json:"authCode"`
|
||||
RedirectURI string `json:"redirect"`
|
||||
}
|
||||
|
||||
// SetAuthenticationValues is a method of the interface ServicePrincipalSecret.
|
||||
func (secret *ServicePrincipalAuthorizationCodeSecret) SetAuthenticationValues(spt *ServicePrincipalToken, v *url.Values) error {
|
||||
v.Set("code", secret.AuthorizationCode)
|
||||
v.Set("client_secret", secret.ClientSecret)
|
||||
v.Set("redirect_uri", secret.RedirectURI)
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalJSON implements the json.Marshaler interface.
|
||||
func (secret ServicePrincipalAuthorizationCodeSecret) MarshalJSON() ([]byte, error) {
|
||||
type tokenType struct {
|
||||
Type string `json:"type"`
|
||||
Value string `json:"value"`
|
||||
AuthCode string `json:"authCode"`
|
||||
Redirect string `json:"redirect"`
|
||||
}
|
||||
return json.Marshal(tokenType{
|
||||
Type: "ServicePrincipalAuthorizationCodeSecret",
|
||||
Value: secret.ClientSecret,
|
||||
AuthCode: secret.AuthorizationCode,
|
||||
Redirect: secret.RedirectURI,
|
||||
})
|
||||
}
|
||||
|
||||
// ServicePrincipalToken encapsulates a Token created for a Service Principal.
|
||||
type ServicePrincipalToken struct {
|
||||
token Token
|
||||
secret ServicePrincipalSecret
|
||||
oauthConfig OAuthConfig
|
||||
clientID string
|
||||
resource string
|
||||
autoRefresh bool
|
||||
refreshLock *sync.RWMutex
|
||||
refreshWithin time.Duration
|
||||
sender Sender
|
||||
|
||||
inner servicePrincipalToken
|
||||
refreshLock *sync.RWMutex
|
||||
sender Sender
|
||||
refreshCallbacks []TokenRefreshCallback
|
||||
// MaxMSIRefreshAttempts is the maximum number of attempts to refresh an MSI token.
|
||||
MaxMSIRefreshAttempts int
|
||||
}
|
||||
|
||||
// MarshalTokenJSON returns the marshalled inner token.
|
||||
func (spt ServicePrincipalToken) MarshalTokenJSON() ([]byte, error) {
|
||||
return json.Marshal(spt.inner.Token)
|
||||
}
|
||||
|
||||
// SetRefreshCallbacks replaces any existing refresh callbacks with the specified callbacks.
|
||||
func (spt *ServicePrincipalToken) SetRefreshCallbacks(callbacks []TokenRefreshCallback) {
|
||||
spt.refreshCallbacks = callbacks
|
||||
}
|
||||
|
||||
// MarshalJSON implements the json.Marshaler interface.
|
||||
func (spt ServicePrincipalToken) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(spt.inner)
|
||||
}
|
||||
|
||||
// UnmarshalJSON implements the json.Unmarshaler interface.
|
||||
func (spt *ServicePrincipalToken) UnmarshalJSON(data []byte) error {
|
||||
// need to determine the token type
|
||||
raw := map[string]interface{}{}
|
||||
err := json.Unmarshal(data, &raw)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
secret := raw["secret"].(map[string]interface{})
|
||||
switch secret["type"] {
|
||||
case "ServicePrincipalNoSecret":
|
||||
spt.inner.Secret = &ServicePrincipalNoSecret{}
|
||||
case "ServicePrincipalTokenSecret":
|
||||
spt.inner.Secret = &ServicePrincipalTokenSecret{}
|
||||
case "ServicePrincipalCertificateSecret":
|
||||
return errors.New("unmarshalling ServicePrincipalCertificateSecret is not supported")
|
||||
case "ServicePrincipalMSISecret":
|
||||
return errors.New("unmarshalling ServicePrincipalMSISecret is not supported")
|
||||
case "ServicePrincipalUsernamePasswordSecret":
|
||||
spt.inner.Secret = &ServicePrincipalUsernamePasswordSecret{}
|
||||
case "ServicePrincipalAuthorizationCodeSecret":
|
||||
spt.inner.Secret = &ServicePrincipalAuthorizationCodeSecret{}
|
||||
default:
|
||||
return fmt.Errorf("unrecognized token type '%s'", secret["type"])
|
||||
}
|
||||
err = json.Unmarshal(data, &spt.inner)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
spt.refreshLock = &sync.RWMutex{}
|
||||
spt.sender = &http.Client{}
|
||||
return nil
|
||||
}
|
||||
|
||||
// internal type used for marshalling/unmarshalling
|
||||
type servicePrincipalToken struct {
|
||||
Token Token `json:"token"`
|
||||
Secret ServicePrincipalSecret `json:"secret"`
|
||||
OauthConfig OAuthConfig `json:"oauth"`
|
||||
ClientID string `json:"clientID"`
|
||||
Resource string `json:"resource"`
|
||||
AutoRefresh bool `json:"autoRefresh"`
|
||||
RefreshWithin time.Duration `json:"refreshWithin"`
|
||||
}
|
||||
|
||||
func validateOAuthConfig(oac OAuthConfig) error {
|
||||
@@ -290,13 +413,15 @@ func NewServicePrincipalTokenWithSecret(oauthConfig OAuthConfig, id string, reso
|
||||
return nil, fmt.Errorf("parameter 'secret' cannot be nil")
|
||||
}
|
||||
spt := &ServicePrincipalToken{
|
||||
oauthConfig: oauthConfig,
|
||||
secret: secret,
|
||||
clientID: id,
|
||||
resource: resource,
|
||||
autoRefresh: true,
|
||||
inner: servicePrincipalToken{
|
||||
OauthConfig: oauthConfig,
|
||||
Secret: secret,
|
||||
ClientID: id,
|
||||
Resource: resource,
|
||||
AutoRefresh: true,
|
||||
RefreshWithin: defaultRefresh,
|
||||
},
|
||||
refreshLock: &sync.RWMutex{},
|
||||
refreshWithin: defaultRefresh,
|
||||
sender: &http.Client{},
|
||||
refreshCallbacks: callbacks,
|
||||
}
|
||||
@@ -327,7 +452,39 @@ func NewServicePrincipalTokenFromManualToken(oauthConfig OAuthConfig, clientID s
|
||||
return nil, err
|
||||
}
|
||||
|
||||
spt.token = token
|
||||
spt.inner.Token = token
|
||||
|
||||
return spt, nil
|
||||
}
|
||||
|
||||
// NewServicePrincipalTokenFromManualTokenSecret creates a ServicePrincipalToken using the supplied token and secret
|
||||
func NewServicePrincipalTokenFromManualTokenSecret(oauthConfig OAuthConfig, clientID string, resource string, token Token, secret ServicePrincipalSecret, callbacks ...TokenRefreshCallback) (*ServicePrincipalToken, error) {
|
||||
if err := validateOAuthConfig(oauthConfig); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := validateStringParam(clientID, "clientID"); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := validateStringParam(resource, "resource"); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if secret == nil {
|
||||
return nil, fmt.Errorf("parameter 'secret' cannot be nil")
|
||||
}
|
||||
if token.IsZero() {
|
||||
return nil, fmt.Errorf("parameter 'token' cannot be zero-initialized")
|
||||
}
|
||||
spt, err := NewServicePrincipalTokenWithSecret(
|
||||
oauthConfig,
|
||||
clientID,
|
||||
resource,
|
||||
secret,
|
||||
callbacks...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
spt.inner.Token = token
|
||||
|
||||
return spt, nil
|
||||
}
|
||||
@@ -495,20 +652,23 @@ func newServicePrincipalTokenFromMSI(msiEndpoint, resource string, userAssignedI
|
||||
msiEndpointURL.RawQuery = v.Encode()
|
||||
|
||||
spt := &ServicePrincipalToken{
|
||||
oauthConfig: OAuthConfig{
|
||||
TokenEndpoint: *msiEndpointURL,
|
||||
inner: servicePrincipalToken{
|
||||
OauthConfig: OAuthConfig{
|
||||
TokenEndpoint: *msiEndpointURL,
|
||||
},
|
||||
Secret: &ServicePrincipalMSISecret{},
|
||||
Resource: resource,
|
||||
AutoRefresh: true,
|
||||
RefreshWithin: defaultRefresh,
|
||||
},
|
||||
secret: &ServicePrincipalMSISecret{},
|
||||
resource: resource,
|
||||
autoRefresh: true,
|
||||
refreshLock: &sync.RWMutex{},
|
||||
refreshWithin: defaultRefresh,
|
||||
sender: &http.Client{},
|
||||
refreshCallbacks: callbacks,
|
||||
refreshLock: &sync.RWMutex{},
|
||||
sender: &http.Client{},
|
||||
refreshCallbacks: callbacks,
|
||||
MaxMSIRefreshAttempts: defaultMaxMSIRefreshAttempts,
|
||||
}
|
||||
|
||||
if userAssignedID != nil {
|
||||
spt.clientID = *userAssignedID
|
||||
spt.inner.ClientID = *userAssignedID
|
||||
}
|
||||
|
||||
return spt, nil
|
||||
@@ -543,12 +703,12 @@ func (spt *ServicePrincipalToken) EnsureFresh() error {
|
||||
// EnsureFreshWithContext will refresh the token if it will expire within the refresh window (as set by
|
||||
// RefreshWithin) and autoRefresh flag is on. This method is safe for concurrent use.
|
||||
func (spt *ServicePrincipalToken) EnsureFreshWithContext(ctx context.Context) error {
|
||||
if spt.autoRefresh && spt.token.WillExpireIn(spt.refreshWithin) {
|
||||
if spt.inner.AutoRefresh && spt.inner.Token.WillExpireIn(spt.inner.RefreshWithin) {
|
||||
// take the write lock then check to see if the token was already refreshed
|
||||
spt.refreshLock.Lock()
|
||||
defer spt.refreshLock.Unlock()
|
||||
if spt.token.WillExpireIn(spt.refreshWithin) {
|
||||
return spt.refreshInternal(ctx, spt.resource)
|
||||
if spt.inner.Token.WillExpireIn(spt.inner.RefreshWithin) {
|
||||
return spt.refreshInternal(ctx, spt.inner.Resource)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
@@ -558,7 +718,7 @@ func (spt *ServicePrincipalToken) EnsureFreshWithContext(ctx context.Context) er
|
||||
func (spt *ServicePrincipalToken) InvokeRefreshCallbacks(token Token) error {
|
||||
if spt.refreshCallbacks != nil {
|
||||
for _, callback := range spt.refreshCallbacks {
|
||||
err := callback(spt.token)
|
||||
err := callback(spt.inner.Token)
|
||||
if err != nil {
|
||||
return fmt.Errorf("adal: TokenRefreshCallback handler failed. Error = '%v'", err)
|
||||
}
|
||||
@@ -578,7 +738,7 @@ func (spt *ServicePrincipalToken) Refresh() error {
|
||||
func (spt *ServicePrincipalToken) RefreshWithContext(ctx context.Context) error {
|
||||
spt.refreshLock.Lock()
|
||||
defer spt.refreshLock.Unlock()
|
||||
return spt.refreshInternal(ctx, spt.resource)
|
||||
return spt.refreshInternal(ctx, spt.inner.Resource)
|
||||
}
|
||||
|
||||
// RefreshExchange refreshes the token, but for a different resource.
|
||||
@@ -596,7 +756,7 @@ func (spt *ServicePrincipalToken) RefreshExchangeWithContext(ctx context.Context
|
||||
}
|
||||
|
||||
func (spt *ServicePrincipalToken) getGrantType() string {
|
||||
switch spt.secret.(type) {
|
||||
switch spt.inner.Secret.(type) {
|
||||
case *ServicePrincipalUsernamePasswordSecret:
|
||||
return OAuthGrantTypeUserPass
|
||||
case *ServicePrincipalAuthorizationCodeSecret:
|
||||
@@ -615,22 +775,31 @@ func isIMDS(u url.URL) bool {
|
||||
}
|
||||
|
||||
func (spt *ServicePrincipalToken) refreshInternal(ctx context.Context, resource string) error {
|
||||
req, err := http.NewRequest(http.MethodPost, spt.oauthConfig.TokenEndpoint.String(), nil)
|
||||
req, err := http.NewRequest(http.MethodPost, spt.inner.OauthConfig.TokenEndpoint.String(), nil)
|
||||
if err != nil {
|
||||
return fmt.Errorf("adal: Failed to build the refresh request. Error = '%v'", err)
|
||||
}
|
||||
req.Header.Add("User-Agent", version.UserAgent())
|
||||
req = req.WithContext(ctx)
|
||||
if !isIMDS(spt.oauthConfig.TokenEndpoint) {
|
||||
if !isIMDS(spt.inner.OauthConfig.TokenEndpoint) {
|
||||
v := url.Values{}
|
||||
v.Set("client_id", spt.clientID)
|
||||
v.Set("client_id", spt.inner.ClientID)
|
||||
v.Set("resource", resource)
|
||||
|
||||
if spt.token.RefreshToken != "" {
|
||||
if spt.inner.Token.RefreshToken != "" {
|
||||
v.Set("grant_type", OAuthGrantTypeRefreshToken)
|
||||
v.Set("refresh_token", spt.token.RefreshToken)
|
||||
v.Set("refresh_token", spt.inner.Token.RefreshToken)
|
||||
// web apps must specify client_secret when refreshing tokens
|
||||
// see https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-protocols-oauth-code#refreshing-the-access-tokens
|
||||
if spt.getGrantType() == OAuthGrantTypeAuthorizationCode {
|
||||
err := spt.inner.Secret.SetAuthenticationValues(spt, &v)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
} else {
|
||||
v.Set("grant_type", spt.getGrantType())
|
||||
err := spt.secret.SetAuthenticationValues(spt, &v)
|
||||
err := spt.inner.Secret.SetAuthenticationValues(spt, &v)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -643,14 +812,14 @@ func (spt *ServicePrincipalToken) refreshInternal(ctx context.Context, resource
|
||||
req.Body = body
|
||||
}
|
||||
|
||||
if _, ok := spt.secret.(*ServicePrincipalMSISecret); ok {
|
||||
if _, ok := spt.inner.Secret.(*ServicePrincipalMSISecret); ok {
|
||||
req.Method = http.MethodGet
|
||||
req.Header.Set(metadataHeader, "true")
|
||||
}
|
||||
|
||||
var resp *http.Response
|
||||
if isIMDS(spt.oauthConfig.TokenEndpoint) {
|
||||
resp, err = retry(spt.sender, req)
|
||||
if isIMDS(spt.inner.OauthConfig.TokenEndpoint) {
|
||||
resp, err = retryForIMDS(spt.sender, req, spt.MaxMSIRefreshAttempts)
|
||||
} else {
|
||||
resp, err = spt.sender.Do(req)
|
||||
}
|
||||
@@ -684,12 +853,14 @@ func (spt *ServicePrincipalToken) refreshInternal(ctx context.Context, resource
|
||||
return fmt.Errorf("adal: Failed to unmarshal the service principal token during refresh. Error = '%v' JSON = '%s'", err, string(rb))
|
||||
}
|
||||
|
||||
spt.token = token
|
||||
spt.inner.Token = token
|
||||
|
||||
return spt.InvokeRefreshCallbacks(token)
|
||||
}
|
||||
|
||||
func retry(sender Sender, req *http.Request) (resp *http.Response, err error) {
|
||||
// retry logic specific to retrieving a token from the IMDS endpoint
|
||||
func retryForIMDS(sender Sender, req *http.Request, maxAttempts int) (resp *http.Response, err error) {
|
||||
// copied from client.go due to circular dependency
|
||||
retries := []int{
|
||||
http.StatusRequestTimeout, // 408
|
||||
http.StatusTooManyRequests, // 429
|
||||
@@ -698,8 +869,10 @@ func retry(sender Sender, req *http.Request) (resp *http.Response, err error) {
|
||||
http.StatusServiceUnavailable, // 503
|
||||
http.StatusGatewayTimeout, // 504
|
||||
}
|
||||
// Extra retry status codes requered
|
||||
retries = append(retries, http.StatusNotFound,
|
||||
// extra retry status codes specific to IMDS
|
||||
retries = append(retries,
|
||||
http.StatusNotFound,
|
||||
http.StatusGone,
|
||||
// all remaining 5xx
|
||||
http.StatusNotImplemented,
|
||||
http.StatusHTTPVersionNotSupported,
|
||||
@@ -709,36 +882,52 @@ func retry(sender Sender, req *http.Request) (resp *http.Response, err error) {
|
||||
http.StatusNotExtended,
|
||||
http.StatusNetworkAuthenticationRequired)
|
||||
|
||||
// see https://docs.microsoft.com/en-us/azure/active-directory/managed-service-identity/how-to-use-vm-token#retry-guidance
|
||||
|
||||
const maxDelay time.Duration = 60 * time.Second
|
||||
|
||||
attempt := 0
|
||||
maxAttempts := 5
|
||||
delay := time.Duration(0)
|
||||
|
||||
for attempt < maxAttempts {
|
||||
resp, err = sender.Do(req)
|
||||
// retry on temporary network errors, e.g. transient network failures.
|
||||
if (err != nil && !isTemporaryNetworkError(err)) || resp.StatusCode == http.StatusOK || !containsInt(retries, resp.StatusCode) {
|
||||
// if we don't receive a response then assume we can't connect to the
|
||||
// endpoint so we're likely not running on an Azure VM so don't retry.
|
||||
if (err != nil && !isTemporaryNetworkError(err)) || resp == nil || resp.StatusCode == http.StatusOK || !containsInt(retries, resp.StatusCode) {
|
||||
return
|
||||
}
|
||||
|
||||
if !delay(resp, req.Context().Done()) {
|
||||
select {
|
||||
case <-time.After(time.Second):
|
||||
attempt++
|
||||
case <-req.Context().Done():
|
||||
err = req.Context().Err()
|
||||
return
|
||||
}
|
||||
// perform exponential backoff with a cap.
|
||||
// must increment attempt before calculating delay.
|
||||
attempt++
|
||||
// the base value of 2 is the "delta backoff" as specified in the guidance doc
|
||||
delay += (time.Duration(math.Pow(2, float64(attempt))) * time.Second)
|
||||
if delay > maxDelay {
|
||||
delay = maxDelay
|
||||
}
|
||||
|
||||
select {
|
||||
case <-time.After(delay):
|
||||
// intentionally left blank
|
||||
case <-req.Context().Done():
|
||||
err = req.Context().Err()
|
||||
return
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// returns true if the specified error is a temporary network error or false if it's not.
|
||||
// if the error doesn't implement the net.Error interface the return value is true.
|
||||
func isTemporaryNetworkError(err error) bool {
|
||||
if netErr, ok := err.(net.Error); ok && netErr.Temporary() {
|
||||
if netErr, ok := err.(net.Error); !ok || (ok && netErr.Temporary()) {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// returns true if slice ints contains the value n
|
||||
func containsInt(ints []int, n int) bool {
|
||||
for _, i := range ints {
|
||||
if i == n {
|
||||
@@ -748,31 +937,15 @@ func containsInt(ints []int, n int) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func delay(resp *http.Response, cancel <-chan struct{}) bool {
|
||||
if resp == nil {
|
||||
return false
|
||||
}
|
||||
retryAfter, _ := strconv.Atoi(resp.Header.Get("Retry-After"))
|
||||
if resp.StatusCode == http.StatusTooManyRequests && retryAfter > 0 {
|
||||
select {
|
||||
case <-time.After(time.Duration(retryAfter) * time.Second):
|
||||
return true
|
||||
case <-cancel:
|
||||
return false
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// SetAutoRefresh enables or disables automatic refreshing of stale tokens.
|
||||
func (spt *ServicePrincipalToken) SetAutoRefresh(autoRefresh bool) {
|
||||
spt.autoRefresh = autoRefresh
|
||||
spt.inner.AutoRefresh = autoRefresh
|
||||
}
|
||||
|
||||
// SetRefreshWithin sets the interval within which if the token will expire, EnsureFresh will
|
||||
// refresh the token.
|
||||
func (spt *ServicePrincipalToken) SetRefreshWithin(d time.Duration) {
|
||||
spt.refreshWithin = d
|
||||
spt.inner.RefreshWithin = d
|
||||
return
|
||||
}
|
||||
|
||||
@@ -784,12 +957,12 @@ func (spt *ServicePrincipalToken) SetSender(s Sender) { spt.sender = s }
|
||||
func (spt *ServicePrincipalToken) OAuthToken() string {
|
||||
spt.refreshLock.RLock()
|
||||
defer spt.refreshLock.RUnlock()
|
||||
return spt.token.OAuthToken()
|
||||
return spt.inner.Token.OAuthToken()
|
||||
}
|
||||
|
||||
// Token returns a copy of the current token.
|
||||
func (spt *ServicePrincipalToken) Token() Token {
|
||||
spt.refreshLock.RLock()
|
||||
defer spt.refreshLock.RUnlock()
|
||||
return spt.token
|
||||
return spt.inner.Token
|
||||
}
|
||||
|
||||
1039
vendor/github.com/Azure/go-autorest/autorest/azure/async.go
generated
vendored
1039
vendor/github.com/Azure/go-autorest/autorest/azure/async.go
generated
vendored
File diff suppressed because it is too large
Load Diff
444
vendor/github.com/Azure/go-autorest/autorest/azure/auth/auth.go
generated
vendored
Normal file
444
vendor/github.com/Azure/go-autorest/autorest/azure/auth/auth.go
generated
vendored
Normal file
@@ -0,0 +1,444 @@
|
||||
package auth
|
||||
|
||||
// Copyright 2017 Microsoft Corporation
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"crypto/rsa"
|
||||
"crypto/x509"
|
||||
"encoding/binary"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"strings"
|
||||
"unicode/utf16"
|
||||
|
||||
"github.com/Azure/go-autorest/autorest"
|
||||
"github.com/Azure/go-autorest/autorest/adal"
|
||||
"github.com/Azure/go-autorest/autorest/azure"
|
||||
"github.com/dimchansky/utfbom"
|
||||
"golang.org/x/crypto/pkcs12"
|
||||
)
|
||||
|
||||
// NewAuthorizerFromEnvironment creates an Authorizer configured from environment variables in the order:
|
||||
// 1. Client credentials
|
||||
// 2. Client certificate
|
||||
// 3. Username password
|
||||
// 4. MSI
|
||||
func NewAuthorizerFromEnvironment() (autorest.Authorizer, error) {
|
||||
settings, err := getAuthenticationSettings()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if settings.resource == "" {
|
||||
settings.resource = settings.environment.ResourceManagerEndpoint
|
||||
}
|
||||
|
||||
return settings.getAuthorizer()
|
||||
}
|
||||
|
||||
// NewAuthorizerFromEnvironmentWithResource creates an Authorizer configured from environment variables in the order:
|
||||
// 1. Client credentials
|
||||
// 2. Client certificate
|
||||
// 3. Username password
|
||||
// 4. MSI
|
||||
func NewAuthorizerFromEnvironmentWithResource(resource string) (autorest.Authorizer, error) {
|
||||
settings, err := getAuthenticationSettings()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
settings.resource = resource
|
||||
return settings.getAuthorizer()
|
||||
}
|
||||
|
||||
type settings struct {
|
||||
tenantID string
|
||||
clientID string
|
||||
clientSecret string
|
||||
certificatePath string
|
||||
certificatePassword string
|
||||
username string
|
||||
password string
|
||||
envName string
|
||||
resource string
|
||||
environment azure.Environment
|
||||
}
|
||||
|
||||
func getAuthenticationSettings() (s settings, err error) {
|
||||
s = settings{
|
||||
tenantID: os.Getenv("AZURE_TENANT_ID"),
|
||||
clientID: os.Getenv("AZURE_CLIENT_ID"),
|
||||
clientSecret: os.Getenv("AZURE_CLIENT_SECRET"),
|
||||
certificatePath: os.Getenv("AZURE_CERTIFICATE_PATH"),
|
||||
certificatePassword: os.Getenv("AZURE_CERTIFICATE_PASSWORD"),
|
||||
username: os.Getenv("AZURE_USERNAME"),
|
||||
password: os.Getenv("AZURE_PASSWORD"),
|
||||
envName: os.Getenv("AZURE_ENVIRONMENT"),
|
||||
resource: os.Getenv("AZURE_AD_RESOURCE"),
|
||||
}
|
||||
|
||||
if s.envName == "" {
|
||||
s.environment = azure.PublicCloud
|
||||
} else {
|
||||
s.environment, err = azure.EnvironmentFromName(s.envName)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (settings settings) getAuthorizer() (autorest.Authorizer, error) {
|
||||
//1.Client Credentials
|
||||
if settings.clientSecret != "" {
|
||||
config := NewClientCredentialsConfig(settings.clientID, settings.clientSecret, settings.tenantID)
|
||||
config.AADEndpoint = settings.environment.ActiveDirectoryEndpoint
|
||||
config.Resource = settings.resource
|
||||
return config.Authorizer()
|
||||
}
|
||||
|
||||
//2. Client Certificate
|
||||
if settings.certificatePath != "" {
|
||||
config := NewClientCertificateConfig(settings.certificatePath, settings.certificatePassword, settings.clientID, settings.tenantID)
|
||||
config.AADEndpoint = settings.environment.ActiveDirectoryEndpoint
|
||||
config.Resource = settings.resource
|
||||
return config.Authorizer()
|
||||
}
|
||||
|
||||
//3. Username Password
|
||||
if settings.username != "" && settings.password != "" {
|
||||
config := NewUsernamePasswordConfig(settings.username, settings.password, settings.clientID, settings.tenantID)
|
||||
config.AADEndpoint = settings.environment.ActiveDirectoryEndpoint
|
||||
config.Resource = settings.resource
|
||||
return config.Authorizer()
|
||||
}
|
||||
|
||||
// 4. MSI
|
||||
config := NewMSIConfig()
|
||||
config.Resource = settings.resource
|
||||
config.ClientID = settings.clientID
|
||||
return config.Authorizer()
|
||||
}
|
||||
|
||||
// NewAuthorizerFromFile creates an Authorizer configured from a configuration file.
|
||||
func NewAuthorizerFromFile(baseURI string) (autorest.Authorizer, error) {
|
||||
fileLocation := os.Getenv("AZURE_AUTH_LOCATION")
|
||||
if fileLocation == "" {
|
||||
return nil, errors.New("auth file not found. Environment variable AZURE_AUTH_LOCATION is not set")
|
||||
}
|
||||
|
||||
contents, err := ioutil.ReadFile(fileLocation)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Auth file might be encoded
|
||||
decoded, err := decode(contents)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
file := file{}
|
||||
err = json.Unmarshal(decoded, &file)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
resource, err := getResourceForToken(file, baseURI)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
config, err := adal.NewOAuthConfig(file.ActiveDirectoryEndpoint, file.TenantID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
spToken, err := adal.NewServicePrincipalToken(*config, file.ClientID, file.ClientSecret, resource)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return autorest.NewBearerAuthorizer(spToken), nil
|
||||
}
|
||||
|
||||
// File represents the authentication file
|
||||
type file struct {
|
||||
ClientID string `json:"clientId,omitempty"`
|
||||
ClientSecret string `json:"clientSecret,omitempty"`
|
||||
SubscriptionID string `json:"subscriptionId,omitempty"`
|
||||
TenantID string `json:"tenantId,omitempty"`
|
||||
ActiveDirectoryEndpoint string `json:"activeDirectoryEndpointUrl,omitempty"`
|
||||
ResourceManagerEndpoint string `json:"resourceManagerEndpointUrl,omitempty"`
|
||||
GraphResourceID string `json:"activeDirectoryGraphResourceId,omitempty"`
|
||||
SQLManagementEndpoint string `json:"sqlManagementEndpointUrl,omitempty"`
|
||||
GalleryEndpoint string `json:"galleryEndpointUrl,omitempty"`
|
||||
ManagementEndpoint string `json:"managementEndpointUrl,omitempty"`
|
||||
}
|
||||
|
||||
func decode(b []byte) ([]byte, error) {
|
||||
reader, enc := utfbom.Skip(bytes.NewReader(b))
|
||||
|
||||
switch enc {
|
||||
case utfbom.UTF16LittleEndian:
|
||||
u16 := make([]uint16, (len(b)/2)-1)
|
||||
err := binary.Read(reader, binary.LittleEndian, &u16)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return []byte(string(utf16.Decode(u16))), nil
|
||||
case utfbom.UTF16BigEndian:
|
||||
u16 := make([]uint16, (len(b)/2)-1)
|
||||
err := binary.Read(reader, binary.BigEndian, &u16)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return []byte(string(utf16.Decode(u16))), nil
|
||||
}
|
||||
return ioutil.ReadAll(reader)
|
||||
}
|
||||
|
||||
func getResourceForToken(f file, baseURI string) (string, error) {
|
||||
// Compare dafault base URI from the SDK to the endpoints from the public cloud
|
||||
// Base URI and token resource are the same string. This func finds the authentication
|
||||
// file field that matches the SDK base URI. The SDK defines the public cloud
|
||||
// endpoint as its default base URI
|
||||
if !strings.HasSuffix(baseURI, "/") {
|
||||
baseURI += "/"
|
||||
}
|
||||
switch baseURI {
|
||||
case azure.PublicCloud.ServiceManagementEndpoint:
|
||||
return f.ManagementEndpoint, nil
|
||||
case azure.PublicCloud.ResourceManagerEndpoint:
|
||||
return f.ResourceManagerEndpoint, nil
|
||||
case azure.PublicCloud.ActiveDirectoryEndpoint:
|
||||
return f.ActiveDirectoryEndpoint, nil
|
||||
case azure.PublicCloud.GalleryEndpoint:
|
||||
return f.GalleryEndpoint, nil
|
||||
case azure.PublicCloud.GraphEndpoint:
|
||||
return f.GraphResourceID, nil
|
||||
}
|
||||
return "", fmt.Errorf("auth: base URI not found in endpoints")
|
||||
}
|
||||
|
||||
// NewClientCredentialsConfig creates an AuthorizerConfig object configured to obtain an Authorizer through Client Credentials.
|
||||
// Defaults to Public Cloud and Resource Manager Endpoint.
|
||||
func NewClientCredentialsConfig(clientID string, clientSecret string, tenantID string) ClientCredentialsConfig {
|
||||
return ClientCredentialsConfig{
|
||||
ClientID: clientID,
|
||||
ClientSecret: clientSecret,
|
||||
TenantID: tenantID,
|
||||
Resource: azure.PublicCloud.ResourceManagerEndpoint,
|
||||
AADEndpoint: azure.PublicCloud.ActiveDirectoryEndpoint,
|
||||
}
|
||||
}
|
||||
|
||||
// NewClientCertificateConfig creates a ClientCertificateConfig object configured to obtain an Authorizer through client certificate.
|
||||
// Defaults to Public Cloud and Resource Manager Endpoint.
|
||||
func NewClientCertificateConfig(certificatePath string, certificatePassword string, clientID string, tenantID string) ClientCertificateConfig {
|
||||
return ClientCertificateConfig{
|
||||
CertificatePath: certificatePath,
|
||||
CertificatePassword: certificatePassword,
|
||||
ClientID: clientID,
|
||||
TenantID: tenantID,
|
||||
Resource: azure.PublicCloud.ResourceManagerEndpoint,
|
||||
AADEndpoint: azure.PublicCloud.ActiveDirectoryEndpoint,
|
||||
}
|
||||
}
|
||||
|
||||
// NewUsernamePasswordConfig creates an UsernamePasswordConfig object configured to obtain an Authorizer through username and password.
|
||||
// Defaults to Public Cloud and Resource Manager Endpoint.
|
||||
func NewUsernamePasswordConfig(username string, password string, clientID string, tenantID string) UsernamePasswordConfig {
|
||||
return UsernamePasswordConfig{
|
||||
Username: username,
|
||||
Password: password,
|
||||
ClientID: clientID,
|
||||
TenantID: tenantID,
|
||||
Resource: azure.PublicCloud.ResourceManagerEndpoint,
|
||||
AADEndpoint: azure.PublicCloud.ActiveDirectoryEndpoint,
|
||||
}
|
||||
}
|
||||
|
||||
// NewMSIConfig creates an MSIConfig object configured to obtain an Authorizer through MSI.
|
||||
func NewMSIConfig() MSIConfig {
|
||||
return MSIConfig{
|
||||
Resource: azure.PublicCloud.ResourceManagerEndpoint,
|
||||
}
|
||||
}
|
||||
|
||||
// NewDeviceFlowConfig creates a DeviceFlowConfig object configured to obtain an Authorizer through device flow.
|
||||
// Defaults to Public Cloud and Resource Manager Endpoint.
|
||||
func NewDeviceFlowConfig(clientID string, tenantID string) DeviceFlowConfig {
|
||||
return DeviceFlowConfig{
|
||||
ClientID: clientID,
|
||||
TenantID: tenantID,
|
||||
Resource: azure.PublicCloud.ResourceManagerEndpoint,
|
||||
AADEndpoint: azure.PublicCloud.ActiveDirectoryEndpoint,
|
||||
}
|
||||
}
|
||||
|
||||
//AuthorizerConfig provides an authorizer from the configuration provided.
|
||||
type AuthorizerConfig interface {
|
||||
Authorizer() (autorest.Authorizer, error)
|
||||
}
|
||||
|
||||
// ClientCredentialsConfig provides the options to get a bearer authorizer from client credentials.
|
||||
type ClientCredentialsConfig struct {
|
||||
ClientID string
|
||||
ClientSecret string
|
||||
TenantID string
|
||||
AADEndpoint string
|
||||
Resource string
|
||||
}
|
||||
|
||||
// Authorizer gets the authorizer from client credentials.
|
||||
func (ccc ClientCredentialsConfig) Authorizer() (autorest.Authorizer, error) {
|
||||
oauthConfig, err := adal.NewOAuthConfig(ccc.AADEndpoint, ccc.TenantID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
spToken, err := adal.NewServicePrincipalToken(*oauthConfig, ccc.ClientID, ccc.ClientSecret, ccc.Resource)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to get oauth token from client credentials: %v", err)
|
||||
}
|
||||
|
||||
return autorest.NewBearerAuthorizer(spToken), nil
|
||||
}
|
||||
|
||||
// ClientCertificateConfig provides the options to get a bearer authorizer from a client certificate.
|
||||
type ClientCertificateConfig struct {
|
||||
ClientID string
|
||||
CertificatePath string
|
||||
CertificatePassword string
|
||||
TenantID string
|
||||
AADEndpoint string
|
||||
Resource string
|
||||
}
|
||||
|
||||
// Authorizer gets an authorizer object from client certificate.
|
||||
func (ccc ClientCertificateConfig) Authorizer() (autorest.Authorizer, error) {
|
||||
oauthConfig, err := adal.NewOAuthConfig(ccc.AADEndpoint, ccc.TenantID)
|
||||
|
||||
certData, err := ioutil.ReadFile(ccc.CertificatePath)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to read the certificate file (%s): %v", ccc.CertificatePath, err)
|
||||
}
|
||||
|
||||
certificate, rsaPrivateKey, err := decodePkcs12(certData, ccc.CertificatePassword)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to decode pkcs12 certificate while creating spt: %v", err)
|
||||
}
|
||||
|
||||
spToken, err := adal.NewServicePrincipalTokenFromCertificate(*oauthConfig, ccc.ClientID, certificate, rsaPrivateKey, ccc.Resource)
|
||||
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to get oauth token from certificate auth: %v", err)
|
||||
}
|
||||
|
||||
return autorest.NewBearerAuthorizer(spToken), nil
|
||||
}
|
||||
|
||||
// DeviceFlowConfig provides the options to get a bearer authorizer using device flow authentication.
|
||||
type DeviceFlowConfig struct {
|
||||
ClientID string
|
||||
TenantID string
|
||||
AADEndpoint string
|
||||
Resource string
|
||||
}
|
||||
|
||||
// Authorizer gets the authorizer from device flow.
|
||||
func (dfc DeviceFlowConfig) Authorizer() (autorest.Authorizer, error) {
|
||||
oauthClient := &autorest.Client{}
|
||||
oauthConfig, err := adal.NewOAuthConfig(dfc.AADEndpoint, dfc.TenantID)
|
||||
deviceCode, err := adal.InitiateDeviceAuth(oauthClient, *oauthConfig, dfc.ClientID, dfc.Resource)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to start device auth flow: %s", err)
|
||||
}
|
||||
|
||||
log.Println(*deviceCode.Message)
|
||||
|
||||
token, err := adal.WaitForUserCompletion(oauthClient, deviceCode)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to finish device auth flow: %s", err)
|
||||
}
|
||||
|
||||
spToken, err := adal.NewServicePrincipalTokenFromManualToken(*oauthConfig, dfc.ClientID, dfc.Resource, *token)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to get oauth token from device flow: %v", err)
|
||||
}
|
||||
|
||||
return autorest.NewBearerAuthorizer(spToken), nil
|
||||
}
|
||||
|
||||
func decodePkcs12(pkcs []byte, password string) (*x509.Certificate, *rsa.PrivateKey, error) {
|
||||
privateKey, certificate, err := pkcs12.Decode(pkcs, password)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
rsaPrivateKey, isRsaKey := privateKey.(*rsa.PrivateKey)
|
||||
if !isRsaKey {
|
||||
return nil, nil, fmt.Errorf("PKCS#12 certificate must contain an RSA private key")
|
||||
}
|
||||
|
||||
return certificate, rsaPrivateKey, nil
|
||||
}
|
||||
|
||||
// UsernamePasswordConfig provides the options to get a bearer authorizer from a username and a password.
|
||||
type UsernamePasswordConfig struct {
|
||||
ClientID string
|
||||
Username string
|
||||
Password string
|
||||
TenantID string
|
||||
AADEndpoint string
|
||||
Resource string
|
||||
}
|
||||
|
||||
// Authorizer gets the authorizer from a username and a password.
|
||||
func (ups UsernamePasswordConfig) Authorizer() (autorest.Authorizer, error) {
|
||||
|
||||
oauthConfig, err := adal.NewOAuthConfig(ups.AADEndpoint, ups.TenantID)
|
||||
|
||||
spToken, err := adal.NewServicePrincipalTokenFromUsernamePassword(*oauthConfig, ups.ClientID, ups.Username, ups.Password, ups.Resource)
|
||||
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to get oauth token from username and password auth: %v", err)
|
||||
}
|
||||
|
||||
return autorest.NewBearerAuthorizer(spToken), nil
|
||||
}
|
||||
|
||||
// MSIConfig provides the options to get a bearer authorizer through MSI.
|
||||
type MSIConfig struct {
|
||||
Resource string
|
||||
ClientID string
|
||||
}
|
||||
|
||||
// Authorizer gets the authorizer from MSI.
|
||||
func (mc MSIConfig) Authorizer() (autorest.Authorizer, error) {
|
||||
msiEndpoint, err := adal.GetMSIVMEndpoint()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
spToken, err := adal.NewServicePrincipalTokenFromMSI(msiEndpoint, mc.Resource)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to get oauth token from MSI: %v", err)
|
||||
}
|
||||
|
||||
return autorest.NewBearerAuthorizer(spToken), nil
|
||||
}
|
||||
75
vendor/github.com/Azure/go-autorest/autorest/azure/azure.go
generated
vendored
75
vendor/github.com/Azure/go-autorest/autorest/azure/azure.go
generated
vendored
@@ -44,11 +44,12 @@ const (
|
||||
// ServiceError encapsulates the error response from an Azure service.
|
||||
// It adhears to the OData v4 specification for error responses.
|
||||
type ServiceError struct {
|
||||
Code string `json:"code"`
|
||||
Message string `json:"message"`
|
||||
Target *string `json:"target"`
|
||||
Details []map[string]interface{} `json:"details"`
|
||||
InnerError map[string]interface{} `json:"innererror"`
|
||||
Code string `json:"code"`
|
||||
Message string `json:"message"`
|
||||
Target *string `json:"target"`
|
||||
Details []map[string]interface{} `json:"details"`
|
||||
InnerError map[string]interface{} `json:"innererror"`
|
||||
AdditionalInfo []map[string]interface{} `json:"additionalInfo"`
|
||||
}
|
||||
|
||||
func (se ServiceError) Error() string {
|
||||
@@ -74,6 +75,14 @@ func (se ServiceError) Error() string {
|
||||
result += fmt.Sprintf(" InnerError=%v", string(d))
|
||||
}
|
||||
|
||||
if se.AdditionalInfo != nil {
|
||||
d, err := json.Marshal(se.AdditionalInfo)
|
||||
if err != nil {
|
||||
result += fmt.Sprintf(" AdditionalInfo=%v", se.AdditionalInfo)
|
||||
}
|
||||
result += fmt.Sprintf(" AdditionalInfo=%v", string(d))
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
@@ -86,44 +95,47 @@ func (se *ServiceError) UnmarshalJSON(b []byte) error {
|
||||
// http://docs.oasis-open.org/odata/odata-json-format/v4.0/os/odata-json-format-v4.0-os.html#_Toc372793091
|
||||
|
||||
type serviceError1 struct {
|
||||
Code string `json:"code"`
|
||||
Message string `json:"message"`
|
||||
Target *string `json:"target"`
|
||||
Details []map[string]interface{} `json:"details"`
|
||||
InnerError map[string]interface{} `json:"innererror"`
|
||||
Code string `json:"code"`
|
||||
Message string `json:"message"`
|
||||
Target *string `json:"target"`
|
||||
Details []map[string]interface{} `json:"details"`
|
||||
InnerError map[string]interface{} `json:"innererror"`
|
||||
AdditionalInfo []map[string]interface{} `json:"additionalInfo"`
|
||||
}
|
||||
|
||||
type serviceError2 struct {
|
||||
Code string `json:"code"`
|
||||
Message string `json:"message"`
|
||||
Target *string `json:"target"`
|
||||
Details map[string]interface{} `json:"details"`
|
||||
InnerError map[string]interface{} `json:"innererror"`
|
||||
Code string `json:"code"`
|
||||
Message string `json:"message"`
|
||||
Target *string `json:"target"`
|
||||
Details map[string]interface{} `json:"details"`
|
||||
InnerError map[string]interface{} `json:"innererror"`
|
||||
AdditionalInfo []map[string]interface{} `json:"additionalInfo"`
|
||||
}
|
||||
|
||||
se1 := serviceError1{}
|
||||
err := json.Unmarshal(b, &se1)
|
||||
if err == nil {
|
||||
se.populate(se1.Code, se1.Message, se1.Target, se1.Details, se1.InnerError)
|
||||
se.populate(se1.Code, se1.Message, se1.Target, se1.Details, se1.InnerError, se1.AdditionalInfo)
|
||||
return nil
|
||||
}
|
||||
|
||||
se2 := serviceError2{}
|
||||
err = json.Unmarshal(b, &se2)
|
||||
if err == nil {
|
||||
se.populate(se2.Code, se2.Message, se2.Target, nil, se2.InnerError)
|
||||
se.populate(se2.Code, se2.Message, se2.Target, nil, se2.InnerError, se2.AdditionalInfo)
|
||||
se.Details = append(se.Details, se2.Details)
|
||||
return nil
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func (se *ServiceError) populate(code, message string, target *string, details []map[string]interface{}, inner map[string]interface{}) {
|
||||
func (se *ServiceError) populate(code, message string, target *string, details []map[string]interface{}, inner map[string]interface{}, additional []map[string]interface{}) {
|
||||
se.Code = code
|
||||
se.Message = message
|
||||
se.Target = target
|
||||
se.Details = details
|
||||
se.InnerError = inner
|
||||
se.AdditionalInfo = additional
|
||||
}
|
||||
|
||||
// RequestError describes an error response returned by Azure service.
|
||||
@@ -279,16 +291,29 @@ func WithErrorUnlessStatusCode(codes ...int) autorest.RespondDecorator {
|
||||
resp.Body = ioutil.NopCloser(&b)
|
||||
if decodeErr != nil {
|
||||
return fmt.Errorf("autorest/azure: error response cannot be parsed: %q error: %v", b.String(), decodeErr)
|
||||
} else if e.ServiceError == nil {
|
||||
}
|
||||
if e.ServiceError == nil {
|
||||
// Check if error is unwrapped ServiceError
|
||||
if err := json.Unmarshal(b.Bytes(), &e.ServiceError); err != nil || e.ServiceError.Message == "" {
|
||||
e.ServiceError = &ServiceError{
|
||||
Code: "Unknown",
|
||||
Message: "Unknown service error",
|
||||
}
|
||||
if err := json.Unmarshal(b.Bytes(), &e.ServiceError); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if e.ServiceError.Message == "" {
|
||||
// if we're here it means the returned error wasn't OData v4 compliant.
|
||||
// try to unmarshal the body as raw JSON in hopes of getting something.
|
||||
rawBody := map[string]interface{}{}
|
||||
if err := json.Unmarshal(b.Bytes(), &rawBody); err != nil {
|
||||
return err
|
||||
}
|
||||
e.ServiceError = &ServiceError{
|
||||
Code: "Unknown",
|
||||
Message: "Unknown service error",
|
||||
}
|
||||
if len(rawBody) > 0 {
|
||||
e.ServiceError.Details = []map[string]interface{}{rawBody}
|
||||
}
|
||||
}
|
||||
e.Response = resp
|
||||
e.RequestID = ExtractRequestID(resp)
|
||||
if e.StatusCode == nil {
|
||||
e.StatusCode = resp.StatusCode
|
||||
|
||||
2
vendor/github.com/Azure/go-autorest/autorest/azure/rp.go
generated
vendored
2
vendor/github.com/Azure/go-autorest/autorest/azure/rp.go
generated
vendored
@@ -64,7 +64,7 @@ func DoRetryWithRegistration(client autorest.Client) autorest.SendDecorator {
|
||||
}
|
||||
}
|
||||
}
|
||||
return resp, fmt.Errorf("failed request: %s", err)
|
||||
return resp, err
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
27
vendor/github.com/Azure/go-autorest/autorest/client.go
generated
vendored
27
vendor/github.com/Azure/go-autorest/autorest/client.go
generated
vendored
@@ -22,8 +22,11 @@ import (
|
||||
"log"
|
||||
"net/http"
|
||||
"net/http/cookiejar"
|
||||
"runtime"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/Azure/go-autorest/logger"
|
||||
"github.com/Azure/go-autorest/version"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -41,15 +44,6 @@ const (
|
||||
)
|
||||
|
||||
var (
|
||||
// defaultUserAgent builds a string containing the Go version, system archityecture and OS,
|
||||
// and the go-autorest version.
|
||||
defaultUserAgent = fmt.Sprintf("Go/%s (%s-%s) go-autorest/%s",
|
||||
runtime.Version(),
|
||||
runtime.GOARCH,
|
||||
runtime.GOOS,
|
||||
Version(),
|
||||
)
|
||||
|
||||
// StatusCodesForRetry are a defined group of status code for which the client will retry
|
||||
StatusCodesForRetry = []int{
|
||||
http.StatusRequestTimeout, // 408
|
||||
@@ -179,7 +173,7 @@ func NewClientWithUserAgent(ua string) Client {
|
||||
PollingDuration: DefaultPollingDuration,
|
||||
RetryAttempts: DefaultRetryAttempts,
|
||||
RetryDuration: DefaultRetryDuration,
|
||||
UserAgent: defaultUserAgent,
|
||||
UserAgent: version.UserAgent(),
|
||||
}
|
||||
c.Sender = c.sender()
|
||||
c.AddToUserAgent(ua)
|
||||
@@ -216,8 +210,17 @@ func (c Client) Do(r *http.Request) (*http.Response, error) {
|
||||
}
|
||||
return resp, NewErrorWithError(err, "autorest/Client", "Do", nil, "Preparing request failed")
|
||||
}
|
||||
|
||||
logger.Instance.WriteRequest(r, logger.Filter{
|
||||
Header: func(k string, v []string) (bool, []string) {
|
||||
// remove the auth token from the log
|
||||
if strings.EqualFold(k, "Authorization") || strings.EqualFold(k, "Ocp-Apim-Subscription-Key") {
|
||||
v = []string{"**REDACTED**"}
|
||||
}
|
||||
return true, v
|
||||
},
|
||||
})
|
||||
resp, err := SendWithSender(c.sender(), r)
|
||||
logger.Instance.WriteResponse(resp, logger.Filter{})
|
||||
Respond(resp, c.ByInspecting())
|
||||
return resp, err
|
||||
}
|
||||
|
||||
5
vendor/github.com/Azure/go-autorest/autorest/utility.go
generated
vendored
5
vendor/github.com/Azure/go-autorest/autorest/utility.go
generated
vendored
@@ -218,9 +218,10 @@ func IsTokenRefreshError(err error) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsTemporaryNetworkError returns true if the specified error is a temporary network error.
|
||||
// IsTemporaryNetworkError returns true if the specified error is a temporary network error or false
|
||||
// if it's not. If the error doesn't implement the net.Error interface the return value is true.
|
||||
func IsTemporaryNetworkError(err error) bool {
|
||||
if netErr, ok := err.(net.Error); ok && netErr.Temporary() {
|
||||
if netErr, ok := err.(net.Error); !ok || (ok && netErr.Temporary()) {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
|
||||
23
vendor/github.com/Azure/go-autorest/autorest/validation/validation.go
generated
vendored
23
vendor/github.com/Azure/go-autorest/autorest/validation/validation.go
generated
vendored
@@ -136,29 +136,29 @@ func validatePtr(x reflect.Value, v Constraint) error {
|
||||
|
||||
func validateInt(x reflect.Value, v Constraint) error {
|
||||
i := x.Int()
|
||||
r, ok := v.Rule.(int)
|
||||
r, ok := toInt64(v.Rule)
|
||||
if !ok {
|
||||
return createError(x, v, fmt.Sprintf("rule must be integer value for %v constraint; got: %v", v.Name, v.Rule))
|
||||
}
|
||||
switch v.Name {
|
||||
case MultipleOf:
|
||||
if i%int64(r) != 0 {
|
||||
if i%r != 0 {
|
||||
return createError(x, v, fmt.Sprintf("value must be a multiple of %v", r))
|
||||
}
|
||||
case ExclusiveMinimum:
|
||||
if i <= int64(r) {
|
||||
if i <= r {
|
||||
return createError(x, v, fmt.Sprintf("value must be greater than %v", r))
|
||||
}
|
||||
case ExclusiveMaximum:
|
||||
if i >= int64(r) {
|
||||
if i >= r {
|
||||
return createError(x, v, fmt.Sprintf("value must be less than %v", r))
|
||||
}
|
||||
case InclusiveMinimum:
|
||||
if i < int64(r) {
|
||||
if i < r {
|
||||
return createError(x, v, fmt.Sprintf("value must be greater than or equal to %v", r))
|
||||
}
|
||||
case InclusiveMaximum:
|
||||
if i > int64(r) {
|
||||
if i > r {
|
||||
return createError(x, v, fmt.Sprintf("value must be less than or equal to %v", r))
|
||||
}
|
||||
default:
|
||||
@@ -388,6 +388,17 @@ func createError(x reflect.Value, v Constraint, err string) error {
|
||||
v.Target, v.Name, getInterfaceValue(x), err)
|
||||
}
|
||||
|
||||
func toInt64(v interface{}) (int64, bool) {
|
||||
if i64, ok := v.(int64); ok {
|
||||
return i64, true
|
||||
}
|
||||
// older generators emit max constants as int, so if int64 fails fall back to int
|
||||
if i32, ok := v.(int); ok {
|
||||
return int64(i32), true
|
||||
}
|
||||
return 0, false
|
||||
}
|
||||
|
||||
// NewErrorWithValidationError appends package type and method name in
|
||||
// validation error.
|
||||
//
|
||||
|
||||
4
vendor/github.com/Azure/go-autorest/autorest/version.go
generated
vendored
4
vendor/github.com/Azure/go-autorest/autorest/version.go
generated
vendored
@@ -1,5 +1,7 @@
|
||||
package autorest
|
||||
|
||||
import "github.com/Azure/go-autorest/version"
|
||||
|
||||
// Copyright 2017 Microsoft Corporation
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -16,5 +18,5 @@ package autorest
|
||||
|
||||
// Version returns the semantic version (see http://semver.org).
|
||||
func Version() string {
|
||||
return "v10.8.1"
|
||||
return version.Number
|
||||
}
|
||||
|
||||
328
vendor/github.com/Azure/go-autorest/logger/logger.go
generated
vendored
Normal file
328
vendor/github.com/Azure/go-autorest/logger/logger.go
generated
vendored
Normal file
@@ -0,0 +1,328 @@
|
||||
package logger
|
||||
|
||||
// Copyright 2017 Microsoft Corporation
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
)
|
||||
|
||||
// LevelType tells a logger the minimum level to log. When code reports a log entry,
|
||||
// the LogLevel indicates the level of the log entry. The logger only records entries
|
||||
// whose level is at least the level it was told to log. See the Log* constants.
|
||||
// For example, if a logger is configured with LogError, then LogError, LogPanic,
|
||||
// and LogFatal entries will be logged; lower level entries are ignored.
|
||||
type LevelType uint32
|
||||
|
||||
const (
|
||||
// LogNone tells a logger not to log any entries passed to it.
|
||||
LogNone LevelType = iota
|
||||
|
||||
// LogFatal tells a logger to log all LogFatal entries passed to it.
|
||||
LogFatal
|
||||
|
||||
// LogPanic tells a logger to log all LogPanic and LogFatal entries passed to it.
|
||||
LogPanic
|
||||
|
||||
// LogError tells a logger to log all LogError, LogPanic and LogFatal entries passed to it.
|
||||
LogError
|
||||
|
||||
// LogWarning tells a logger to log all LogWarning, LogError, LogPanic and LogFatal entries passed to it.
|
||||
LogWarning
|
||||
|
||||
// LogInfo tells a logger to log all LogInfo, LogWarning, LogError, LogPanic and LogFatal entries passed to it.
|
||||
LogInfo
|
||||
|
||||
// LogDebug tells a logger to log all LogDebug, LogInfo, LogWarning, LogError, LogPanic and LogFatal entries passed to it.
|
||||
LogDebug
|
||||
)
|
||||
|
||||
const (
|
||||
logNone = "NONE"
|
||||
logFatal = "FATAL"
|
||||
logPanic = "PANIC"
|
||||
logError = "ERROR"
|
||||
logWarning = "WARNING"
|
||||
logInfo = "INFO"
|
||||
logDebug = "DEBUG"
|
||||
logUnknown = "UNKNOWN"
|
||||
)
|
||||
|
||||
// ParseLevel converts the specified string into the corresponding LevelType.
|
||||
func ParseLevel(s string) (lt LevelType, err error) {
|
||||
switch strings.ToUpper(s) {
|
||||
case logFatal:
|
||||
lt = LogFatal
|
||||
case logPanic:
|
||||
lt = LogPanic
|
||||
case logError:
|
||||
lt = LogError
|
||||
case logWarning:
|
||||
lt = LogWarning
|
||||
case logInfo:
|
||||
lt = LogInfo
|
||||
case logDebug:
|
||||
lt = LogDebug
|
||||
default:
|
||||
err = fmt.Errorf("bad log level '%s'", s)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// String implements the stringer interface for LevelType.
|
||||
func (lt LevelType) String() string {
|
||||
switch lt {
|
||||
case LogNone:
|
||||
return logNone
|
||||
case LogFatal:
|
||||
return logFatal
|
||||
case LogPanic:
|
||||
return logPanic
|
||||
case LogError:
|
||||
return logError
|
||||
case LogWarning:
|
||||
return logWarning
|
||||
case LogInfo:
|
||||
return logInfo
|
||||
case LogDebug:
|
||||
return logDebug
|
||||
default:
|
||||
return logUnknown
|
||||
}
|
||||
}
|
||||
|
||||
// Filter defines functions for filtering HTTP request/response content.
|
||||
type Filter struct {
|
||||
// URL returns a potentially modified string representation of a request URL.
|
||||
URL func(u *url.URL) string
|
||||
|
||||
// Header returns a potentially modified set of values for the specified key.
|
||||
// To completely exclude the header key/values return false.
|
||||
Header func(key string, val []string) (bool, []string)
|
||||
|
||||
// Body returns a potentially modified request/response body.
|
||||
Body func(b []byte) []byte
|
||||
}
|
||||
|
||||
func (f Filter) processURL(u *url.URL) string {
|
||||
if f.URL == nil {
|
||||
return u.String()
|
||||
}
|
||||
return f.URL(u)
|
||||
}
|
||||
|
||||
func (f Filter) processHeader(k string, val []string) (bool, []string) {
|
||||
if f.Header == nil {
|
||||
return true, val
|
||||
}
|
||||
return f.Header(k, val)
|
||||
}
|
||||
|
||||
func (f Filter) processBody(b []byte) []byte {
|
||||
if f.Body == nil {
|
||||
return b
|
||||
}
|
||||
return f.Body(b)
|
||||
}
|
||||
|
||||
// Writer defines methods for writing to a logging facility.
|
||||
type Writer interface {
|
||||
// Writeln writes the specified message with the standard log entry header and new-line character.
|
||||
Writeln(level LevelType, message string)
|
||||
|
||||
// Writef writes the specified format specifier with the standard log entry header and no new-line character.
|
||||
Writef(level LevelType, format string, a ...interface{})
|
||||
|
||||
// WriteRequest writes the specified HTTP request to the logger if the log level is greater than
|
||||
// or equal to LogInfo. The request body, if set, is logged at level LogDebug or higher.
|
||||
// Custom filters can be specified to exclude URL, header, and/or body content from the log.
|
||||
// By default no request content is excluded.
|
||||
WriteRequest(req *http.Request, filter Filter)
|
||||
|
||||
// WriteResponse writes the specified HTTP response to the logger if the log level is greater than
|
||||
// or equal to LogInfo. The response body, if set, is logged at level LogDebug or higher.
|
||||
// Custom filters can be specified to exclude URL, header, and/or body content from the log.
|
||||
// By default no respone content is excluded.
|
||||
WriteResponse(resp *http.Response, filter Filter)
|
||||
}
|
||||
|
||||
// Instance is the default log writer initialized during package init.
|
||||
// This can be replaced with a custom implementation as required.
|
||||
var Instance Writer
|
||||
|
||||
// default log level
|
||||
var logLevel = LogNone
|
||||
|
||||
// Level returns the value specified in AZURE_GO_AUTOREST_LOG_LEVEL.
|
||||
// If no value was specified the default value is LogNone.
|
||||
// Custom loggers can call this to retrieve the configured log level.
|
||||
func Level() LevelType {
|
||||
return logLevel
|
||||
}
|
||||
|
||||
func init() {
|
||||
// separated for testing purposes
|
||||
initDefaultLogger()
|
||||
}
|
||||
|
||||
func initDefaultLogger() {
|
||||
// init with nilLogger so callers don't have to do a nil check on Default
|
||||
Instance = nilLogger{}
|
||||
llStr := strings.ToLower(os.Getenv("AZURE_GO_SDK_LOG_LEVEL"))
|
||||
if llStr == "" {
|
||||
return
|
||||
}
|
||||
var err error
|
||||
logLevel, err = ParseLevel(llStr)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "go-autorest: failed to parse log level: %s\n", err.Error())
|
||||
return
|
||||
}
|
||||
if logLevel == LogNone {
|
||||
return
|
||||
}
|
||||
// default to stderr
|
||||
dest := os.Stderr
|
||||
lfStr := os.Getenv("AZURE_GO_SDK_LOG_FILE")
|
||||
if strings.EqualFold(lfStr, "stdout") {
|
||||
dest = os.Stdout
|
||||
} else if lfStr != "" {
|
||||
lf, err := os.Create(lfStr)
|
||||
if err == nil {
|
||||
dest = lf
|
||||
} else {
|
||||
fmt.Fprintf(os.Stderr, "go-autorest: failed to create log file, using stderr: %s\n", err.Error())
|
||||
}
|
||||
}
|
||||
Instance = fileLogger{
|
||||
logLevel: logLevel,
|
||||
mu: &sync.Mutex{},
|
||||
logFile: dest,
|
||||
}
|
||||
}
|
||||
|
||||
// the nil logger does nothing
|
||||
type nilLogger struct{}
|
||||
|
||||
func (nilLogger) Writeln(LevelType, string) {}
|
||||
|
||||
func (nilLogger) Writef(LevelType, string, ...interface{}) {}
|
||||
|
||||
func (nilLogger) WriteRequest(*http.Request, Filter) {}
|
||||
|
||||
func (nilLogger) WriteResponse(*http.Response, Filter) {}
|
||||
|
||||
// A File is used instead of a Logger so the stream can be flushed after every write.
|
||||
type fileLogger struct {
|
||||
logLevel LevelType
|
||||
mu *sync.Mutex // for synchronizing writes to logFile
|
||||
logFile *os.File
|
||||
}
|
||||
|
||||
func (fl fileLogger) Writeln(level LevelType, message string) {
|
||||
fl.Writef(level, "%s\n", message)
|
||||
}
|
||||
|
||||
func (fl fileLogger) Writef(level LevelType, format string, a ...interface{}) {
|
||||
if fl.logLevel >= level {
|
||||
fl.mu.Lock()
|
||||
defer fl.mu.Unlock()
|
||||
fmt.Fprintf(fl.logFile, "%s %s", entryHeader(level), fmt.Sprintf(format, a...))
|
||||
fl.logFile.Sync()
|
||||
}
|
||||
}
|
||||
|
||||
func (fl fileLogger) WriteRequest(req *http.Request, filter Filter) {
|
||||
if req == nil || fl.logLevel < LogInfo {
|
||||
return
|
||||
}
|
||||
b := &bytes.Buffer{}
|
||||
fmt.Fprintf(b, "%s REQUEST: %s %s\n", entryHeader(LogInfo), req.Method, filter.processURL(req.URL))
|
||||
// dump headers
|
||||
for k, v := range req.Header {
|
||||
if ok, mv := filter.processHeader(k, v); ok {
|
||||
fmt.Fprintf(b, "%s: %s\n", k, strings.Join(mv, ","))
|
||||
}
|
||||
}
|
||||
if fl.shouldLogBody(req.Header, req.Body) {
|
||||
// dump body
|
||||
body, err := ioutil.ReadAll(req.Body)
|
||||
if err == nil {
|
||||
fmt.Fprintln(b, string(filter.processBody(body)))
|
||||
if nc, ok := req.Body.(io.Seeker); ok {
|
||||
// rewind to the beginning
|
||||
nc.Seek(0, io.SeekStart)
|
||||
} else {
|
||||
// recreate the body
|
||||
req.Body = ioutil.NopCloser(bytes.NewReader(body))
|
||||
}
|
||||
} else {
|
||||
fmt.Fprintf(b, "failed to read body: %v\n", err)
|
||||
}
|
||||
}
|
||||
fl.mu.Lock()
|
||||
defer fl.mu.Unlock()
|
||||
fmt.Fprintf(fl.logFile, b.String())
|
||||
fl.logFile.Sync()
|
||||
}
|
||||
|
||||
func (fl fileLogger) WriteResponse(resp *http.Response, filter Filter) {
|
||||
if resp == nil || fl.logLevel < LogInfo {
|
||||
return
|
||||
}
|
||||
b := &bytes.Buffer{}
|
||||
fmt.Fprintf(b, "%s RESPONSE: %d %s\n", entryHeader(LogInfo), resp.StatusCode, filter.processURL(resp.Request.URL))
|
||||
// dump headers
|
||||
for k, v := range resp.Header {
|
||||
if ok, mv := filter.processHeader(k, v); ok {
|
||||
fmt.Fprintf(b, "%s: %s\n", k, strings.Join(mv, ","))
|
||||
}
|
||||
}
|
||||
if fl.shouldLogBody(resp.Header, resp.Body) {
|
||||
// dump body
|
||||
defer resp.Body.Close()
|
||||
body, err := ioutil.ReadAll(resp.Body)
|
||||
if err == nil {
|
||||
fmt.Fprintln(b, string(filter.processBody(body)))
|
||||
resp.Body = ioutil.NopCloser(bytes.NewReader(body))
|
||||
} else {
|
||||
fmt.Fprintf(b, "failed to read body: %v\n", err)
|
||||
}
|
||||
}
|
||||
fl.mu.Lock()
|
||||
defer fl.mu.Unlock()
|
||||
fmt.Fprintf(fl.logFile, b.String())
|
||||
fl.logFile.Sync()
|
||||
}
|
||||
|
||||
// returns true if the provided body should be included in the log
|
||||
func (fl fileLogger) shouldLogBody(header http.Header, body io.ReadCloser) bool {
|
||||
ct := header.Get("Content-Type")
|
||||
return fl.logLevel >= LogDebug && body != nil && strings.Index(ct, "application/octet-stream") == -1
|
||||
}
|
||||
|
||||
// creates standard header for log entries, it contains a timestamp and the log level
|
||||
func entryHeader(level LevelType) string {
|
||||
// this format provides a fixed number of digits so the size of the timestamp is constant
|
||||
return fmt.Sprintf("(%s) %s:", time.Now().Format("2006-01-02T15:04:05.0000000Z07:00"), level.String())
|
||||
}
|
||||
37
vendor/github.com/Azure/go-autorest/version/version.go
generated
vendored
Normal file
37
vendor/github.com/Azure/go-autorest/version/version.go
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
package version
|
||||
|
||||
// Copyright 2017 Microsoft Corporation
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"runtime"
|
||||
)
|
||||
|
||||
// Number contains the semantic version of this SDK.
|
||||
const Number = "v10.15.0"
|
||||
|
||||
var (
|
||||
userAgent = fmt.Sprintf("Go/%s (%s-%s) go-autorest/%s",
|
||||
runtime.Version(),
|
||||
runtime.GOARCH,
|
||||
runtime.GOOS,
|
||||
Number,
|
||||
)
|
||||
)
|
||||
|
||||
// UserAgent returns a string containing the Go version, system archityecture and OS, and the go-autorest version.
|
||||
func UserAgent() string {
|
||||
return userAgent
|
||||
}
|
||||
9
vendor/github.com/pborman/uuid/.travis.yml
generated
vendored
9
vendor/github.com/pborman/uuid/.travis.yml
generated
vendored
@@ -1,9 +0,0 @@
|
||||
language: go
|
||||
|
||||
go:
|
||||
- 1.4.3
|
||||
- 1.5.3
|
||||
- tip
|
||||
|
||||
script:
|
||||
- go test -v ./...
|
||||
10
vendor/github.com/pborman/uuid/CONTRIBUTING.md
generated
vendored
10
vendor/github.com/pborman/uuid/CONTRIBUTING.md
generated
vendored
@@ -1,10 +0,0 @@
|
||||
# How to contribute
|
||||
|
||||
We definitely welcome patches and contribution to this project!
|
||||
|
||||
### Legal requirements
|
||||
|
||||
In order to protect both you and ourselves, you will need to sign the
|
||||
[Contributor License Agreement](https://cla.developers.google.com/clas).
|
||||
|
||||
You may have already signed it for other Google projects.
|
||||
13
vendor/github.com/pborman/uuid/README.md
generated
vendored
13
vendor/github.com/pborman/uuid/README.md
generated
vendored
@@ -1,13 +0,0 @@
|
||||
This project was automatically exported from code.google.com/p/go-uuid
|
||||
|
||||
# uuid 
|
||||
The uuid package generates and inspects UUIDs based on [RFC 4122](http://tools.ietf.org/html/rfc4122) and DCE 1.1: Authentication and Security Services.
|
||||
|
||||
###### Install
|
||||
`go get github.com/pborman/uuid`
|
||||
|
||||
###### Documentation
|
||||
[](http://godoc.org/github.com/pborman/uuid)
|
||||
|
||||
Full `go doc` style documentation for the package can be viewed online without installing this package by using the GoDoc site here:
|
||||
http://godoc.org/github.com/pborman/uuid
|
||||
124
vendor/github.com/pborman/uuid/marshal_test.go
generated
vendored
124
vendor/github.com/pborman/uuid/marshal_test.go
generated
vendored
@@ -1,124 +0,0 @@
|
||||
// Copyright 2014 Google Inc. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package uuid
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"reflect"
|
||||
"testing"
|
||||
)
|
||||
|
||||
var testUUID = Parse("f47ac10b-58cc-0372-8567-0e02b2c3d479")
|
||||
var testArray = testUUID.Array()
|
||||
|
||||
func TestJSON(t *testing.T) {
|
||||
type S struct {
|
||||
ID1 UUID
|
||||
ID2 UUID
|
||||
}
|
||||
s1 := S{ID1: testUUID}
|
||||
data, err := json.Marshal(&s1)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
var s2 S
|
||||
if err := json.Unmarshal(data, &s2); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !reflect.DeepEqual(&s1, &s2) {
|
||||
t.Errorf("got %#v, want %#v", s2, s1)
|
||||
}
|
||||
}
|
||||
|
||||
func TestJSONArray(t *testing.T) {
|
||||
type S struct {
|
||||
ID1 Array
|
||||
ID2 Array
|
||||
}
|
||||
s1 := S{ID1: testArray}
|
||||
data, err := json.Marshal(&s1)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
var s2 S
|
||||
if err := json.Unmarshal(data, &s2); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !reflect.DeepEqual(&s1, &s2) {
|
||||
t.Errorf("got %#v, want %#v", s2, s1)
|
||||
}
|
||||
}
|
||||
|
||||
func TestMarshal(t *testing.T) {
|
||||
data, err := testUUID.MarshalBinary()
|
||||
if err != nil {
|
||||
t.Fatalf("MarhsalBinary returned unexpected error %v", err)
|
||||
}
|
||||
if !bytes.Equal(data, testUUID) {
|
||||
t.Fatalf("MarhsalBinary returns %x, want %x", data, testUUID)
|
||||
}
|
||||
var u UUID
|
||||
u.UnmarshalBinary(data)
|
||||
if !Equal(data, u) {
|
||||
t.Fatalf("UnmarhsalBinary returns %v, want %v", u, testUUID)
|
||||
}
|
||||
}
|
||||
|
||||
func TestMarshalArray(t *testing.T) {
|
||||
data, err := testArray.MarshalBinary()
|
||||
if err != nil {
|
||||
t.Fatalf("MarhsalBinary returned unexpected error %v", err)
|
||||
}
|
||||
if !bytes.Equal(data, testUUID) {
|
||||
t.Fatalf("MarhsalBinary returns %x, want %x", data, testUUID)
|
||||
}
|
||||
var a Array
|
||||
a.UnmarshalBinary(data)
|
||||
if a != testArray {
|
||||
t.Fatalf("UnmarhsalBinary returns %v, want %v", a, testArray)
|
||||
}
|
||||
}
|
||||
|
||||
func TestMarshalTextArray(t *testing.T) {
|
||||
data, err := testArray.MarshalText()
|
||||
if err != nil {
|
||||
t.Fatalf("MarhsalText returned unexpected error %v", err)
|
||||
}
|
||||
var a Array
|
||||
a.UnmarshalText(data)
|
||||
if a != testArray {
|
||||
t.Fatalf("UnmarhsalText returns %v, want %v", a, testArray)
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkUUID_MarshalJSON(b *testing.B) {
|
||||
x := &struct {
|
||||
UUID UUID `json:"uuid"`
|
||||
}{}
|
||||
x.UUID = Parse("f47ac10b-58cc-0372-8567-0e02b2c3d479")
|
||||
if x.UUID == nil {
|
||||
b.Fatal("invalid uuid")
|
||||
}
|
||||
for i := 0; i < b.N; i++ {
|
||||
js, err := json.Marshal(x)
|
||||
if err != nil {
|
||||
b.Fatalf("marshal json: %#v (%v)", js, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkUUID_UnmarshalJSON(b *testing.B) {
|
||||
js := []byte(`{"uuid":"f47ac10b-58cc-0372-8567-0e02b2c3d479"}`)
|
||||
var x *struct {
|
||||
UUID UUID `json:"uuid"`
|
||||
}
|
||||
for i := 0; i < b.N; i++ {
|
||||
err := json.Unmarshal(js, &x)
|
||||
if err != nil {
|
||||
b.Fatalf("marshal json: %#v (%v)", js, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
29
vendor/github.com/pborman/uuid/node.go
generated
vendored
29
vendor/github.com/pborman/uuid/node.go
generated
vendored
@@ -5,13 +5,15 @@
|
||||
package uuid
|
||||
|
||||
import (
|
||||
"net"
|
||||
"sync"
|
||||
)
|
||||
|
||||
var (
|
||||
nodeMu sync.Mutex
|
||||
ifname string // name of interface being used
|
||||
nodeID []byte // hardware for version 1 UUIDs
|
||||
nodeMu sync.Mutex
|
||||
interfaces []net.Interface // cached list of interfaces
|
||||
ifname string // name of interface being used
|
||||
nodeID []byte // hardware for version 1 UUIDs
|
||||
)
|
||||
|
||||
// NodeInterface returns the name of the interface from which the NodeID was
|
||||
@@ -32,18 +34,25 @@ func NodeInterface() string {
|
||||
func SetNodeInterface(name string) bool {
|
||||
defer nodeMu.Unlock()
|
||||
nodeMu.Lock()
|
||||
if nodeID != nil {
|
||||
return true
|
||||
}
|
||||
return setNodeInterface(name)
|
||||
}
|
||||
|
||||
func setNodeInterface(name string) bool {
|
||||
if interfaces == nil {
|
||||
var err error
|
||||
interfaces, err = net.Interfaces()
|
||||
if err != nil && name != "" {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
iname, addr := getHardwareInterface(name) // null implementation for js
|
||||
if iname != "" && setNodeID(addr) {
|
||||
ifname = iname
|
||||
return true
|
||||
for _, ifs := range interfaces {
|
||||
if len(ifs.HardwareAddr) >= 6 && (name == "" || name == ifs.Name) {
|
||||
if setNodeID(ifs.HardwareAddr) {
|
||||
ifname = ifs.Name
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// We found no interfaces with a valid hardware address. If name
|
||||
|
||||
12
vendor/github.com/pborman/uuid/node_js.go
generated
vendored
12
vendor/github.com/pborman/uuid/node_js.go
generated
vendored
@@ -1,12 +0,0 @@
|
||||
// Copyright 2017 Google Inc. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build js
|
||||
|
||||
package uuid
|
||||
|
||||
// getHardwareInterface returns nil values for the JS version of the code.
|
||||
// This remvoves the "net" dependency, because it is not used in the browser.
|
||||
// Using the "net" library inflates the size of the transpiled JS code by 673k bytes.
|
||||
func getHardwareInterface(name string) (string, []byte) { return "", nil }
|
||||
36
vendor/github.com/pborman/uuid/node_net.go
generated
vendored
36
vendor/github.com/pborman/uuid/node_net.go
generated
vendored
@@ -1,36 +0,0 @@
|
||||
// Copyright 2017 Google Inc. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build !js
|
||||
|
||||
package uuid
|
||||
|
||||
import "net"
|
||||
|
||||
var interfaces []net.Interface // cached list of interfaces
|
||||
|
||||
// getHardwareInterface returns the name and hardware address of interface name.
|
||||
// If name is "" then the name and hardware address of one of the system's
|
||||
// interfaces is returned. If no interfaces are found (name does not exist or
|
||||
// there are no interfaces) then "", nil is returned.
|
||||
//
|
||||
// Only addresses of at least 6 bytes are returned.
|
||||
func getHardwareInterface(name string) (string, []byte) {
|
||||
if interfaces == nil {
|
||||
var err error
|
||||
interfaces, err = net.Interfaces()
|
||||
if err != nil {
|
||||
return "", nil
|
||||
}
|
||||
}
|
||||
for _, ifs := range interfaces {
|
||||
if len(ifs.HardwareAddr) >= 6 && (name == "" || name == ifs.Name) {
|
||||
if setNodeID(ifs.HardwareAddr) {
|
||||
ifname = ifs.Name
|
||||
return ifname, nodeID
|
||||
}
|
||||
}
|
||||
}
|
||||
return "", nil
|
||||
}
|
||||
66
vendor/github.com/pborman/uuid/seq_test.go
generated
vendored
66
vendor/github.com/pborman/uuid/seq_test.go
generated
vendored
@@ -1,66 +0,0 @@
|
||||
// Copyright 2014 Google Inc. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package uuid
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"runtime"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
// This test is only run when --regressions is passed on the go test line.
|
||||
var regressions = flag.Bool("regressions", false, "run uuid regression tests")
|
||||
|
||||
// TestClockSeqRace tests for a particular race condition of returning two
|
||||
// identical Version1 UUIDs. The duration of 1 minute was chosen as the race
|
||||
// condition, before being fixed, nearly always occured in under 30 seconds.
|
||||
func TestClockSeqRace(t *testing.T) {
|
||||
if !*regressions {
|
||||
t.Skip("skipping regression tests")
|
||||
}
|
||||
duration := time.Minute
|
||||
|
||||
done := make(chan struct{})
|
||||
defer close(done)
|
||||
|
||||
ch := make(chan UUID, 10000)
|
||||
ncpu := runtime.NumCPU()
|
||||
switch ncpu {
|
||||
case 0, 1:
|
||||
// We can't run the test effectively.
|
||||
t.Skip("skipping race test, only one CPU detected")
|
||||
return
|
||||
default:
|
||||
runtime.GOMAXPROCS(ncpu)
|
||||
}
|
||||
for i := 0; i < ncpu; i++ {
|
||||
go func() {
|
||||
for {
|
||||
select {
|
||||
case <-done:
|
||||
return
|
||||
case ch <- NewUUID():
|
||||
}
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
uuids := make(map[string]bool)
|
||||
cnt := 0
|
||||
start := time.Now()
|
||||
for u := range ch {
|
||||
s := u.String()
|
||||
if uuids[s] {
|
||||
t.Errorf("duplicate uuid after %d in %v: %s", cnt, time.Since(start), s)
|
||||
return
|
||||
}
|
||||
uuids[s] = true
|
||||
if time.Since(start) > duration {
|
||||
return
|
||||
}
|
||||
cnt++
|
||||
}
|
||||
}
|
||||
96
vendor/github.com/pborman/uuid/sql_test.go
generated
vendored
96
vendor/github.com/pborman/uuid/sql_test.go
generated
vendored
@@ -1,96 +0,0 @@
|
||||
// Copyright 2015 Google Inc. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package uuid
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestScan(t *testing.T) {
|
||||
var stringTest string = "f47ac10b-58cc-0372-8567-0e02b2c3d479"
|
||||
var byteTest []byte = Parse(stringTest)
|
||||
var badTypeTest int = 6
|
||||
var invalidTest string = "f47ac10b-58cc-0372-8567-0e02b2c3d4"
|
||||
|
||||
// sunny day tests
|
||||
|
||||
var uuid UUID
|
||||
err := (&uuid).Scan(stringTest)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
err = (&uuid).Scan([]byte(stringTest))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
err = (&uuid).Scan(byteTest)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
// bad type tests
|
||||
|
||||
err = (&uuid).Scan(badTypeTest)
|
||||
if err == nil {
|
||||
t.Error("int correctly parsed and shouldn't have")
|
||||
}
|
||||
if !strings.Contains(err.Error(), "unable to scan type") {
|
||||
t.Error("attempting to parse an int returned an incorrect error message")
|
||||
}
|
||||
|
||||
// invalid/incomplete uuids
|
||||
|
||||
err = (&uuid).Scan(invalidTest)
|
||||
if err == nil {
|
||||
t.Error("invalid uuid was parsed without error")
|
||||
}
|
||||
if !strings.Contains(err.Error(), "invalid UUID") {
|
||||
t.Error("attempting to parse an invalid UUID returned an incorrect error message")
|
||||
}
|
||||
|
||||
err = (&uuid).Scan(byteTest[:len(byteTest)-2])
|
||||
if err == nil {
|
||||
t.Error("invalid byte uuid was parsed without error")
|
||||
}
|
||||
if !strings.Contains(err.Error(), "invalid UUID") {
|
||||
t.Error("attempting to parse an invalid byte UUID returned an incorrect error message")
|
||||
}
|
||||
|
||||
// empty tests
|
||||
|
||||
uuid = nil
|
||||
var emptySlice []byte
|
||||
err = (&uuid).Scan(emptySlice)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if uuid != nil {
|
||||
t.Error("UUID was not nil after scanning empty byte slice")
|
||||
}
|
||||
|
||||
uuid = nil
|
||||
var emptyString string
|
||||
err = (&uuid).Scan(emptyString)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if uuid != nil {
|
||||
t.Error("UUID was not nil after scanning empty string")
|
||||
}
|
||||
}
|
||||
|
||||
func TestValue(t *testing.T) {
|
||||
stringTest := "f47ac10b-58cc-0372-8567-0e02b2c3d479"
|
||||
uuid := Parse(stringTest)
|
||||
val, _ := uuid.Value()
|
||||
if val != stringTest {
|
||||
t.Error("Value() did not return expected string")
|
||||
}
|
||||
}
|
||||
552
vendor/github.com/pborman/uuid/uuid_test.go
generated
vendored
552
vendor/github.com/pborman/uuid/uuid_test.go
generated
vendored
@@ -1,552 +0,0 @@
|
||||
// Copyright 2011 Google Inc. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package uuid
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"os"
|
||||
"runtime"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
type test struct {
|
||||
in string
|
||||
version Version
|
||||
variant Variant
|
||||
isuuid bool
|
||||
}
|
||||
|
||||
var tests = []test{
|
||||
{"f47ac10b-58cc-0372-8567-0e02b2c3d479", 0, RFC4122, true},
|
||||
{"f47ac10b-58cc-1372-8567-0e02b2c3d479", 1, RFC4122, true},
|
||||
{"f47ac10b-58cc-2372-8567-0e02b2c3d479", 2, RFC4122, true},
|
||||
{"f47ac10b-58cc-3372-8567-0e02b2c3d479", 3, RFC4122, true},
|
||||
{"f47ac10b-58cc-4372-8567-0e02b2c3d479", 4, RFC4122, true},
|
||||
{"f47ac10b-58cc-5372-8567-0e02b2c3d479", 5, RFC4122, true},
|
||||
{"f47ac10b-58cc-6372-8567-0e02b2c3d479", 6, RFC4122, true},
|
||||
{"f47ac10b-58cc-7372-8567-0e02b2c3d479", 7, RFC4122, true},
|
||||
{"f47ac10b-58cc-8372-8567-0e02b2c3d479", 8, RFC4122, true},
|
||||
{"f47ac10b-58cc-9372-8567-0e02b2c3d479", 9, RFC4122, true},
|
||||
{"f47ac10b-58cc-a372-8567-0e02b2c3d479", 10, RFC4122, true},
|
||||
{"f47ac10b-58cc-b372-8567-0e02b2c3d479", 11, RFC4122, true},
|
||||
{"f47ac10b-58cc-c372-8567-0e02b2c3d479", 12, RFC4122, true},
|
||||
{"f47ac10b-58cc-d372-8567-0e02b2c3d479", 13, RFC4122, true},
|
||||
{"f47ac10b-58cc-e372-8567-0e02b2c3d479", 14, RFC4122, true},
|
||||
{"f47ac10b-58cc-f372-8567-0e02b2c3d479", 15, RFC4122, true},
|
||||
|
||||
{"urn:uuid:f47ac10b-58cc-4372-0567-0e02b2c3d479", 4, Reserved, true},
|
||||
{"URN:UUID:f47ac10b-58cc-4372-0567-0e02b2c3d479", 4, Reserved, true},
|
||||
{"f47ac10b-58cc-4372-0567-0e02b2c3d479", 4, Reserved, true},
|
||||
{"f47ac10b-58cc-4372-1567-0e02b2c3d479", 4, Reserved, true},
|
||||
{"f47ac10b-58cc-4372-2567-0e02b2c3d479", 4, Reserved, true},
|
||||
{"f47ac10b-58cc-4372-3567-0e02b2c3d479", 4, Reserved, true},
|
||||
{"f47ac10b-58cc-4372-4567-0e02b2c3d479", 4, Reserved, true},
|
||||
{"f47ac10b-58cc-4372-5567-0e02b2c3d479", 4, Reserved, true},
|
||||
{"f47ac10b-58cc-4372-6567-0e02b2c3d479", 4, Reserved, true},
|
||||
{"f47ac10b-58cc-4372-7567-0e02b2c3d479", 4, Reserved, true},
|
||||
{"f47ac10b-58cc-4372-8567-0e02b2c3d479", 4, RFC4122, true},
|
||||
{"f47ac10b-58cc-4372-9567-0e02b2c3d479", 4, RFC4122, true},
|
||||
{"f47ac10b-58cc-4372-a567-0e02b2c3d479", 4, RFC4122, true},
|
||||
{"f47ac10b-58cc-4372-b567-0e02b2c3d479", 4, RFC4122, true},
|
||||
{"f47ac10b-58cc-4372-c567-0e02b2c3d479", 4, Microsoft, true},
|
||||
{"f47ac10b-58cc-4372-d567-0e02b2c3d479", 4, Microsoft, true},
|
||||
{"f47ac10b-58cc-4372-e567-0e02b2c3d479", 4, Future, true},
|
||||
{"f47ac10b-58cc-4372-f567-0e02b2c3d479", 4, Future, true},
|
||||
|
||||
{"f47ac10b158cc-5372-a567-0e02b2c3d479", 0, Invalid, false},
|
||||
{"f47ac10b-58cc25372-a567-0e02b2c3d479", 0, Invalid, false},
|
||||
{"f47ac10b-58cc-53723a567-0e02b2c3d479", 0, Invalid, false},
|
||||
{"f47ac10b-58cc-5372-a56740e02b2c3d479", 0, Invalid, false},
|
||||
{"f47ac10b-58cc-5372-a567-0e02-2c3d479", 0, Invalid, false},
|
||||
{"g47ac10b-58cc-4372-a567-0e02b2c3d479", 0, Invalid, false},
|
||||
}
|
||||
|
||||
var constants = []struct {
|
||||
c interface{}
|
||||
name string
|
||||
}{
|
||||
{Person, "Person"},
|
||||
{Group, "Group"},
|
||||
{Org, "Org"},
|
||||
{Invalid, "Invalid"},
|
||||
{RFC4122, "RFC4122"},
|
||||
{Reserved, "Reserved"},
|
||||
{Microsoft, "Microsoft"},
|
||||
{Future, "Future"},
|
||||
{Domain(17), "Domain17"},
|
||||
{Variant(42), "BadVariant42"},
|
||||
}
|
||||
|
||||
func testTest(t *testing.T, in string, tt test) {
|
||||
uuid := Parse(in)
|
||||
if ok := (uuid != nil); ok != tt.isuuid {
|
||||
t.Errorf("Parse(%s) got %v expected %v\b", in, ok, tt.isuuid)
|
||||
}
|
||||
if uuid == nil {
|
||||
return
|
||||
}
|
||||
|
||||
if v := uuid.Variant(); v != tt.variant {
|
||||
t.Errorf("Variant(%s) got %d expected %d\b", in, v, tt.variant)
|
||||
}
|
||||
if v, _ := uuid.Version(); v != tt.version {
|
||||
t.Errorf("Version(%s) got %d expected %d\b", in, v, tt.version)
|
||||
}
|
||||
}
|
||||
|
||||
func TestUUID(t *testing.T) {
|
||||
for _, tt := range tests {
|
||||
testTest(t, tt.in, tt)
|
||||
testTest(t, strings.ToUpper(tt.in), tt)
|
||||
}
|
||||
}
|
||||
|
||||
func TestConstants(t *testing.T) {
|
||||
for x, tt := range constants {
|
||||
v, ok := tt.c.(fmt.Stringer)
|
||||
if !ok {
|
||||
t.Errorf("%x: %v: not a stringer", x, v)
|
||||
} else if s := v.String(); s != tt.name {
|
||||
v, _ := tt.c.(int)
|
||||
t.Errorf("%x: Constant %T:%d gives %q, expected %q", x, tt.c, v, s, tt.name)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestRandomUUID(t *testing.T) {
|
||||
m := make(map[string]bool)
|
||||
for x := 1; x < 32; x++ {
|
||||
uuid := NewRandom()
|
||||
s := uuid.String()
|
||||
if m[s] {
|
||||
t.Errorf("NewRandom returned duplicated UUID %s", s)
|
||||
}
|
||||
m[s] = true
|
||||
if v, _ := uuid.Version(); v != 4 {
|
||||
t.Errorf("Random UUID of version %s", v)
|
||||
}
|
||||
if uuid.Variant() != RFC4122 {
|
||||
t.Errorf("Random UUID is variant %d", uuid.Variant())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestNew(t *testing.T) {
|
||||
m := make(map[string]bool)
|
||||
for x := 1; x < 32; x++ {
|
||||
s := New()
|
||||
if m[s] {
|
||||
t.Errorf("New returned duplicated UUID %s", s)
|
||||
}
|
||||
m[s] = true
|
||||
uuid := Parse(s)
|
||||
if uuid == nil {
|
||||
t.Errorf("New returned %q which does not decode", s)
|
||||
continue
|
||||
}
|
||||
if v, _ := uuid.Version(); v != 4 {
|
||||
t.Errorf("Random UUID of version %s", v)
|
||||
}
|
||||
if uuid.Variant() != RFC4122 {
|
||||
t.Errorf("Random UUID is variant %d", uuid.Variant())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func clockSeq(t *testing.T, uuid UUID) int {
|
||||
seq, ok := uuid.ClockSequence()
|
||||
if !ok {
|
||||
t.Fatalf("%s: invalid clock sequence", uuid)
|
||||
}
|
||||
return seq
|
||||
}
|
||||
|
||||
func TestClockSeq(t *testing.T) {
|
||||
// Fake time.Now for this test to return a monotonically advancing time; restore it at end.
|
||||
defer func(orig func() time.Time) { timeNow = orig }(timeNow)
|
||||
monTime := time.Now()
|
||||
timeNow = func() time.Time {
|
||||
monTime = monTime.Add(1 * time.Second)
|
||||
return monTime
|
||||
}
|
||||
|
||||
SetClockSequence(-1)
|
||||
uuid1 := NewUUID()
|
||||
uuid2 := NewUUID()
|
||||
|
||||
if clockSeq(t, uuid1) != clockSeq(t, uuid2) {
|
||||
t.Errorf("clock sequence %d != %d", clockSeq(t, uuid1), clockSeq(t, uuid2))
|
||||
}
|
||||
|
||||
SetClockSequence(-1)
|
||||
uuid2 = NewUUID()
|
||||
|
||||
// Just on the very off chance we generated the same sequence
|
||||
// two times we try again.
|
||||
if clockSeq(t, uuid1) == clockSeq(t, uuid2) {
|
||||
SetClockSequence(-1)
|
||||
uuid2 = NewUUID()
|
||||
}
|
||||
if clockSeq(t, uuid1) == clockSeq(t, uuid2) {
|
||||
t.Errorf("Duplicate clock sequence %d", clockSeq(t, uuid1))
|
||||
}
|
||||
|
||||
SetClockSequence(0x1234)
|
||||
uuid1 = NewUUID()
|
||||
if seq := clockSeq(t, uuid1); seq != 0x1234 {
|
||||
t.Errorf("%s: expected seq 0x1234 got 0x%04x", uuid1, seq)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCoding(t *testing.T) {
|
||||
text := "7d444840-9dc0-11d1-b245-5ffdce74fad2"
|
||||
urn := "urn:uuid:7d444840-9dc0-11d1-b245-5ffdce74fad2"
|
||||
data := UUID{
|
||||
0x7d, 0x44, 0x48, 0x40,
|
||||
0x9d, 0xc0,
|
||||
0x11, 0xd1,
|
||||
0xb2, 0x45,
|
||||
0x5f, 0xfd, 0xce, 0x74, 0xfa, 0xd2,
|
||||
}
|
||||
if v := data.String(); v != text {
|
||||
t.Errorf("%x: encoded to %s, expected %s", data, v, text)
|
||||
}
|
||||
if v := data.URN(); v != urn {
|
||||
t.Errorf("%x: urn is %s, expected %s", data, v, urn)
|
||||
}
|
||||
|
||||
uuid := Parse(text)
|
||||
if !Equal(uuid, data) {
|
||||
t.Errorf("%s: decoded to %s, expected %s", text, uuid, data)
|
||||
}
|
||||
}
|
||||
|
||||
func TestVersion1(t *testing.T) {
|
||||
uuid1 := NewUUID()
|
||||
uuid2 := NewUUID()
|
||||
|
||||
if Equal(uuid1, uuid2) {
|
||||
t.Errorf("%s:duplicate uuid", uuid1)
|
||||
}
|
||||
if v, _ := uuid1.Version(); v != 1 {
|
||||
t.Errorf("%s: version %s expected 1", uuid1, v)
|
||||
}
|
||||
if v, _ := uuid2.Version(); v != 1 {
|
||||
t.Errorf("%s: version %s expected 1", uuid2, v)
|
||||
}
|
||||
n1 := uuid1.NodeID()
|
||||
n2 := uuid2.NodeID()
|
||||
if !bytes.Equal(n1, n2) {
|
||||
t.Errorf("Different nodes %x != %x", n1, n2)
|
||||
}
|
||||
t1, ok := uuid1.Time()
|
||||
if !ok {
|
||||
t.Errorf("%s: invalid time", uuid1)
|
||||
}
|
||||
t2, ok := uuid2.Time()
|
||||
if !ok {
|
||||
t.Errorf("%s: invalid time", uuid2)
|
||||
}
|
||||
q1, ok := uuid1.ClockSequence()
|
||||
if !ok {
|
||||
t.Errorf("%s: invalid clock sequence", uuid1)
|
||||
}
|
||||
q2, ok := uuid2.ClockSequence()
|
||||
if !ok {
|
||||
t.Errorf("%s: invalid clock sequence", uuid2)
|
||||
}
|
||||
|
||||
switch {
|
||||
case t1 == t2 && q1 == q2:
|
||||
t.Error("time stopped")
|
||||
case t1 > t2 && q1 == q2:
|
||||
t.Error("time reversed")
|
||||
case t1 < t2 && q1 != q2:
|
||||
t.Error("clock sequence chaned unexpectedly")
|
||||
}
|
||||
}
|
||||
|
||||
func TestNode(t *testing.T) {
|
||||
// This test is mostly to make sure we don't leave nodeMu locked.
|
||||
ifname = ""
|
||||
if ni := NodeInterface(); ni != "" {
|
||||
t.Errorf("NodeInterface got %q, want %q", ni, "")
|
||||
}
|
||||
nodeID = nil // Reset global state for next test
|
||||
if SetNodeInterface("xyzzy") {
|
||||
t.Error("SetNodeInterface succeeded on a bad interface name")
|
||||
}
|
||||
nodeID = nil // Reset global state for next test
|
||||
if !SetNodeInterface("") {
|
||||
t.Error("SetNodeInterface failed")
|
||||
}
|
||||
|
||||
if runtime.GOARCH != "js" {
|
||||
if ni := NodeInterface(); ni == "" {
|
||||
t.Error("NodeInterface returned an empty string")
|
||||
}
|
||||
}
|
||||
|
||||
ni := NodeID()
|
||||
if len(ni) != 6 {
|
||||
t.Errorf("ni got %d bytes, want 6", len(ni))
|
||||
}
|
||||
hasData := false
|
||||
for _, b := range ni {
|
||||
if b != 0 {
|
||||
hasData = true
|
||||
}
|
||||
}
|
||||
if !hasData {
|
||||
t.Error("nodeid is all zeros")
|
||||
}
|
||||
|
||||
id := []byte{1, 2, 3, 4, 5, 6, 7, 8}
|
||||
SetNodeID(id)
|
||||
ni = NodeID()
|
||||
if !bytes.Equal(ni, id[:6]) {
|
||||
t.Errorf("got nodeid %v, want %v", ni, id[:6])
|
||||
}
|
||||
|
||||
if ni := NodeInterface(); ni != "user" {
|
||||
t.Errorf("got inteface %q, want %q", ni, "user")
|
||||
}
|
||||
}
|
||||
|
||||
func TestNodeAndTime(t *testing.T) {
|
||||
// Time is February 5, 1998 12:30:23.136364800 AM GMT
|
||||
|
||||
uuid := Parse("7d444840-9dc0-11d1-b245-5ffdce74fad2")
|
||||
node := []byte{0x5f, 0xfd, 0xce, 0x74, 0xfa, 0xd2}
|
||||
|
||||
ts, ok := uuid.Time()
|
||||
if ok {
|
||||
c := time.Unix(ts.UnixTime())
|
||||
want := time.Date(1998, 2, 5, 0, 30, 23, 136364800, time.UTC)
|
||||
if !c.Equal(want) {
|
||||
t.Errorf("Got time %v, want %v", c, want)
|
||||
}
|
||||
} else {
|
||||
t.Errorf("%s: bad time", uuid)
|
||||
}
|
||||
if !bytes.Equal(node, uuid.NodeID()) {
|
||||
t.Errorf("Expected node %v got %v", node, uuid.NodeID())
|
||||
}
|
||||
}
|
||||
|
||||
func TestMD5(t *testing.T) {
|
||||
uuid := NewMD5(NameSpace_DNS, []byte("python.org")).String()
|
||||
want := "6fa459ea-ee8a-3ca4-894e-db77e160355e"
|
||||
if uuid != want {
|
||||
t.Errorf("MD5: got %q expected %q", uuid, want)
|
||||
}
|
||||
}
|
||||
|
||||
func TestSHA1(t *testing.T) {
|
||||
uuid := NewSHA1(NameSpace_DNS, []byte("python.org")).String()
|
||||
want := "886313e1-3b8a-5372-9b90-0c9aee199e5d"
|
||||
if uuid != want {
|
||||
t.Errorf("SHA1: got %q expected %q", uuid, want)
|
||||
}
|
||||
}
|
||||
|
||||
func TestNodeID(t *testing.T) {
|
||||
nid := []byte{1, 2, 3, 4, 5, 6}
|
||||
nodeID = nil // Reset global state for next test
|
||||
SetNodeInterface("")
|
||||
s := NodeInterface()
|
||||
if runtime.GOARCH != "js" {
|
||||
if s == "" || s == "user" {
|
||||
t.Errorf("NodeInterface %q after SetInterface", s)
|
||||
}
|
||||
}
|
||||
node1 := NodeID()
|
||||
if node1 == nil {
|
||||
t.Error("NodeID nil after SetNodeInterface", s)
|
||||
}
|
||||
SetNodeID(nid)
|
||||
s = NodeInterface()
|
||||
if s != "user" {
|
||||
t.Errorf("Expected NodeInterface %q got %q", "user", s)
|
||||
}
|
||||
node2 := NodeID()
|
||||
if node2 == nil {
|
||||
t.Error("NodeID nil after SetNodeID", s)
|
||||
}
|
||||
if bytes.Equal(node1, node2) {
|
||||
t.Error("NodeID not changed after SetNodeID", s)
|
||||
} else if !bytes.Equal(nid, node2) {
|
||||
t.Errorf("NodeID is %x, expected %x", node2, nid)
|
||||
}
|
||||
}
|
||||
|
||||
func testDCE(t *testing.T, name string, uuid UUID, domain Domain, id uint32) {
|
||||
if uuid == nil {
|
||||
t.Errorf("%s failed", name)
|
||||
return
|
||||
}
|
||||
if v, _ := uuid.Version(); v != 2 {
|
||||
t.Errorf("%s: %s: expected version 2, got %s", name, uuid, v)
|
||||
return
|
||||
}
|
||||
if v, ok := uuid.Domain(); !ok || v != domain {
|
||||
if !ok {
|
||||
t.Errorf("%s: %d: Domain failed", name, uuid)
|
||||
} else {
|
||||
t.Errorf("%s: %s: expected domain %d, got %d", name, uuid, domain, v)
|
||||
}
|
||||
}
|
||||
if v, ok := uuid.Id(); !ok || v != id {
|
||||
if !ok {
|
||||
t.Errorf("%s: %d: Id failed", name, uuid)
|
||||
} else {
|
||||
t.Errorf("%s: %s: expected id %d, got %d", name, uuid, id, v)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestDCE(t *testing.T) {
|
||||
testDCE(t, "NewDCESecurity", NewDCESecurity(42, 12345678), 42, 12345678)
|
||||
testDCE(t, "NewDCEPerson", NewDCEPerson(), Person, uint32(os.Getuid()))
|
||||
testDCE(t, "NewDCEGroup", NewDCEGroup(), Group, uint32(os.Getgid()))
|
||||
}
|
||||
|
||||
type badRand struct{}
|
||||
|
||||
func (r badRand) Read(buf []byte) (int, error) {
|
||||
for i, _ := range buf {
|
||||
buf[i] = byte(i)
|
||||
}
|
||||
return len(buf), nil
|
||||
}
|
||||
|
||||
func TestBadRand(t *testing.T) {
|
||||
SetRand(badRand{})
|
||||
uuid1 := New()
|
||||
uuid2 := New()
|
||||
if uuid1 != uuid2 {
|
||||
t.Errorf("expected duplicates, got %q and %q", uuid1, uuid2)
|
||||
}
|
||||
SetRand(nil)
|
||||
uuid1 = New()
|
||||
uuid2 = New()
|
||||
if uuid1 == uuid2 {
|
||||
t.Errorf("unexpected duplicates, got %q", uuid1)
|
||||
}
|
||||
}
|
||||
|
||||
func TestUUID_Array(t *testing.T) {
|
||||
expect := Array{
|
||||
0xf4, 0x7a, 0xc1, 0x0b,
|
||||
0x58, 0xcc,
|
||||
0x03, 0x72,
|
||||
0x85, 0x67,
|
||||
0x0e, 0x02, 0xb2, 0xc3, 0xd4, 0x79,
|
||||
}
|
||||
uuid := Parse("f47ac10b-58cc-0372-8567-0e02b2c3d479")
|
||||
if uuid == nil {
|
||||
t.Fatal("invalid uuid")
|
||||
}
|
||||
if uuid.Array() != expect {
|
||||
t.Fatal("invalid array")
|
||||
}
|
||||
}
|
||||
|
||||
func TestArray_UUID(t *testing.T) {
|
||||
array := Array{
|
||||
0xf4, 0x7a, 0xc1, 0x0b,
|
||||
0x58, 0xcc,
|
||||
0x03, 0x72,
|
||||
0x85, 0x67,
|
||||
0x0e, 0x02, 0xb2, 0xc3, 0xd4, 0x79,
|
||||
}
|
||||
expect := Parse("f47ac10b-58cc-0372-8567-0e02b2c3d479")
|
||||
if expect == nil {
|
||||
t.Fatal("invalid uuid")
|
||||
}
|
||||
if !bytes.Equal(array.UUID(), expect) {
|
||||
t.Fatal("invalid uuid")
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkParse(b *testing.B) {
|
||||
for i := 0; i < b.N; i++ {
|
||||
uuid := Parse("f47ac10b-58cc-0372-8567-0e02b2c3d479")
|
||||
if uuid == nil {
|
||||
b.Fatal("invalid uuid")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkNew(b *testing.B) {
|
||||
for i := 0; i < b.N; i++ {
|
||||
New()
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkUUID_String(b *testing.B) {
|
||||
uuid := Parse("f47ac10b-58cc-0372-8567-0e02b2c3d479")
|
||||
if uuid == nil {
|
||||
b.Fatal("invalid uuid")
|
||||
}
|
||||
for i := 0; i < b.N; i++ {
|
||||
if uuid.String() == "" {
|
||||
b.Fatal("invalid uuid")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkUUID_URN(b *testing.B) {
|
||||
uuid := Parse("f47ac10b-58cc-0372-8567-0e02b2c3d479")
|
||||
if uuid == nil {
|
||||
b.Fatal("invalid uuid")
|
||||
}
|
||||
for i := 0; i < b.N; i++ {
|
||||
if uuid.URN() == "" {
|
||||
b.Fatal("invalid uuid")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkUUID_Array(b *testing.B) {
|
||||
expect := Array{
|
||||
0xf4, 0x7a, 0xc1, 0x0b,
|
||||
0x58, 0xcc,
|
||||
0x03, 0x72,
|
||||
0x85, 0x67,
|
||||
0x0e, 0x02, 0xb2, 0xc3, 0xd4, 0x79,
|
||||
}
|
||||
uuid := Parse("f47ac10b-58cc-0372-8567-0e02b2c3d479")
|
||||
if uuid == nil {
|
||||
b.Fatal("invalid uuid")
|
||||
}
|
||||
for i := 0; i < b.N; i++ {
|
||||
if uuid.Array() != expect {
|
||||
b.Fatal("invalid array")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkArray_UUID(b *testing.B) {
|
||||
array := Array{
|
||||
0xf4, 0x7a, 0xc1, 0x0b,
|
||||
0x58, 0xcc,
|
||||
0x03, 0x72,
|
||||
0x85, 0x67,
|
||||
0x0e, 0x02, 0xb2, 0xc3, 0xd4, 0x79,
|
||||
}
|
||||
expect := Parse("f47ac10b-58cc-0372-8567-0e02b2c3d479")
|
||||
if expect == nil {
|
||||
b.Fatal("invalid uuid")
|
||||
}
|
||||
for i := 0; i < b.N; i++ {
|
||||
if !bytes.Equal(array.UUID(), expect) {
|
||||
b.Fatal("invalid uuid")
|
||||
}
|
||||
}
|
||||
}
|
||||
4
vendor/github.com/pborman/uuid/version1.go
generated
vendored
4
vendor/github.com/pborman/uuid/version1.go
generated
vendored
@@ -15,7 +15,9 @@ import (
|
||||
// SetClockSequence then it will be set automatically. If GetTime fails to
|
||||
// return the current NewUUID returns nil.
|
||||
func NewUUID() UUID {
|
||||
SetNodeInterface("")
|
||||
if nodeID == nil {
|
||||
SetNodeInterface("")
|
||||
}
|
||||
|
||||
now, seq, err := GetTime()
|
||||
if err != nil {
|
||||
|
||||
683
vendor/github.com/spf13/cobra/cobra/cmd/license_agpl.go
generated
vendored
683
vendor/github.com/spf13/cobra/cobra/cmd/license_agpl.go
generated
vendored
@@ -1,683 +0,0 @@
|
||||
package cmd
|
||||
|
||||
func initAgpl() {
|
||||
Licenses["agpl"] = License{
|
||||
Name: "GNU Affero General Public License",
|
||||
PossibleMatches: []string{"agpl", "affero gpl", "gnu agpl"},
|
||||
Header: `
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.`,
|
||||
Text: ` GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
Version 3, 19 November 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU Affero General Public License is a free, copyleft license for
|
||||
software and other kinds of works, specifically designed to ensure
|
||||
cooperation with the community in the case of network server software.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
our General Public Licenses are intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
Developers that use our General Public Licenses protect your rights
|
||||
with two steps: (1) assert copyright on the software, and (2) offer
|
||||
you this License which gives you legal permission to copy, distribute
|
||||
and/or modify the software.
|
||||
|
||||
A secondary benefit of defending all users' freedom is that
|
||||
improvements made in alternate versions of the program, if they
|
||||
receive widespread use, become available for other developers to
|
||||
incorporate. Many developers of free software are heartened and
|
||||
encouraged by the resulting cooperation. However, in the case of
|
||||
software used on network servers, this result may fail to come about.
|
||||
The GNU General Public License permits making a modified version and
|
||||
letting the public access it on a server without ever releasing its
|
||||
source code to the public.
|
||||
|
||||
The GNU Affero General Public License is designed specifically to
|
||||
ensure that, in such cases, the modified source code becomes available
|
||||
to the community. It requires the operator of a network server to
|
||||
provide the source code of the modified version running there to the
|
||||
users of that server. Therefore, public use of a modified version, on
|
||||
a publicly accessible server, gives the public access to the source
|
||||
code of the modified version.
|
||||
|
||||
An older license, called the Affero General Public License and
|
||||
published by Affero, was designed to accomplish similar goals. This is
|
||||
a different license, not a version of the Affero GPL, but Affero has
|
||||
released a new version of the Affero GPL which permits relicensing under
|
||||
this license.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU Affero General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Remote Network Interaction; Use with the GNU General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, if you modify the
|
||||
Program, your modified version must prominently offer all users
|
||||
interacting with it remotely through a computer network (if your version
|
||||
supports such interaction) an opportunity to receive the Corresponding
|
||||
Source of your version by providing access to the Corresponding Source
|
||||
from a network server at no charge, through some standard or customary
|
||||
means of facilitating copying of software. This Corresponding Source
|
||||
shall include the Corresponding Source for any work covered by version 3
|
||||
of the GNU General Public License that is incorporated pursuant to the
|
||||
following paragraph.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the work with which it is combined will remain governed by version
|
||||
3 of the GNU General Public License.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU Affero General Public License from time to time. Such new versions
|
||||
will be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU Affero General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU Affero General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU Affero General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If your software can interact with users remotely through a computer
|
||||
network, you should also make sure that it provides a way for users to
|
||||
get its source. For example, if your program is a web application, its
|
||||
interface could display a "Source" link that leads users to an archive
|
||||
of the code. There are many ways you could offer source, and different
|
||||
solutions will be better for different programs; see section 13 for the
|
||||
specific requirements.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU AGPL, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
`,
|
||||
}
|
||||
}
|
||||
238
vendor/github.com/spf13/cobra/cobra/cmd/license_apache_2.go
generated
vendored
238
vendor/github.com/spf13/cobra/cobra/cmd/license_apache_2.go
generated
vendored
@@ -1,238 +0,0 @@
|
||||
// Copyright © 2015 Steve Francia <spf@spf13.com>.
|
||||
//
|
||||
// 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.
|
||||
|
||||
// Parts inspired by https://github.com/ryanuber/go-license
|
||||
|
||||
package cmd
|
||||
|
||||
func initApache2() {
|
||||
Licenses["apache"] = License{
|
||||
Name: "Apache 2.0",
|
||||
PossibleMatches: []string{"apache", "apache20", "apache 2.0", "apache2.0", "apache-2.0"},
|
||||
Header: `
|
||||
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.`,
|
||||
Text: `
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
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.
|
||||
`,
|
||||
}
|
||||
}
|
||||
71
vendor/github.com/spf13/cobra/cobra/cmd/license_bsd_clause_2.go
generated
vendored
71
vendor/github.com/spf13/cobra/cobra/cmd/license_bsd_clause_2.go
generated
vendored
@@ -1,71 +0,0 @@
|
||||
// Copyright © 2015 Steve Francia <spf@spf13.com>.
|
||||
//
|
||||
// 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.
|
||||
|
||||
// Parts inspired by https://github.com/ryanuber/go-license
|
||||
|
||||
package cmd
|
||||
|
||||
func initBsdClause2() {
|
||||
Licenses["freebsd"] = License{
|
||||
Name: "Simplified BSD License",
|
||||
PossibleMatches: []string{"freebsd", "simpbsd", "simple bsd", "2-clause bsd",
|
||||
"2 clause bsd", "simplified bsd license"},
|
||||
Header: `All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.`,
|
||||
Text: `{{ .copyright }}
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
`,
|
||||
}
|
||||
}
|
||||
78
vendor/github.com/spf13/cobra/cobra/cmd/license_bsd_clause_3.go
generated
vendored
78
vendor/github.com/spf13/cobra/cobra/cmd/license_bsd_clause_3.go
generated
vendored
@@ -1,78 +0,0 @@
|
||||
// Copyright © 2015 Steve Francia <spf@spf13.com>.
|
||||
//
|
||||
// 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.
|
||||
|
||||
// Parts inspired by https://github.com/ryanuber/go-license
|
||||
|
||||
package cmd
|
||||
|
||||
func initBsdClause3() {
|
||||
Licenses["bsd"] = License{
|
||||
Name: "NewBSD",
|
||||
PossibleMatches: []string{"bsd", "newbsd", "3 clause bsd", "3-clause bsd"},
|
||||
Header: `All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.`,
|
||||
Text: `{{ .copyright }}
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
`,
|
||||
}
|
||||
}
|
||||
376
vendor/github.com/spf13/cobra/cobra/cmd/license_gpl_2.go
generated
vendored
376
vendor/github.com/spf13/cobra/cobra/cmd/license_gpl_2.go
generated
vendored
@@ -1,376 +0,0 @@
|
||||
// Copyright © 2015 Steve Francia <spf@spf13.com>.
|
||||
//
|
||||
// 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.
|
||||
|
||||
// Parts inspired by https://github.com/ryanuber/go-license
|
||||
|
||||
package cmd
|
||||
|
||||
func initGpl2() {
|
||||
Licenses["gpl2"] = License{
|
||||
Name: "GNU General Public License 2.0",
|
||||
PossibleMatches: []string{"gpl2", "gnu gpl2", "gplv2"},
|
||||
Header: `
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.`,
|
||||
Text: ` GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type 'show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type 'show c' for details.
|
||||
|
||||
The hypothetical commands 'show w' and 'show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than 'show w' and 'show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
'Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License.
|
||||
`,
|
||||
}
|
||||
}
|
||||
711
vendor/github.com/spf13/cobra/cobra/cmd/license_gpl_3.go
generated
vendored
711
vendor/github.com/spf13/cobra/cobra/cmd/license_gpl_3.go
generated
vendored
@@ -1,711 +0,0 @@
|
||||
// Copyright © 2015 Steve Francia <spf@spf13.com>.
|
||||
//
|
||||
// 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.
|
||||
|
||||
// Parts inspired by https://github.com/ryanuber/go-license
|
||||
|
||||
package cmd
|
||||
|
||||
func initGpl3() {
|
||||
Licenses["gpl3"] = License{
|
||||
Name: "GNU General Public License 3.0",
|
||||
PossibleMatches: []string{"gpl3", "gplv3", "gpl", "gnu gpl3", "gnu gpl"},
|
||||
Header: `
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.`,
|
||||
Text: ` GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type 'show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type 'show c' for details.
|
||||
|
||||
The hypothetical commands 'show w' and 'show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
||||
`,
|
||||
}
|
||||
}
|
||||
186
vendor/github.com/spf13/cobra/cobra/cmd/license_lgpl.go
generated
vendored
186
vendor/github.com/spf13/cobra/cobra/cmd/license_lgpl.go
generated
vendored
@@ -1,186 +0,0 @@
|
||||
package cmd
|
||||
|
||||
func initLgpl() {
|
||||
Licenses["lgpl"] = License{
|
||||
Name: "GNU Lesser General Public License",
|
||||
PossibleMatches: []string{"lgpl", "lesser gpl", "gnu lgpl"},
|
||||
Header: `
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.`,
|
||||
Text: ` GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
|
||||
This version of the GNU Lesser General Public License incorporates
|
||||
the terms and conditions of version 3 of the GNU General Public
|
||||
License, supplemented by the additional permissions listed below.
|
||||
|
||||
0. Additional Definitions.
|
||||
|
||||
As used herein, "this License" refers to version 3 of the GNU Lesser
|
||||
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
||||
General Public License.
|
||||
|
||||
"The Library" refers to a covered work governed by this License,
|
||||
other than an Application or a Combined Work as defined below.
|
||||
|
||||
An "Application" is any work that makes use of an interface provided
|
||||
by the Library, but which is not otherwise based on the Library.
|
||||
Defining a subclass of a class defined by the Library is deemed a mode
|
||||
of using an interface provided by the Library.
|
||||
|
||||
A "Combined Work" is a work produced by combining or linking an
|
||||
Application with the Library. The particular version of the Library
|
||||
with which the Combined Work was made is also called the "Linked
|
||||
Version".
|
||||
|
||||
The "Minimal Corresponding Source" for a Combined Work means the
|
||||
Corresponding Source for the Combined Work, excluding any source code
|
||||
for portions of the Combined Work that, considered in isolation, are
|
||||
based on the Application, and not on the Linked Version.
|
||||
|
||||
The "Corresponding Application Code" for a Combined Work means the
|
||||
object code and/or source code for the Application, including any data
|
||||
and utility programs needed for reproducing the Combined Work from the
|
||||
Application, but excluding the System Libraries of the Combined Work.
|
||||
|
||||
1. Exception to Section 3 of the GNU GPL.
|
||||
|
||||
You may convey a covered work under sections 3 and 4 of this License
|
||||
without being bound by section 3 of the GNU GPL.
|
||||
|
||||
2. Conveying Modified Versions.
|
||||
|
||||
If you modify a copy of the Library, and, in your modifications, a
|
||||
facility refers to a function or data to be supplied by an Application
|
||||
that uses the facility (other than as an argument passed when the
|
||||
facility is invoked), then you may convey a copy of the modified
|
||||
version:
|
||||
|
||||
a) under this License, provided that you make a good faith effort to
|
||||
ensure that, in the event an Application does not supply the
|
||||
function or data, the facility still operates, and performs
|
||||
whatever part of its purpose remains meaningful, or
|
||||
|
||||
b) under the GNU GPL, with none of the additional permissions of
|
||||
this License applicable to that copy.
|
||||
|
||||
3. Object Code Incorporating Material from Library Header Files.
|
||||
|
||||
The object code form of an Application may incorporate material from
|
||||
a header file that is part of the Library. You may convey such object
|
||||
code under terms of your choice, provided that, if the incorporated
|
||||
material is not limited to numerical parameters, data structure
|
||||
layouts and accessors, or small macros, inline functions and templates
|
||||
(ten or fewer lines in length), you do both of the following:
|
||||
|
||||
a) Give prominent notice with each copy of the object code that the
|
||||
Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the object code with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
4. Combined Works.
|
||||
|
||||
You may convey a Combined Work under terms of your choice that,
|
||||
taken together, effectively do not restrict modification of the
|
||||
portions of the Library contained in the Combined Work and reverse
|
||||
engineering for debugging such modifications, if you also do each of
|
||||
the following:
|
||||
|
||||
a) Give prominent notice with each copy of the Combined Work that
|
||||
the Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
c) For a Combined Work that displays copyright notices during
|
||||
execution, include the copyright notice for the Library among
|
||||
these notices, as well as a reference directing the user to the
|
||||
copies of the GNU GPL and this license document.
|
||||
|
||||
d) Do one of the following:
|
||||
|
||||
0) Convey the Minimal Corresponding Source under the terms of this
|
||||
License, and the Corresponding Application Code in a form
|
||||
suitable for, and under terms that permit, the user to
|
||||
recombine or relink the Application with a modified version of
|
||||
the Linked Version to produce a modified Combined Work, in the
|
||||
manner specified by section 6 of the GNU GPL for conveying
|
||||
Corresponding Source.
|
||||
|
||||
1) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (a) uses at run time
|
||||
a copy of the Library already present on the user's computer
|
||||
system, and (b) will operate properly with a modified version
|
||||
of the Library that is interface-compatible with the Linked
|
||||
Version.
|
||||
|
||||
e) Provide Installation Information, but only if you would otherwise
|
||||
be required to provide such information under section 6 of the
|
||||
GNU GPL, and only to the extent that such information is
|
||||
necessary to install and execute a modified version of the
|
||||
Combined Work produced by recombining or relinking the
|
||||
Application with a modified version of the Linked Version. (If
|
||||
you use option 4d0, the Installation Information must accompany
|
||||
the Minimal Corresponding Source and Corresponding Application
|
||||
Code. If you use option 4d1, you must provide the Installation
|
||||
Information in the manner specified by section 6 of the GNU GPL
|
||||
for conveying Corresponding Source.)
|
||||
|
||||
5. Combined Libraries.
|
||||
|
||||
You may place library facilities that are a work based on the
|
||||
Library side by side in a single library together with other library
|
||||
facilities that are not Applications and are not covered by this
|
||||
License, and convey such a combined library under terms of your
|
||||
choice, if you do both of the following:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work based
|
||||
on the Library, uncombined with any other library facilities,
|
||||
conveyed under the terms of this License.
|
||||
|
||||
b) Give prominent notice with the combined library that part of it
|
||||
is a work based on the Library, and explaining where to find the
|
||||
accompanying uncombined form of the same work.
|
||||
|
||||
6. Revised Versions of the GNU Lesser General Public License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions
|
||||
of the GNU Lesser General Public License from time to time. Such new
|
||||
versions will be similar in spirit to the present version, but may
|
||||
differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Library as you received it specifies that a certain numbered version
|
||||
of the GNU Lesser General Public License "or any later version"
|
||||
applies to it, you have the option of following the terms and
|
||||
conditions either of that published version or of any later version
|
||||
published by the Free Software Foundation. If the Library as you
|
||||
received it does not specify a version number of the GNU Lesser
|
||||
General Public License, you may choose any version of the GNU Lesser
|
||||
General Public License ever published by the Free Software Foundation.
|
||||
|
||||
If the Library as you received it specifies that a proxy can decide
|
||||
whether future versions of the GNU Lesser General Public License shall
|
||||
apply, that proxy's public statement of acceptance of any version is
|
||||
permanent authorization for you to choose that version for the
|
||||
Library.`,
|
||||
}
|
||||
}
|
||||
63
vendor/github.com/spf13/cobra/cobra/cmd/license_mit.go
generated
vendored
63
vendor/github.com/spf13/cobra/cobra/cmd/license_mit.go
generated
vendored
@@ -1,63 +0,0 @@
|
||||
// Copyright © 2015 Steve Francia <spf@spf13.com>.
|
||||
//
|
||||
// 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.
|
||||
|
||||
// Parts inspired by https://github.com/ryanuber/go-license
|
||||
|
||||
package cmd
|
||||
|
||||
func initMit() {
|
||||
Licenses["mit"] = License{
|
||||
Name: "MIT License",
|
||||
PossibleMatches: []string{"mit"},
|
||||
Header: `
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.`,
|
||||
Text: `The MIT License (MIT)
|
||||
|
||||
{{ .copyright }}
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
`,
|
||||
}
|
||||
}
|
||||
118
vendor/github.com/spf13/cobra/cobra/cmd/licenses.go
generated
vendored
118
vendor/github.com/spf13/cobra/cobra/cmd/licenses.go
generated
vendored
@@ -1,118 +0,0 @@
|
||||
// Copyright © 2015 Steve Francia <spf@spf13.com>.
|
||||
//
|
||||
// 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.
|
||||
|
||||
// Parts inspired by https://github.com/ryanuber/go-license
|
||||
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
// Licenses contains all possible licenses a user can choose from.
|
||||
var Licenses = make(map[string]License)
|
||||
|
||||
// License represents a software license agreement, containing the Name of
|
||||
// the license, its possible matches (on the command line as given to cobra),
|
||||
// the header to be used with each file on the file's creating, and the text
|
||||
// of the license
|
||||
type License struct {
|
||||
Name string // The type of license in use
|
||||
PossibleMatches []string // Similar names to guess
|
||||
Text string // License text data
|
||||
Header string // License header for source files
|
||||
}
|
||||
|
||||
func init() {
|
||||
// Allows a user to not use a license.
|
||||
Licenses["none"] = License{"None", []string{"none", "false"}, "", ""}
|
||||
|
||||
initApache2()
|
||||
initMit()
|
||||
initBsdClause3()
|
||||
initBsdClause2()
|
||||
initGpl2()
|
||||
initGpl3()
|
||||
initLgpl()
|
||||
initAgpl()
|
||||
}
|
||||
|
||||
// getLicense returns license specified by user in flag or in config.
|
||||
// If user didn't specify the license, it returns Apache License 2.0.
|
||||
//
|
||||
// TODO: Inspect project for existing license
|
||||
func getLicense() License {
|
||||
// If explicitly flagged, use that.
|
||||
if userLicense != "" {
|
||||
return findLicense(userLicense)
|
||||
}
|
||||
|
||||
// If user wants to have custom license, use that.
|
||||
if viper.IsSet("license.header") || viper.IsSet("license.text") {
|
||||
return License{Header: viper.GetString("license.header"),
|
||||
Text: viper.GetString("license.text")}
|
||||
}
|
||||
|
||||
// If user wants to have built-in license, use that.
|
||||
if viper.IsSet("license") {
|
||||
return findLicense(viper.GetString("license"))
|
||||
}
|
||||
|
||||
// If user didn't set any license, use Apache 2.0 by default.
|
||||
return Licenses["apache"]
|
||||
}
|
||||
|
||||
func copyrightLine() string {
|
||||
author := viper.GetString("author")
|
||||
|
||||
year := viper.GetString("year") // For tests.
|
||||
if year == "" {
|
||||
year = time.Now().Format("2006")
|
||||
}
|
||||
|
||||
return "Copyright © " + year + " " + author
|
||||
}
|
||||
|
||||
// findLicense looks for License object of built-in licenses.
|
||||
// If it didn't find license, then the app will be terminated and
|
||||
// error will be printed.
|
||||
func findLicense(name string) License {
|
||||
found := matchLicense(name)
|
||||
if found == "" {
|
||||
er("unknown license: " + name)
|
||||
}
|
||||
return Licenses[found]
|
||||
}
|
||||
|
||||
// matchLicense compares the given a license name
|
||||
// to PossibleMatches of all built-in licenses.
|
||||
// It returns blank string, if name is blank string or it didn't find
|
||||
// then appropriate match to name.
|
||||
func matchLicense(name string) string {
|
||||
if name == "" {
|
||||
return ""
|
||||
}
|
||||
|
||||
for key, lic := range Licenses {
|
||||
for _, match := range lic.PossibleMatches {
|
||||
if strings.EqualFold(name, match) {
|
||||
return key
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
||||
156
vendor/github.com/vmware/govmomi/simulator/license_manager.go
generated
vendored
156
vendor/github.com/vmware/govmomi/simulator/license_manager.go
generated
vendored
@@ -1,156 +0,0 @@
|
||||
/*
|
||||
Copyright (c) 2017 VMware, Inc. 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.
|
||||
*/
|
||||
// Copyright 2017 VMware, Inc. 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.
|
||||
|
||||
package simulator
|
||||
|
||||
import (
|
||||
"github.com/vmware/govmomi/object"
|
||||
"github.com/vmware/govmomi/vim25/methods"
|
||||
"github.com/vmware/govmomi/vim25/mo"
|
||||
"github.com/vmware/govmomi/vim25/soap"
|
||||
"github.com/vmware/govmomi/vim25/types"
|
||||
)
|
||||
|
||||
// EvalLicense is the default license
|
||||
var EvalLicense = types.LicenseManagerLicenseInfo{
|
||||
LicenseKey: "00000-00000-00000-00000-00000",
|
||||
EditionKey: "eval",
|
||||
Name: "Evaluation Mode",
|
||||
Properties: []types.KeyAnyValue{
|
||||
{
|
||||
Key: "feature",
|
||||
Value: types.KeyValue{
|
||||
Key: "serialuri:2",
|
||||
Value: "Remote virtual Serial Port Concentrator",
|
||||
},
|
||||
},
|
||||
{
|
||||
Key: "feature",
|
||||
Value: types.KeyValue{
|
||||
Key: "dvs",
|
||||
Value: "vSphere Distributed Switch",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
type LicenseManager struct {
|
||||
mo.LicenseManager
|
||||
}
|
||||
|
||||
func NewLicenseManager(ref types.ManagedObjectReference) object.Reference {
|
||||
m := &LicenseManager{}
|
||||
m.Self = ref
|
||||
m.Licenses = []types.LicenseManagerLicenseInfo{EvalLicense}
|
||||
|
||||
if Map.IsVPX() {
|
||||
am := Map.Put(&LicenseAssignmentManager{}).Reference()
|
||||
m.LicenseAssignmentManager = &am
|
||||
}
|
||||
|
||||
return m
|
||||
}
|
||||
|
||||
func (m *LicenseManager) AddLicense(req *types.AddLicense) soap.HasFault {
|
||||
body := &methods.AddLicenseBody{
|
||||
Res: &types.AddLicenseResponse{},
|
||||
}
|
||||
|
||||
for _, license := range m.Licenses {
|
||||
if license.LicenseKey == req.LicenseKey {
|
||||
body.Res.Returnval = licenseInfo(license.LicenseKey, license.Labels)
|
||||
return body
|
||||
}
|
||||
}
|
||||
|
||||
m.Licenses = append(m.Licenses, types.LicenseManagerLicenseInfo{
|
||||
LicenseKey: req.LicenseKey,
|
||||
Labels: req.Labels,
|
||||
})
|
||||
|
||||
body.Res.Returnval = licenseInfo(req.LicenseKey, req.Labels)
|
||||
|
||||
return body
|
||||
}
|
||||
|
||||
func (m *LicenseManager) RemoveLicense(req *types.RemoveLicense) soap.HasFault {
|
||||
body := &methods.RemoveLicenseBody{
|
||||
Res: &types.RemoveLicenseResponse{},
|
||||
}
|
||||
|
||||
for i, license := range m.Licenses {
|
||||
if req.LicenseKey == license.LicenseKey {
|
||||
m.Licenses = append(m.Licenses[:i], m.Licenses[i+1:]...)
|
||||
return body
|
||||
}
|
||||
}
|
||||
return body
|
||||
}
|
||||
|
||||
type LicenseAssignmentManager struct {
|
||||
mo.LicenseAssignmentManager
|
||||
}
|
||||
|
||||
func (m *LicenseAssignmentManager) QueryAssignedLicenses(req *types.QueryAssignedLicenses) soap.HasFault {
|
||||
body := &methods.QueryAssignedLicensesBody{
|
||||
Res: &types.QueryAssignedLicensesResponse{},
|
||||
}
|
||||
|
||||
// EntityId can be a HostSystem or the vCenter InstanceUuid
|
||||
if req.EntityId != "" {
|
||||
if req.EntityId != Map.content().About.InstanceUuid {
|
||||
id := types.ManagedObjectReference{
|
||||
Type: "HostSystem",
|
||||
Value: req.EntityId,
|
||||
}
|
||||
|
||||
if Map.Get(id) == nil {
|
||||
return body
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
body.Res.Returnval = []types.LicenseAssignmentManagerLicenseAssignment{
|
||||
{
|
||||
EntityId: req.EntityId,
|
||||
AssignedLicense: EvalLicense,
|
||||
},
|
||||
}
|
||||
|
||||
return body
|
||||
}
|
||||
|
||||
func licenseInfo(key string, labels []types.KeyValue) types.LicenseManagerLicenseInfo {
|
||||
info := EvalLicense
|
||||
|
||||
info.LicenseKey = key
|
||||
info.Labels = labels
|
||||
|
||||
return info
|
||||
}
|
||||
8320
vendor/github.com/vmware/vic/LICENSE
generated
vendored
8320
vendor/github.com/vmware/vic/LICENSE
generated
vendored
File diff suppressed because it is too large
Load Diff
10
vendor/github.com/vmware/vic/doc/bundle/NOTICE
generated
vendored
10
vendor/github.com/vmware/vic/doc/bundle/NOTICE
generated
vendored
@@ -2,13 +2,13 @@ NOTICE
|
||||
|
||||
vSphere Integrated Containers Engine
|
||||
|
||||
Copyright (c) 2016-2017 VMware, Inc. All Rights Reserved.
|
||||
Copyright (c) 2016-2018 VMware, Inc. All Rights Reserved.
|
||||
|
||||
This product is licensed to you under the Apache License, Version 2.0 (the
|
||||
"License"). You may not use this product except in compliance with the
|
||||
License.
|
||||
|
||||
This product may include a number of components with separate copyright
|
||||
notices and license terms. Your use of the source code for these components is
|
||||
subject to the terms and conditions of the component's license, as noted in
|
||||
the LICENSE file.
|
||||
This product may include a number of components with separate copyright notices
|
||||
and license terms. Your use of the source code for these components is subject
|
||||
to the terms and conditions of the component's license, as noted in the LICENSE
|
||||
file.
|
||||
|
||||
14
vendor/github.com/vmware/vic/lib/apiservers/engine/errors/errors.go
generated
vendored
14
vendor/github.com/vmware/vic/lib/apiservers/engine/errors/errors.go
generated
vendored
@@ -34,6 +34,14 @@ func (e InvalidVolumeError) Error() string {
|
||||
return fmt.Sprintf("mounting directories as a data volume is not supported.")
|
||||
}
|
||||
|
||||
type VolumeExistError struct {
|
||||
Volume string
|
||||
}
|
||||
|
||||
func (e VolumeExistError) Error() string {
|
||||
return fmt.Sprintf("A volume named %s already exists. Choose a different volume name.", e.Volume)
|
||||
}
|
||||
|
||||
// InvalidBindError is returned when create/run -v has more params than allowed.
|
||||
type InvalidBindError struct {
|
||||
Volume string
|
||||
@@ -187,6 +195,12 @@ func IsServerNotReady(err error) bool {
|
||||
return ok
|
||||
}
|
||||
|
||||
func IsVolumeExistError(err error) bool {
|
||||
_, ok := err.(VolumeExistError)
|
||||
|
||||
return ok
|
||||
}
|
||||
|
||||
type DetachError struct{}
|
||||
|
||||
func (DetachError) Error() string {
|
||||
|
||||
18
vendor/github.com/vmware/vic/lib/apiservers/engine/proxy/archive_proxy.go
generated
vendored
18
vendor/github.com/vmware/vic/lib/apiservers/engine/proxy/archive_proxy.go
generated
vendored
@@ -33,7 +33,7 @@ import (
|
||||
"github.com/docker/docker/api/types"
|
||||
)
|
||||
|
||||
type VicArchiveProxy interface {
|
||||
type ArchiveProxy interface {
|
||||
ArchiveExportReader(op trace.Operation, store, ancestorStore, deviceID, ancestor string, data bool, filterSpec archive.FilterSpec) (io.ReadCloser, error)
|
||||
ArchiveImportWriter(op trace.Operation, store, deviceID string, filterSpec archive.FilterSpec, wg *sync.WaitGroup, errchan chan error) (io.WriteCloser, error)
|
||||
StatPath(op trace.Operation, store, deviceID string, filterSpec archive.FilterSpec) (*types.ContainerPathStat, error)
|
||||
@@ -43,23 +43,23 @@ type VicArchiveProxy interface {
|
||||
// ArchiveProxy
|
||||
//------------------------------------
|
||||
|
||||
type ArchiveProxy struct {
|
||||
type VicArchiveProxy struct {
|
||||
client *client.PortLayer
|
||||
}
|
||||
|
||||
var archiveProxy *ArchiveProxy
|
||||
var archiveProxy *VicArchiveProxy
|
||||
|
||||
func NewArchiveProxy(client *client.PortLayer) VicArchiveProxy {
|
||||
return &ArchiveProxy{client: client}
|
||||
func NewArchiveProxy(client *client.PortLayer) *VicArchiveProxy {
|
||||
return &VicArchiveProxy{client: client}
|
||||
}
|
||||
|
||||
func GetArchiveProxy() VicArchiveProxy {
|
||||
func GetArchiveProxy() ArchiveProxy {
|
||||
return archiveProxy
|
||||
}
|
||||
|
||||
// ArchiveExportReader streams a tar archive from the portlayer. Once the stream is complete,
|
||||
// an io.Reader is returned and the caller can use that reader to parse the data.
|
||||
func (a *ArchiveProxy) ArchiveExportReader(op trace.Operation, store, ancestorStore, deviceID, ancestor string, data bool, filterSpec archive.FilterSpec) (io.ReadCloser, error) {
|
||||
func (a *VicArchiveProxy) ArchiveExportReader(op trace.Operation, store, ancestorStore, deviceID, ancestor string, data bool, filterSpec archive.FilterSpec) (io.ReadCloser, error) {
|
||||
defer trace.End(trace.Begin(deviceID))
|
||||
|
||||
if a.client == nil {
|
||||
@@ -141,7 +141,7 @@ func (a *ArchiveProxy) ArchiveExportReader(op trace.Operation, store, ancestorSt
|
||||
|
||||
// ArchiveImportWriter initializes a write stream for a path. This is usually called
|
||||
// for getting a writer during docker cp TO container.
|
||||
func (a *ArchiveProxy) ArchiveImportWriter(op trace.Operation, store, deviceID string, filterSpec archive.FilterSpec, wg *sync.WaitGroup, errchan chan error) (io.WriteCloser, error) {
|
||||
func (a *VicArchiveProxy) ArchiveImportWriter(op trace.Operation, store, deviceID string, filterSpec archive.FilterSpec, wg *sync.WaitGroup, errchan chan error) (io.WriteCloser, error) {
|
||||
defer trace.End(trace.Begin(deviceID))
|
||||
|
||||
if a.client == nil {
|
||||
@@ -232,7 +232,7 @@ func (a *ArchiveProxy) ArchiveImportWriter(op trace.Operation, store, deviceID s
|
||||
|
||||
// StatPath requests the portlayer to stat the filesystem resource at the
|
||||
// specified path in the container vc.
|
||||
func (a *ArchiveProxy) StatPath(op trace.Operation, store, deviceID string, filterSpec archive.FilterSpec) (*types.ContainerPathStat, error) {
|
||||
func (a *VicArchiveProxy) StatPath(op trace.Operation, store, deviceID string, filterSpec archive.FilterSpec) (*types.ContainerPathStat, error) {
|
||||
defer trace.End(trace.Begin(deviceID))
|
||||
|
||||
if a.client == nil {
|
||||
|
||||
247
vendor/github.com/vmware/vic/lib/apiservers/engine/proxy/container_proxy.go
generated
vendored
247
vendor/github.com/vmware/vic/lib/apiservers/engine/proxy/container_proxy.go
generated
vendored
@@ -74,7 +74,7 @@ import (
|
||||
)
|
||||
|
||||
// VicContainerProxy interface
|
||||
type VicContainerProxy interface {
|
||||
type ContainerProxy interface {
|
||||
CreateContainerHandle(ctx context.Context, vc *viccontainer.VicContainer, config types.ContainerCreateConfig) (string, string, error)
|
||||
AddImageToContainer(ctx context.Context, handle string, deltaID string, layerID string, imageID string, config types.ContainerCreateConfig) (string, error)
|
||||
CreateContainerTask(ctx context.Context, handle string, id string, layerID string, config types.ContainerCreateConfig) (string, error)
|
||||
@@ -91,7 +91,7 @@ type VicContainerProxy interface {
|
||||
// TODO: we should not be returning a swagger model here, however we do not have a solid architected return for this yet.
|
||||
InspectTask(op trace.Operation, handle string, eid string, cid string) (*models.TaskInspectResponse, error)
|
||||
BindTask(op trace.Operation, handle string, eid string) (string, error)
|
||||
WaitTask(op trace.Operation, cid string, cname string, eid string) error
|
||||
WaitTask(op trace.Operation, handle string, cid string, eid string) error
|
||||
|
||||
Handle(ctx context.Context, id, name string) (string, error)
|
||||
|
||||
@@ -108,7 +108,7 @@ type VicContainerProxy interface {
|
||||
}
|
||||
|
||||
// ContainerProxy struct
|
||||
type ContainerProxy struct {
|
||||
type VicContainerProxy struct {
|
||||
client *client.PortLayer
|
||||
portlayerAddr string
|
||||
portlayerName string
|
||||
@@ -126,20 +126,24 @@ const (
|
||||
)
|
||||
|
||||
// NewContainerProxy will create a new proxy
|
||||
func NewContainerProxy(plClient *client.PortLayer, portlayerAddr string, portlayerName string) *ContainerProxy {
|
||||
return &ContainerProxy{client: plClient, portlayerAddr: portlayerAddr, portlayerName: portlayerName}
|
||||
func NewContainerProxy(plClient *client.PortLayer, portlayerAddr string, portlayerName string) *VicContainerProxy {
|
||||
return &VicContainerProxy{client: plClient, portlayerAddr: portlayerAddr, portlayerName: portlayerName}
|
||||
}
|
||||
|
||||
// Handle retrieves a handle to a VIC container. Handles should be treated as opaque strings.
|
||||
//
|
||||
// returns:
|
||||
// (handle string, error)
|
||||
func (c *ContainerProxy) Handle(ctx context.Context, id, name string) (string, error) {
|
||||
func (c *VicContainerProxy) Handle(ctx context.Context, id, name string) (string, error) {
|
||||
op := trace.FromContext(ctx, "Handle: %s", id)
|
||||
defer trace.End(trace.Begin(name, op))
|
||||
opID := op.ID()
|
||||
|
||||
if c.client == nil {
|
||||
return "", errors.NillPortlayerClientError("ContainerProxy")
|
||||
}
|
||||
|
||||
resp, err := c.client.Containers.Get(containers.NewGetParamsWithContext(ctx).WithID(id))
|
||||
resp, err := c.client.Containers.Get(containers.NewGetParamsWithContext(ctx).WithOpID(&opID).WithID(id))
|
||||
if err != nil {
|
||||
switch err := err.(type) {
|
||||
case *containers.GetNotFound:
|
||||
@@ -158,8 +162,10 @@ func (c *ContainerProxy) Handle(ctx context.Context, id, name string) (string, e
|
||||
//
|
||||
// returns:
|
||||
// (containerID, containerHandle, error)
|
||||
func (c *ContainerProxy) CreateContainerHandle(ctx context.Context, vc *viccontainer.VicContainer, config types.ContainerCreateConfig) (string, string, error) {
|
||||
defer trace.End(trace.Begin(vc.ImageID))
|
||||
func (c *VicContainerProxy) CreateContainerHandle(ctx context.Context, vc *viccontainer.VicContainer, config types.ContainerCreateConfig) (string, string, error) {
|
||||
op := trace.FromContext(ctx, "CreateContainerHandle: %s", vc.Name)
|
||||
defer trace.End(trace.Begin(vc.Name, op))
|
||||
opID := op.ID()
|
||||
|
||||
if c.client == nil {
|
||||
return "", "", errors.NillPortlayerClientError("ContainerProxy")
|
||||
@@ -179,12 +185,12 @@ func (c *ContainerProxy) CreateContainerHandle(ctx context.Context, vc *vicconta
|
||||
return "", "", errors.InternalServerError("ContainerProxy.CreateContainerHandle got unexpected error getting VCH UUID")
|
||||
}
|
||||
|
||||
plCreateParams := dockerContainerCreateParamsToPortlayer(ctx, config, vc, host)
|
||||
plCreateParams := dockerContainerCreateParamsToPortlayer(ctx, config, vc, host).WithOpID(&opID)
|
||||
createResults, err := c.client.Containers.Create(plCreateParams)
|
||||
if err != nil {
|
||||
if _, ok := err.(*containers.CreateNotFound); ok {
|
||||
cerr := fmt.Errorf("No such image: %s", vc.ImageID)
|
||||
log.Errorf("%s (%s)", cerr, err)
|
||||
op.Errorf("%s (%s)", cerr, err)
|
||||
return "", "", errors.NotFoundError(cerr.Error())
|
||||
}
|
||||
|
||||
@@ -203,7 +209,7 @@ func (c *ContainerProxy) CreateContainerHandle(ctx context.Context, vc *vicconta
|
||||
//
|
||||
// returns:
|
||||
// modified handle
|
||||
func (c *ContainerProxy) AddImageToContainer(ctx context.Context, handle, deltaID, layerID, imageID string, config types.ContainerCreateConfig) (string, error) {
|
||||
func (c *VicContainerProxy) AddImageToContainer(ctx context.Context, handle, deltaID, layerID, imageID string, config types.ContainerCreateConfig) (string, error) {
|
||||
defer trace.End(trace.Begin(handle))
|
||||
|
||||
if c.client == nil {
|
||||
@@ -237,20 +243,23 @@ func (c *ContainerProxy) AddImageToContainer(ctx context.Context, handle, deltaI
|
||||
//
|
||||
// returns:
|
||||
// (containerHandle, error)
|
||||
func (c *ContainerProxy) CreateContainerTask(ctx context.Context, handle, id, layerID string, config types.ContainerCreateConfig) (string, error) {
|
||||
defer trace.End(trace.Begin(""))
|
||||
func (c *VicContainerProxy) CreateContainerTask(ctx context.Context, handle, id, layerID string, config types.ContainerCreateConfig) (string, error) {
|
||||
op := trace.FromContext(ctx, "CreateContainerTask: %s", id)
|
||||
defer trace.End(trace.Begin(id, op))
|
||||
opID := op.ID()
|
||||
|
||||
if c.client == nil {
|
||||
return "", errors.NillPortlayerClientError("ContainerProxy")
|
||||
}
|
||||
|
||||
plTaskParams := dockerContainerCreateParamsToTask(ctx, id, layerID, config)
|
||||
plTaskParams := dockerContainerCreateParamsToTask(op, id, layerID, config)
|
||||
plTaskParams.Config.Handle = handle
|
||||
plTaskParams.WithOpID(&opID)
|
||||
|
||||
log.Infof("*** CreateContainerTask - params = %#v", *plTaskParams.Config)
|
||||
op.Infof("*** CreateContainerTask - params = %#v", *plTaskParams.Config)
|
||||
responseJoin, err := c.client.Tasks.Join(plTaskParams)
|
||||
if err != nil {
|
||||
log.Errorf("Unable to join primary task to container: %+v", err)
|
||||
op.Errorf("Unable to join primary task to container: %+v", err)
|
||||
return "", errors.InternalServerError(err.Error())
|
||||
}
|
||||
|
||||
@@ -259,10 +268,13 @@ func (c *ContainerProxy) CreateContainerTask(ctx context.Context, handle, id, la
|
||||
return "", errors.InternalServerError(fmt.Sprintf("Type assertion failed on handle from task join: %#+v", handle))
|
||||
}
|
||||
|
||||
plBindParams := tasks.NewBindParamsWithContext(ctx).WithConfig(&models.TaskBindConfig{Handle: handle, ID: id})
|
||||
plBindParams := tasks.NewBindParamsWithContext(ctx).
|
||||
WithOpID(&opID).
|
||||
WithConfig(&models.TaskBindConfig{Handle: handle, ID: id})
|
||||
|
||||
responseBind, err := c.client.Tasks.Bind(plBindParams)
|
||||
if err != nil {
|
||||
log.Errorf("Unable to bind primary task to container: %+v", err)
|
||||
op.Errorf("Unable to bind primary task to container: %+v", err)
|
||||
return "", errors.InternalServerError(err.Error())
|
||||
}
|
||||
|
||||
@@ -274,8 +286,10 @@ func (c *ContainerProxy) CreateContainerTask(ctx context.Context, handle, id, la
|
||||
return handle, nil
|
||||
}
|
||||
|
||||
func (c *ContainerProxy) CreateExecTask(ctx context.Context, handle string, config *types.ExecConfig) (string, string, error) {
|
||||
defer trace.End(trace.Begin(""))
|
||||
func (c *VicContainerProxy) CreateExecTask(ctx context.Context, handle string, config *types.ExecConfig) (string, string, error) {
|
||||
op := trace.FromContext(ctx, "CreateExecTask: %s", handle)
|
||||
defer trace.End(trace.Begin(handle, op))
|
||||
opID := op.ID()
|
||||
|
||||
if c.client == nil {
|
||||
return "", "", errors.NillPortlayerClientError("ContainerProxy")
|
||||
@@ -293,7 +307,7 @@ func (c *ContainerProxy) CreateExecTask(ctx context.Context, handle string, conf
|
||||
}
|
||||
|
||||
// call Join with JoinParams
|
||||
joinparams := tasks.NewJoinParamsWithContext(ctx).WithConfig(joinconfig)
|
||||
joinparams := tasks.NewJoinParamsWithContext(ctx).WithOpID(&opID).WithConfig(joinconfig)
|
||||
resp, err := c.client.Tasks.Join(joinparams)
|
||||
if err != nil {
|
||||
return "", "", errors.InternalServerError(err.Error())
|
||||
@@ -313,18 +327,21 @@ func (c *ContainerProxy) CreateExecTask(ctx context.Context, handle string, conf
|
||||
//
|
||||
// returns:
|
||||
// modified handle
|
||||
func (c *ContainerProxy) AddContainerToScope(ctx context.Context, handle string, config types.ContainerCreateConfig) (string, error) {
|
||||
defer trace.End(trace.Begin(handle))
|
||||
func (c *VicContainerProxy) AddContainerToScope(ctx context.Context, handle string, config types.ContainerCreateConfig) (string, error) {
|
||||
op := trace.FromContext(ctx, "AddContainerToScope: %s", handle)
|
||||
defer trace.End(trace.Begin(handle, op))
|
||||
opID := op.ID()
|
||||
|
||||
if c.client == nil {
|
||||
return "", errors.NillPortlayerClientError("ContainerProxy")
|
||||
}
|
||||
|
||||
log.Debugf("Network Configuration Section - Container Create")
|
||||
op.Debugf("Network Configuration Section - Container Create")
|
||||
// configure network
|
||||
netConf := toModelsNetworkConfig(config)
|
||||
if netConf != nil {
|
||||
addContRes, err := c.client.Scopes.AddContainer(scopes.NewAddContainerParamsWithContext(ctx).
|
||||
WithOpID(&opID).
|
||||
WithScope(netConf.NetworkName).
|
||||
WithConfig(&models.ScopesAddContainerConfig{
|
||||
Handle: handle,
|
||||
@@ -332,7 +349,7 @@ func (c *ContainerProxy) AddContainerToScope(ctx context.Context, handle string,
|
||||
}))
|
||||
|
||||
if err != nil {
|
||||
log.Errorf("ContainerProxy.AddContainerToScope: Scopes error: %s", err.Error())
|
||||
op.Errorf("ContainerProxy.AddContainerToScope: Scopes error: %s", err.Error())
|
||||
return handle, errors.InternalServerError(err.Error())
|
||||
}
|
||||
|
||||
@@ -341,8 +358,11 @@ func (c *ContainerProxy) AddContainerToScope(ctx context.Context, handle string,
|
||||
return
|
||||
}
|
||||
// roll back the AddContainer call
|
||||
if _, err2 := c.client.Scopes.RemoveContainer(scopes.NewRemoveContainerParamsWithContext(ctx).WithHandle(handle).WithScope(netConf.NetworkName)); err2 != nil {
|
||||
log.Warnf("could not roll back container add: %s", err2)
|
||||
if _, err2 := c.client.Scopes.RemoveContainer(scopes.NewRemoveContainerParamsWithContext(ctx).
|
||||
WithHandle(handle).
|
||||
WithScope(netConf.NetworkName).
|
||||
WithOpID(&opID)); err2 != nil {
|
||||
op.Warnf("could not roll back container add: %s", err2)
|
||||
}
|
||||
}()
|
||||
|
||||
@@ -357,14 +377,17 @@ func (c *ContainerProxy) AddContainerToScope(ctx context.Context, handle string,
|
||||
//
|
||||
// returns:
|
||||
// modified handle
|
||||
func (c *ContainerProxy) AddLoggingToContainer(ctx context.Context, handle string, config types.ContainerCreateConfig) (string, error) {
|
||||
defer trace.End(trace.Begin(handle))
|
||||
func (c *VicContainerProxy) AddLoggingToContainer(ctx context.Context, handle string, config types.ContainerCreateConfig) (string, error) {
|
||||
op := trace.FromContext(ctx, "AddLoggingToContainer: %s", handle)
|
||||
defer trace.End(trace.Begin(handle, op))
|
||||
opID := op.ID()
|
||||
|
||||
if c.client == nil {
|
||||
return "", errors.NillPortlayerClientError("ContainerProxy")
|
||||
}
|
||||
|
||||
response, err := c.client.Logging.LoggingJoin(logging.NewLoggingJoinParamsWithContext(ctx).
|
||||
WithOpID(&opID).
|
||||
WithConfig(&models.LoggingJoinConfig{
|
||||
Handle: handle,
|
||||
}))
|
||||
@@ -384,14 +407,17 @@ func (c *ContainerProxy) AddLoggingToContainer(ctx context.Context, handle strin
|
||||
//
|
||||
// returns:
|
||||
// modified handle
|
||||
func (c *ContainerProxy) AddInteractionToContainer(ctx context.Context, handle string, config types.ContainerCreateConfig) (string, error) {
|
||||
defer trace.End(trace.Begin(handle))
|
||||
func (c *VicContainerProxy) AddInteractionToContainer(ctx context.Context, handle string, config types.ContainerCreateConfig) (string, error) {
|
||||
op := trace.FromContext(ctx, "AddLoggingToContainer: %s", handle)
|
||||
defer trace.End(trace.Begin(handle, op))
|
||||
opID := op.ID()
|
||||
|
||||
if c.client == nil {
|
||||
return "", errors.NillPortlayerClientError("ContainerProxy")
|
||||
}
|
||||
|
||||
response, err := c.client.Interaction.InteractionJoin(interaction.NewInteractionJoinParamsWithContext(ctx).
|
||||
WithOpID(&opID).
|
||||
WithConfig(&models.InteractionJoinConfig{
|
||||
Handle: handle,
|
||||
}))
|
||||
@@ -407,8 +433,10 @@ func (c *ContainerProxy) AddInteractionToContainer(ctx context.Context, handle s
|
||||
}
|
||||
|
||||
// BindInteraction enables interaction capabilities
|
||||
func (c *ContainerProxy) BindInteraction(ctx context.Context, handle string, name string, id string) (string, error) {
|
||||
defer trace.End(trace.Begin(handle))
|
||||
func (c *VicContainerProxy) BindInteraction(ctx context.Context, handle string, name string, id string) (string, error) {
|
||||
op := trace.FromContext(ctx, "BindInteraction: %s", handle)
|
||||
defer trace.End(trace.Begin(handle, op))
|
||||
opID := op.ID()
|
||||
|
||||
if c.client == nil {
|
||||
return "", errors.NillPortlayerClientError("ContainerProxy")
|
||||
@@ -416,6 +444,7 @@ func (c *ContainerProxy) BindInteraction(ctx context.Context, handle string, nam
|
||||
|
||||
bind, err := c.client.Interaction.InteractionBind(
|
||||
interaction.NewInteractionBindParamsWithContext(ctx).
|
||||
WithOpID(&opID).
|
||||
WithConfig(&models.InteractionBindConfig{
|
||||
Handle: handle,
|
||||
ID: id,
|
||||
@@ -436,8 +465,10 @@ func (c *ContainerProxy) BindInteraction(ctx context.Context, handle string, nam
|
||||
}
|
||||
|
||||
// UnbindInteraction disables interaction capabilities
|
||||
func (c *ContainerProxy) UnbindInteraction(ctx context.Context, handle string, name string, id string) (string, error) {
|
||||
defer trace.End(trace.Begin(handle))
|
||||
func (c *VicContainerProxy) UnbindInteraction(ctx context.Context, handle string, name string, id string) (string, error) {
|
||||
op := trace.FromContext(ctx, "UnbindInteraction: %s", handle)
|
||||
defer trace.End(trace.Begin(handle, op))
|
||||
opID := op.ID()
|
||||
|
||||
if c.client == nil {
|
||||
return "", errors.NillPortlayerClientError("ContainerProxy")
|
||||
@@ -445,6 +476,7 @@ func (c *ContainerProxy) UnbindInteraction(ctx context.Context, handle string, n
|
||||
|
||||
unbind, err := c.client.Interaction.InteractionUnbind(
|
||||
interaction.NewInteractionUnbindParamsWithContext(ctx).
|
||||
WithOpID(&opID).
|
||||
WithConfig(&models.InteractionUnbindConfig{
|
||||
Handle: handle,
|
||||
ID: id,
|
||||
@@ -464,18 +496,21 @@ func (c *ContainerProxy) UnbindInteraction(ctx context.Context, handle string, n
|
||||
//
|
||||
// Args:
|
||||
// waitTime <= 0 means no wait time
|
||||
func (c *ContainerProxy) CommitContainerHandle(ctx context.Context, handle, containerID string, waitTime int32) error {
|
||||
defer trace.End(trace.Begin(handle))
|
||||
func (c *VicContainerProxy) CommitContainerHandle(ctx context.Context, handle, containerID string, waitTime int32) error {
|
||||
op := trace.FromContext(ctx, "CommitContainerHandle: %s", handle)
|
||||
defer trace.End(trace.Begin(handle, op))
|
||||
opID := op.ID()
|
||||
|
||||
if c.client == nil {
|
||||
return errors.NillPortlayerClientError("ContainerProxy")
|
||||
}
|
||||
|
||||
var commitParams *containers.CommitParams
|
||||
commitParams := containers.NewCommitParamsWithContext(ctx).
|
||||
WithOpID(&opID).
|
||||
WithHandle(handle)
|
||||
|
||||
if waitTime > 0 {
|
||||
commitParams = containers.NewCommitParamsWithContext(ctx).WithHandle(handle).WithWaitTime(&waitTime)
|
||||
} else {
|
||||
commitParams = containers.NewCommitParamsWithContext(ctx).WithHandle(handle)
|
||||
commitParams.WithWaitTime(&waitTime)
|
||||
}
|
||||
|
||||
_, err := c.client.Containers.Commit(commitParams)
|
||||
@@ -495,8 +530,9 @@ func (c *ContainerProxy) CommitContainerHandle(ctx context.Context, handle, cont
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *ContainerProxy) InspectTask(op trace.Operation, handle string, eid string, cid string) (*models.TaskInspectResponse, error) {
|
||||
defer trace.End(trace.Begin(fmt.Sprintf("handle(%s), eid(%s), cid(%s)", handle, eid, cid)))
|
||||
func (c *VicContainerProxy) InspectTask(op trace.Operation, handle string, eid string, cid string) (*models.TaskInspectResponse, error) {
|
||||
defer trace.End(trace.Begin(fmt.Sprintf("handle(%s), eid(%s), cid(%s)", handle, eid, cid), op))
|
||||
opID := op.ID()
|
||||
|
||||
if c.client == nil {
|
||||
return nil, errors.NillPortlayerClientError("ContainerProxy")
|
||||
@@ -510,7 +546,7 @@ func (c *ContainerProxy) InspectTask(op trace.Operation, handle string, eid stri
|
||||
|
||||
// FIXME: right now we are only using this path for exec targets. But later the error messages may need to be changed
|
||||
// to be more accurate.
|
||||
params := tasks.NewInspectParamsWithContext(op).WithConfig(config)
|
||||
params := tasks.NewInspectParamsWithContext(op).WithOpID(&opID).WithConfig(config)
|
||||
resp, err := c.client.Tasks.Inspect(params)
|
||||
if err != nil {
|
||||
switch err := err.(type) {
|
||||
@@ -529,8 +565,9 @@ func (c *ContainerProxy) InspectTask(op trace.Operation, handle string, eid stri
|
||||
return resp.Payload, nil
|
||||
}
|
||||
|
||||
func (c *ContainerProxy) BindTask(op trace.Operation, handle string, eid string) (string, error) {
|
||||
defer trace.End(trace.Begin(fmt.Sprintf("handle(%s), eid(%s)", handle, eid)))
|
||||
func (c *VicContainerProxy) BindTask(op trace.Operation, handle string, eid string) (string, error) {
|
||||
defer trace.End(trace.Begin(fmt.Sprintf("handle(%s), eid(%s)", handle, eid), op))
|
||||
opID := op.ID()
|
||||
|
||||
if c.client == nil {
|
||||
return "", errors.NillPortlayerClientError("ContainerProxy")
|
||||
@@ -540,7 +577,7 @@ func (c *ContainerProxy) BindTask(op trace.Operation, handle string, eid string)
|
||||
Handle: handle,
|
||||
ID: eid,
|
||||
}
|
||||
bindparams := tasks.NewBindParamsWithContext(op).WithConfig(bindconfig)
|
||||
bindparams := tasks.NewBindParamsWithContext(op).WithOpID(&opID).WithConfig(bindconfig)
|
||||
|
||||
// call Bind with bindparams
|
||||
resp, err := c.client.Tasks.Bind(bindparams)
|
||||
@@ -569,28 +606,26 @@ func (c *ContainerProxy) BindTask(op trace.Operation, handle string, eid string)
|
||||
return respHandle, nil
|
||||
}
|
||||
|
||||
func (c *ContainerProxy) WaitTask(op trace.Operation, cid string, cname string, eid string) error {
|
||||
func (c *VicContainerProxy) WaitTask(op trace.Operation, handle string, cid string, eid string) error {
|
||||
defer trace.End(trace.Begin(fmt.Sprintf("handle(%s), cid(%s)", handle, cid), op))
|
||||
opID := op.ID()
|
||||
|
||||
if c.client == nil {
|
||||
return errors.NillPortlayerClientError("ContainerProxy")
|
||||
}
|
||||
|
||||
handle, err := c.Handle(op, cid, cname)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// wait the Task to start
|
||||
// wait for the Task to change in state
|
||||
config := &models.TaskWaitConfig{
|
||||
Handle: handle,
|
||||
ID: eid,
|
||||
}
|
||||
|
||||
params := tasks.NewWaitParamsWithContext(op).WithConfig(config)
|
||||
_, err = c.client.Tasks.Wait(params)
|
||||
params := tasks.NewWaitParamsWithContext(op).WithOpID(&opID).WithConfig(config)
|
||||
_, err := c.client.Tasks.Wait(params)
|
||||
if err != nil {
|
||||
switch err := err.(type) {
|
||||
case *tasks.WaitNotFound:
|
||||
return errors.InternalServerError(fmt.Sprintf("the Container(%s) has been shutdown during execution of the exec operation", cid))
|
||||
return errors.InternalServerError(fmt.Sprintf("the container(%s) has been shutdown during execution of the exec operation", cid))
|
||||
case *tasks.WaitPreconditionRequired:
|
||||
return errors.InternalServerError(fmt.Sprintf("container(%s) must be powered on in order to perform the desired exec operation", cid))
|
||||
case *tasks.WaitInternalServerError:
|
||||
@@ -608,8 +643,10 @@ func (c *ContainerProxy) WaitTask(op trace.Operation, cid string, cname string,
|
||||
//
|
||||
// returns
|
||||
// error
|
||||
func (c *ContainerProxy) Stop(ctx context.Context, vc *viccontainer.VicContainer, name string, seconds *int, unbound bool) error {
|
||||
defer trace.End(trace.Begin(vc.ContainerID))
|
||||
func (c *VicContainerProxy) Stop(ctx context.Context, vc *viccontainer.VicContainer, name string, seconds *int, unbound bool) error {
|
||||
op := trace.FromContext(ctx, "Stop: %s", name)
|
||||
defer trace.End(trace.Begin(fmt.Sprintf("Name: %s, container id: %s", name, vc.ContainerID), op))
|
||||
opID := op.ID()
|
||||
|
||||
if c.client == nil {
|
||||
return errors.NillPortlayerClientError("ContainerProxy")
|
||||
@@ -648,7 +685,11 @@ func (c *ContainerProxy) Stop(ctx context.Context, vc *viccontainer.VicContainer
|
||||
}
|
||||
|
||||
// change the state of the container
|
||||
changeParams := containers.NewStateChangeParamsWithContext(ctx).WithHandle(handle).WithState("STOPPED")
|
||||
changeParams := containers.NewStateChangeParamsWithContext(ctx).
|
||||
WithOpID(&opID).
|
||||
WithHandle(handle).
|
||||
WithState("STOPPED")
|
||||
|
||||
stateChangeResponse, err := c.client.Containers.StateChange(changeParams)
|
||||
if err != nil {
|
||||
switch err := err.(type) {
|
||||
@@ -682,20 +723,22 @@ func (c *ContainerProxy) Stop(ctx context.Context, vc *viccontainer.VicContainer
|
||||
}
|
||||
|
||||
// UnbindContainerFromNetwork unbinds a container from the networks that it connects to
|
||||
func (c *ContainerProxy) UnbindContainerFromNetwork(ctx context.Context, vc *viccontainer.VicContainer, handle string) (string, error) {
|
||||
defer trace.End(trace.Begin(vc.ContainerID))
|
||||
func (c *VicContainerProxy) UnbindContainerFromNetwork(ctx context.Context, vc *viccontainer.VicContainer, handle string) (string, error) {
|
||||
op := trace.FromContext(ctx, "UnbindContainerFromNetwork: %s", vc.ContainerID)
|
||||
defer trace.End(trace.Begin(vc.ContainerID, op))
|
||||
opID := op.ID()
|
||||
|
||||
if c.client == nil {
|
||||
return "", errors.NillPortlayerClientError("ContainerProxy")
|
||||
}
|
||||
|
||||
unbindParams := scopes.NewUnbindContainerParamsWithContext(ctx).WithHandle(handle)
|
||||
unbindParams := scopes.NewUnbindContainerParamsWithContext(ctx).WithOpID(&opID).WithHandle(handle)
|
||||
ub, err := c.client.Scopes.UnbindContainer(unbindParams)
|
||||
if err != nil {
|
||||
switch err := err.(type) {
|
||||
case *scopes.UnbindContainerNotFound:
|
||||
// ignore error
|
||||
log.Warnf("Container %s not found by network unbind", vc.ContainerID)
|
||||
op.Warnf("Container %s not found by network unbind", vc.ContainerID)
|
||||
case *scopes.UnbindContainerInternalServerError:
|
||||
return "", errors.InternalServerError(err.Payload.Message)
|
||||
default:
|
||||
@@ -707,14 +750,18 @@ func (c *ContainerProxy) UnbindContainerFromNetwork(ctx context.Context, vc *vic
|
||||
}
|
||||
|
||||
// State returns container state
|
||||
func (c *ContainerProxy) State(ctx context.Context, vc *viccontainer.VicContainer) (*types.ContainerState, error) {
|
||||
defer trace.End(trace.Begin(""))
|
||||
func (c *VicContainerProxy) State(ctx context.Context, vc *viccontainer.VicContainer) (*types.ContainerState, error) {
|
||||
op := trace.FromContext(ctx, "State: %s", vc.ContainerID)
|
||||
defer trace.End(trace.Begin(vc.ContainerID, op))
|
||||
opID := op.ID()
|
||||
|
||||
if c.client == nil {
|
||||
return nil, errors.NillPortlayerClientError("ContainerProxy")
|
||||
}
|
||||
|
||||
results, err := c.client.Containers.GetContainerInfo(containers.NewGetContainerInfoParamsWithContext(ctx).WithID(vc.ContainerID))
|
||||
results, err := c.client.Containers.GetContainerInfo(containers.NewGetContainerInfoParamsWithContext(ctx).
|
||||
WithOpID(&opID).
|
||||
WithID(vc.ContainerID))
|
||||
if err != nil {
|
||||
switch err := err.(type) {
|
||||
case *containers.GetContainerInfoNotFound:
|
||||
@@ -734,14 +781,15 @@ func (c *ContainerProxy) State(ctx context.Context, vc *viccontainer.VicContaine
|
||||
}
|
||||
|
||||
// GetStateFromHandle takes a handle and returns the state of the container based on that handle. Also returns handle that comes back with the response.
|
||||
func (c *ContainerProxy) GetStateFromHandle(op trace.Operation, handle string) (string, string, error) {
|
||||
func (c *VicContainerProxy) GetStateFromHandle(op trace.Operation, handle string) (string, string, error) {
|
||||
defer trace.End(trace.Begin(fmt.Sprintf("handle(%s)", handle), op))
|
||||
opID := op.ID()
|
||||
|
||||
if c.client == nil {
|
||||
return "", "", errors.NillPortlayerClientError("ContainerProxy")
|
||||
}
|
||||
|
||||
params := containers.NewGetStateParams().WithHandle(handle)
|
||||
params := containers.NewGetStateParams().WithOpID(&opID).WithHandle(handle)
|
||||
resp, err := c.client.Containers.GetState(params)
|
||||
if err != nil {
|
||||
switch err := err.(type) {
|
||||
@@ -756,14 +804,19 @@ func (c *ContainerProxy) GetStateFromHandle(op trace.Operation, handle string) (
|
||||
}
|
||||
|
||||
// ExitCode returns container exitCode
|
||||
func (c *ContainerProxy) ExitCode(ctx context.Context, vc *viccontainer.VicContainer) (string, error) {
|
||||
defer trace.End(trace.Begin(""))
|
||||
func (c *VicContainerProxy) ExitCode(ctx context.Context, vc *viccontainer.VicContainer) (string, error) {
|
||||
op := trace.FromContext(ctx, "ExitCode: %s", vc.ContainerID)
|
||||
defer trace.End(trace.Begin(vc.ContainerID, op))
|
||||
opID := op.ID()
|
||||
|
||||
if c.client == nil {
|
||||
return "", errors.NillPortlayerClientError("ContainerProxy")
|
||||
}
|
||||
|
||||
results, err := c.client.Containers.GetContainerInfo(containers.NewGetContainerInfoParamsWithContext(ctx).WithID(vc.ContainerID))
|
||||
results, err := c.client.Containers.GetContainerInfo(containers.NewGetContainerInfoParamsWithContext(ctx).
|
||||
WithOpID(&opID).
|
||||
WithID(vc.ContainerID))
|
||||
|
||||
if err != nil {
|
||||
switch err := err.(type) {
|
||||
case *containers.GetContainerInfoNotFound:
|
||||
@@ -783,8 +836,11 @@ func (c *ContainerProxy) ExitCode(ctx context.Context, vc *viccontainer.VicConta
|
||||
return strconv.Itoa(dockerState.ExitCode), nil
|
||||
}
|
||||
|
||||
func (c *ContainerProxy) Wait(ctx context.Context, vc *viccontainer.VicContainer, timeout time.Duration) (
|
||||
func (c *VicContainerProxy) Wait(ctx context.Context, vc *viccontainer.VicContainer, timeout time.Duration) (
|
||||
*types.ContainerState, error) {
|
||||
op := trace.FromContext(ctx, "Wait: %s", vc.ContainerID)
|
||||
defer trace.End(trace.Begin(vc.ContainerID, op))
|
||||
opID := op.ID()
|
||||
|
||||
defer trace.End(trace.Begin(vc.ContainerID))
|
||||
|
||||
@@ -798,8 +854,10 @@ func (c *ContainerProxy) Wait(ctx context.Context, vc *viccontainer.VicContainer
|
||||
}
|
||||
|
||||
params := containers.NewContainerWaitParamsWithContext(ctx).
|
||||
WithOpID(&opID).
|
||||
WithTimeout(int64(timeout.Seconds())).
|
||||
WithID(vc.ContainerID)
|
||||
|
||||
results, err := c.client.Containers.ContainerWait(params)
|
||||
if err != nil {
|
||||
switch err := err.(type) {
|
||||
@@ -826,8 +884,10 @@ func (c *ContainerProxy) Wait(ctx context.Context, vc *viccontainer.VicContainer
|
||||
return dockerState, nil
|
||||
}
|
||||
|
||||
func (c *ContainerProxy) Signal(ctx context.Context, vc *viccontainer.VicContainer, sig uint64) error {
|
||||
defer trace.End(trace.Begin(vc.ContainerID))
|
||||
func (c *VicContainerProxy) Signal(ctx context.Context, vc *viccontainer.VicContainer, sig uint64) error {
|
||||
op := trace.FromContext(ctx, "Signal: %s", vc.ContainerID)
|
||||
defer trace.End(trace.Begin(vc.ContainerID, op))
|
||||
opID := op.ID()
|
||||
|
||||
if vc == nil {
|
||||
return errors.InternalServerError("Signal bad arguments")
|
||||
@@ -845,7 +905,11 @@ func (c *ContainerProxy) Signal(ctx context.Context, vc *viccontainer.VicContain
|
||||
if sig == 0 {
|
||||
sig = uint64(syscall.SIGKILL)
|
||||
}
|
||||
params := containers.NewContainerSignalParamsWithContext(ctx).WithID(vc.ContainerID).WithSignal(int64(sig))
|
||||
params := containers.NewContainerSignalParamsWithContext(ctx).
|
||||
WithOpID(&opID).
|
||||
WithID(vc.ContainerID).
|
||||
WithSignal(int64(sig))
|
||||
|
||||
if _, err := c.client.Containers.ContainerSignal(params); err != nil {
|
||||
switch err := err.(type) {
|
||||
case *containers.ContainerSignalNotFound:
|
||||
@@ -867,7 +931,11 @@ func (c *ContainerProxy) Signal(ctx context.Context, vc *viccontainer.VicContain
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *ContainerProxy) Resize(ctx context.Context, id string, height, width int32) error {
|
||||
func (c *VicContainerProxy) Resize(ctx context.Context, id string, height, width int32) error {
|
||||
op := trace.FromContext(ctx, "Resize: %s", id)
|
||||
defer trace.End(trace.Begin(id, op))
|
||||
opID := op.ID()
|
||||
|
||||
defer trace.End(trace.Begin(id))
|
||||
|
||||
if c.client == nil {
|
||||
@@ -875,6 +943,7 @@ func (c *ContainerProxy) Resize(ctx context.Context, id string, height, width in
|
||||
}
|
||||
|
||||
plResizeParam := interaction.NewContainerResizeParamsWithContext(ctx).
|
||||
WithOpID(&opID).
|
||||
WithID(id).
|
||||
WithHeight(height).
|
||||
WithWidth(width)
|
||||
@@ -894,8 +963,10 @@ func (c *ContainerProxy) Resize(ctx context.Context, id string, height, width in
|
||||
|
||||
// Rename calls the portlayer's RenameContainerHandler to update the container name in the handle,
|
||||
// and then commit the new name to vSphere
|
||||
func (c *ContainerProxy) Rename(ctx context.Context, vc *viccontainer.VicContainer, newName string) error {
|
||||
defer trace.End(trace.Begin(vc.ContainerID))
|
||||
func (c *VicContainerProxy) Rename(ctx context.Context, vc *viccontainer.VicContainer, newName string) error {
|
||||
op := trace.FromContext(ctx, "Rename: %s", vc.ContainerID)
|
||||
defer trace.End(trace.Begin(vc.ContainerID, op))
|
||||
opID := op.ID()
|
||||
|
||||
//retrieve client to portlayer
|
||||
handle, err := c.Handle(context.TODO(), vc.ContainerID, vc.Name)
|
||||
@@ -908,7 +979,11 @@ func (c *ContainerProxy) Rename(ctx context.Context, vc *viccontainer.VicContain
|
||||
}
|
||||
|
||||
// Call the rename functionality in the portlayer.
|
||||
renameParams := containers.NewContainerRenameParamsWithContext(ctx).WithName(newName).WithHandle(handle)
|
||||
renameParams := containers.NewContainerRenameParamsWithContext(ctx).
|
||||
WithOpID(&opID).
|
||||
WithName(newName).
|
||||
WithHandle(handle)
|
||||
|
||||
result, err := c.client.Containers.ContainerRename(renameParams)
|
||||
if err != nil {
|
||||
switch err := err.(type) {
|
||||
@@ -942,15 +1017,19 @@ func (c *ContainerProxy) Rename(ctx context.Context, vc *viccontainer.VicContain
|
||||
|
||||
// Remove calls the portlayer's ContainerRemove handler to remove the container and its
|
||||
// anonymous volumes if the remove flag is set.
|
||||
func (c *ContainerProxy) Remove(ctx context.Context, vc *viccontainer.VicContainer, config *types.ContainerRmConfig) error {
|
||||
defer trace.End(trace.Begin(vc.ContainerID))
|
||||
func (c *VicContainerProxy) Remove(ctx context.Context, vc *viccontainer.VicContainer, config *types.ContainerRmConfig) error {
|
||||
op := trace.FromContext(ctx, "Remove: %s", vc.ContainerID)
|
||||
defer trace.End(trace.Begin(vc.ContainerID, op))
|
||||
opID := op.ID()
|
||||
|
||||
if c.client == nil {
|
||||
return errors.NillPortlayerClientError("ContainerProxy")
|
||||
}
|
||||
|
||||
id := vc.ContainerID
|
||||
_, err := c.client.Containers.ContainerRemove(containers.NewContainerRemoveParamsWithContext(ctx).WithID(id))
|
||||
_, err := c.client.Containers.ContainerRemove(containers.NewContainerRemoveParamsWithContext(ctx).
|
||||
WithOpID(&opID).
|
||||
WithID(id))
|
||||
if err != nil {
|
||||
switch err := err.(type) {
|
||||
case *containers.ContainerRemoveNotFound:
|
||||
|
||||
213
vendor/github.com/vmware/vic/lib/apiservers/engine/proxy/storage_proxy.go
generated
vendored
213
vendor/github.com/vmware/vic/lib/apiservers/engine/proxy/storage_proxy.go
generated
vendored
@@ -39,20 +39,22 @@ import (
|
||||
"github.com/vmware/vic/pkg/trace"
|
||||
)
|
||||
|
||||
type VicStorageProxy interface {
|
||||
type StorageProxy interface {
|
||||
Create(ctx context.Context, name, driverName string, volumeData, labels map[string]string) (*types.Volume, error)
|
||||
VolumeExist(ctx context.Context, name string) (bool, error)
|
||||
VolumeList(ctx context.Context, filter string) ([]*models.VolumeResponse, error)
|
||||
VolumeInfo(ctx context.Context, name string) (*models.VolumeResponse, error)
|
||||
Remove(ctx context.Context, name string) error
|
||||
|
||||
VolumeJoin(ctx context.Context, handle, volName, mountPath string, flags map[string]string) (string, error)
|
||||
AddVolumesToContainer(ctx context.Context, handle string, config types.ContainerCreateConfig) (string, error)
|
||||
}
|
||||
|
||||
type StorageProxy struct {
|
||||
type VicStorageProxy struct {
|
||||
client *client.PortLayer
|
||||
}
|
||||
|
||||
type volumeFields struct {
|
||||
type VolumeFields struct {
|
||||
ID string
|
||||
Dest string
|
||||
Flags string
|
||||
@@ -96,26 +98,27 @@ var SupportedVolDrivers = map[string]struct{}{
|
||||
//Validation pattern for Volume Names
|
||||
var volumeNameRegex = regexp.MustCompile("^[a-zA-Z0-9][a-zA-Z0-9_.-]*$")
|
||||
|
||||
func NewStorageProxy(client *client.PortLayer) VicStorageProxy {
|
||||
func NewStorageProxy(client *client.PortLayer) *VicStorageProxy {
|
||||
if client == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
return &StorageProxy{client: client}
|
||||
return &VicStorageProxy{client: client}
|
||||
}
|
||||
|
||||
func (s *StorageProxy) Create(ctx context.Context, name, driverName string, volumeData, labels map[string]string) (*types.Volume, error) {
|
||||
defer trace.End(trace.Begin(""))
|
||||
func (s *VicStorageProxy) Create(ctx context.Context, name, driverName string, volumeData, labels map[string]string) (*types.Volume, error) {
|
||||
op := trace.FromContext(ctx, "VolumeCreate: %s", name)
|
||||
defer trace.End(trace.Begin(name, op))
|
||||
|
||||
if s.client == nil {
|
||||
return nil, errors.NillPortlayerClientError("StorageProxy")
|
||||
}
|
||||
|
||||
result, err := s.volumeCreate(ctx, name, driverName, volumeData, labels)
|
||||
result, err := s.volumeCreate(op, name, driverName, volumeData, labels)
|
||||
if err != nil {
|
||||
switch err := err.(type) {
|
||||
case *storage.CreateVolumeConflict:
|
||||
return result, errors.VolumeInternalServerError(fmt.Errorf("A volume named %s already exists. Choose a different volume name.", name))
|
||||
return result, errors.VolumeExistError{Volume: name}
|
||||
case *storage.CreateVolumeNotFound:
|
||||
return result, errors.VolumeInternalServerError(fmt.Errorf("No volume store named (%s) exists", volumeStore(volumeData)))
|
||||
case *storage.CreateVolumeInternalServerError:
|
||||
@@ -132,8 +135,9 @@ func (s *StorageProxy) Create(ctx context.Context, name, driverName string, volu
|
||||
}
|
||||
|
||||
// volumeCreate issues a CreateVolume request to the portlayer
|
||||
func (s *StorageProxy) volumeCreate(ctx context.Context, name, driverName string, volumeData, labels map[string]string) (*types.Volume, error) {
|
||||
defer trace.End(trace.Begin(""))
|
||||
func (s *VicStorageProxy) volumeCreate(op trace.Operation, name, driverName string, volumeData, labels map[string]string) (*types.Volume, error) {
|
||||
defer trace.End(trace.Begin(name, op))
|
||||
opID := op.ID()
|
||||
result := &types.Volume{}
|
||||
|
||||
if s.client == nil {
|
||||
@@ -150,9 +154,9 @@ func (s *StorageProxy) volumeCreate(ctx context.Context, name, driverName string
|
||||
if varErr != nil {
|
||||
return result, varErr
|
||||
}
|
||||
log.Infof("Finalized model for volume create request to portlayer: %#v", req)
|
||||
op.Infof("Finalized model for volume create request to portlayer: %#v", req)
|
||||
|
||||
res, err := s.client.Storage.CreateVolume(storage.NewCreateVolumeParamsWithContext(ctx).WithVolumeRequest(req))
|
||||
res, err := s.client.Storage.CreateVolume(storage.NewCreateVolumeParamsWithContext(op).WithOpID(&opID).WithVolumeRequest(req))
|
||||
if err != nil {
|
||||
return result, err
|
||||
}
|
||||
@@ -160,14 +164,31 @@ func (s *StorageProxy) volumeCreate(ctx context.Context, name, driverName string
|
||||
return NewVolumeModel(res.Payload, labels), nil
|
||||
}
|
||||
|
||||
func (s *StorageProxy) VolumeList(ctx context.Context, filter string) ([]*models.VolumeResponse, error) {
|
||||
defer trace.End(trace.Begin(""))
|
||||
func (s *VicStorageProxy) VolumeExist(ctx context.Context, name string) (bool, error) {
|
||||
defer trace.End(trace.Begin(name))
|
||||
|
||||
vols, err := s.VolumeList(ctx, "")
|
||||
if err == nil {
|
||||
for _, v := range vols {
|
||||
if name == v.Name {
|
||||
return true, nil
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false, err
|
||||
}
|
||||
|
||||
func (s *VicStorageProxy) VolumeList(ctx context.Context, filter string) ([]*models.VolumeResponse, error) {
|
||||
op := trace.FromContext(ctx, "VolumeList")
|
||||
defer trace.End(trace.Begin("", op))
|
||||
opID := op.ID()
|
||||
|
||||
if s.client == nil {
|
||||
return nil, errors.NillPortlayerClientError("StorageProxy")
|
||||
}
|
||||
|
||||
res, err := s.client.Storage.ListVolumes(storage.NewListVolumesParamsWithContext(ctx).WithFilterString(&filter))
|
||||
res, err := s.client.Storage.ListVolumes(storage.NewListVolumesParamsWithContext(op).WithOpID(&opID).WithFilterString(&filter))
|
||||
if err != nil {
|
||||
switch err := err.(type) {
|
||||
case *storage.ListVolumesInternalServerError:
|
||||
@@ -182,8 +203,10 @@ func (s *StorageProxy) VolumeList(ctx context.Context, filter string) ([]*models
|
||||
return res.Payload, nil
|
||||
}
|
||||
|
||||
func (s *StorageProxy) VolumeInfo(ctx context.Context, name string) (*models.VolumeResponse, error) {
|
||||
defer trace.End(trace.Begin(name))
|
||||
func (s *VicStorageProxy) VolumeInfo(ctx context.Context, name string) (*models.VolumeResponse, error) {
|
||||
op := trace.FromContext(ctx, "VolumeInfo: %s", name)
|
||||
defer trace.End(trace.Begin(name, op))
|
||||
opID := op.ID()
|
||||
|
||||
if name == "" {
|
||||
return nil, nil
|
||||
@@ -193,7 +216,7 @@ func (s *StorageProxy) VolumeInfo(ctx context.Context, name string) (*models.Vol
|
||||
return nil, errors.NillPortlayerClientError("StorageProxy")
|
||||
}
|
||||
|
||||
param := storage.NewGetVolumeParamsWithContext(ctx).WithName(name)
|
||||
param := storage.NewGetVolumeParamsWithContext(op).WithOpID(&opID).WithName(name)
|
||||
res, err := s.client.Storage.GetVolume(param)
|
||||
if err != nil {
|
||||
switch err := err.(type) {
|
||||
@@ -207,14 +230,16 @@ func (s *StorageProxy) VolumeInfo(ctx context.Context, name string) (*models.Vol
|
||||
return res.Payload, nil
|
||||
}
|
||||
|
||||
func (s *StorageProxy) Remove(ctx context.Context, name string) error {
|
||||
defer trace.End(trace.Begin(name))
|
||||
func (s *VicStorageProxy) Remove(ctx context.Context, name string) error {
|
||||
op := trace.FromContext(ctx, "VolumeRemove: %s", name)
|
||||
defer trace.End(trace.Begin(name, op))
|
||||
opID := op.ID()
|
||||
|
||||
if s.client == nil {
|
||||
return errors.NillPortlayerClientError("StorageProxy")
|
||||
}
|
||||
|
||||
_, err := s.client.Storage.RemoveVolume(storage.NewRemoveVolumeParamsWithContext(ctx).WithName(name))
|
||||
_, err := s.client.Storage.RemoveVolume(storage.NewRemoveVolumeParamsWithContext(op).WithOpID(&opID).WithName(name))
|
||||
if err != nil {
|
||||
switch err := err.(type) {
|
||||
case *storage.RemoveVolumeNotFound:
|
||||
@@ -236,16 +261,17 @@ func (s *StorageProxy) Remove(ctx context.Context, name string) error {
|
||||
//
|
||||
// returns:
|
||||
// modified handle
|
||||
func (s *StorageProxy) AddVolumesToContainer(ctx context.Context, handle string, config types.ContainerCreateConfig) (string, error) {
|
||||
defer trace.End(trace.Begin(handle))
|
||||
func (s *VicStorageProxy) AddVolumesToContainer(ctx context.Context, handle string, config types.ContainerCreateConfig) (string, error) {
|
||||
op := trace.FromContext(ctx, "AddVolumesToContainer: %s", handle)
|
||||
defer trace.End(trace.Begin(handle, op))
|
||||
|
||||
if s.client == nil {
|
||||
return "", errors.NillPortlayerClientError("StorageProxy")
|
||||
}
|
||||
|
||||
// Volume Attachment Section
|
||||
log.Debugf("ContainerProxy.AddVolumesToContainer - VolumeSection")
|
||||
log.Debugf("Raw volume arguments: binds: %#v, volumes: %#v", config.HostConfig.Binds, config.Config.Volumes)
|
||||
op.Debugf("ContainerProxy.AddVolumesToContainer - VolumeSection")
|
||||
op.Debugf("Raw volume arguments: binds: %#v, volumes: %#v", config.HostConfig.Binds, config.Config.Volumes)
|
||||
|
||||
// Collect all volume mappings. In a docker create/run, they
|
||||
// can be anonymous (-v /dir) or specific (-v vol-name:/dir).
|
||||
@@ -260,7 +286,7 @@ func (s *StorageProxy) AddVolumesToContainer(ctx context.Context, handle string,
|
||||
if err != nil {
|
||||
return handle, errors.BadRequestError(err.Error())
|
||||
}
|
||||
log.Infof("Finalized volume list: %#v", volList)
|
||||
op.Infof("Finalized volume list: %#v", volList)
|
||||
|
||||
if len(config.Config.Volumes) > 0 {
|
||||
// override anonymous volume list with generated volume id
|
||||
@@ -269,7 +295,7 @@ func (s *StorageProxy) AddVolumesToContainer(ctx context.Context, handle string,
|
||||
delete(config.Config.Volumes, vol.Dest)
|
||||
mount := getMountString(vol.ID, vol.Dest, vol.Flags)
|
||||
config.Config.Volumes[mount] = struct{}{}
|
||||
log.Debugf("Replace anonymous volume config %s with %s", vol.Dest, mount)
|
||||
op.Debugf("Replace anonymous volume config %s with %s", vol.Dest, mount)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -285,59 +311,75 @@ func (s *StorageProxy) AddVolumesToContainer(ctx context.Context, handle string,
|
||||
// NOTE: calling volumeCreate regardless of whether the volume is already
|
||||
// present can be avoided by adding an extra optional param to VolumeJoin,
|
||||
// which would then call volumeCreate if the volume does not exist.
|
||||
_, err := s.volumeCreate(ctx, fields.ID, "vsphere", volumeData, nil)
|
||||
if err != nil {
|
||||
switch err := err.(type) {
|
||||
case *storage.CreateVolumeConflict:
|
||||
// Implicitly ignore the error where a volume with the same name
|
||||
// already exists. We can just join the said volume to the container.
|
||||
log.Infof("a volume with the name %s already exists", fields.ID)
|
||||
case *storage.CreateVolumeNotFound:
|
||||
return handle, errors.VolumeCreateNotFoundError(volumeStore(volumeData))
|
||||
default:
|
||||
return handle, errors.InternalServerError(err.Error())
|
||||
}
|
||||
} else {
|
||||
log.Infof("volumeCreate succeeded. Volume mount section ID: %s", fields.ID)
|
||||
_, err := s.Create(op, fields.ID, "vsphere", volumeData, nil)
|
||||
if err != nil && !errors.IsVolumeExistError(err) {
|
||||
return handle, err
|
||||
}
|
||||
|
||||
flags := make(map[string]string)
|
||||
//NOTE: for now we are passing the flags directly through. This is NOT SAFE and only a stop gap.
|
||||
flags[constants.Mode] = fields.Flags
|
||||
joinParams := storage.NewVolumeJoinParamsWithContext(ctx).WithJoinArgs(&models.VolumeJoinConfig{
|
||||
Flags: flags,
|
||||
Handle: handle,
|
||||
MountPath: fields.Dest,
|
||||
}).WithName(fields.ID)
|
||||
|
||||
res, err := s.client.Storage.VolumeJoin(joinParams)
|
||||
h, err := s.VolumeJoin(op, handle, fields.ID, fields.Dest, flags)
|
||||
if err != nil {
|
||||
switch err := err.(type) {
|
||||
case *storage.VolumeJoinInternalServerError:
|
||||
return handle, errors.InternalServerError(err.Payload.Message)
|
||||
case *storage.VolumeJoinDefault:
|
||||
return handle, errors.InternalServerError(err.Payload.Message)
|
||||
case *storage.VolumeJoinNotFound:
|
||||
return handle, errors.VolumeJoinNotFoundError(err.Payload.Message)
|
||||
default:
|
||||
return handle, errors.InternalServerError(err.Error())
|
||||
}
|
||||
return handle, err
|
||||
}
|
||||
|
||||
handle = res.Payload
|
||||
handle = h
|
||||
}
|
||||
|
||||
return handle, nil
|
||||
}
|
||||
|
||||
// VolumeJoin declares a volume mount for a container. This should be called on container create.
|
||||
func (s *VicStorageProxy) VolumeJoin(ctx context.Context, handle, volName, mountPath string, flags map[string]string) (string, error) {
|
||||
op := trace.FromContext(ctx, "VolumeJoin: %s", handle)
|
||||
defer trace.End(trace.Begin(handle, op))
|
||||
opID := op.ID()
|
||||
|
||||
if s.client == nil {
|
||||
return "", errors.NillPortlayerClientError("StorageProxy")
|
||||
}
|
||||
|
||||
joinParams := storage.NewVolumeJoinParamsWithContext(op).
|
||||
WithOpID(&opID).
|
||||
WithJoinArgs(&models.VolumeJoinConfig{
|
||||
Flags: flags,
|
||||
Handle: handle,
|
||||
MountPath: mountPath,
|
||||
}).WithName(volName)
|
||||
|
||||
res, err := s.client.Storage.VolumeJoin(joinParams)
|
||||
if err != nil {
|
||||
switch err := err.(type) {
|
||||
case *storage.VolumeJoinInternalServerError:
|
||||
return handle, errors.InternalServerError(err.Payload.Message)
|
||||
case *storage.VolumeJoinDefault:
|
||||
return handle, errors.InternalServerError(err.Payload.Message)
|
||||
case *storage.VolumeJoinNotFound:
|
||||
return handle, errors.VolumeJoinNotFoundError(err.Payload.Message)
|
||||
default:
|
||||
return handle, errors.InternalServerError(err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
handle = res.Payload
|
||||
|
||||
return handle, nil
|
||||
}
|
||||
|
||||
// allContainers obtains all containers from the portlayer, akin to `docker ps -a`.
|
||||
func (s *StorageProxy) allContainers(ctx context.Context) ([]*models.ContainerInfo, error) {
|
||||
func (s *VicStorageProxy) allContainers(op trace.Operation) ([]*models.ContainerInfo, error) {
|
||||
defer trace.End(trace.Begin("", op))
|
||||
opID := op.ID()
|
||||
|
||||
if s.client == nil {
|
||||
return nil, errors.NillPortlayerClientError("StorageProxy")
|
||||
}
|
||||
|
||||
all := true
|
||||
cons, err := s.client.Containers.GetContainerList(containers.NewGetContainerListParamsWithContext(ctx).WithAll(&all))
|
||||
cons, err := s.client.Containers.GetContainerList(containers.NewGetContainerListParamsWithContext(op).
|
||||
WithOpID(&opID).
|
||||
WithAll(&all))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -347,8 +389,9 @@ func (s *StorageProxy) allContainers(ctx context.Context) ([]*models.ContainerIn
|
||||
|
||||
// fetchJoinedVolumes obtains all containers from the portlayer and returns a map with all
|
||||
// volumes that are joined to at least one container.
|
||||
func (s *StorageProxy) fetchJoinedVolumes(ctx context.Context) (map[string]struct{}, error) {
|
||||
conts, err := s.allContainers(ctx)
|
||||
func (s *VicStorageProxy) fetchJoinedVolumes(op trace.Operation) (map[string]struct{}, error) {
|
||||
defer trace.End(trace.Begin("", op))
|
||||
conts, err := s.allContainers(op)
|
||||
if err != nil {
|
||||
return nil, errors.VolumeInternalServerError(err)
|
||||
}
|
||||
@@ -410,6 +453,10 @@ func createVolumeMetadata(req *models.VolumeRequest, driverargs, labels map[stri
|
||||
// to at least one other container, and calls the portlayer to remove this container's
|
||||
// anonymous volumes if they are dangling. Errors, if any, are only logged.
|
||||
func RemoveAnonContainerVols(ctx context.Context, pl *client.PortLayer, cID string, vc *viccontainer.VicContainer) {
|
||||
op := trace.FromContext(ctx, "RemoveAnonContainerVols: %s", cID)
|
||||
defer trace.End(trace.Begin(cID, op))
|
||||
opID := op.ID()
|
||||
|
||||
// NOTE: these strings come in the form of <volume id>:<destination>:<volume options>
|
||||
volumes := vc.Config.Volumes
|
||||
// NOTE: these strings come in the form of <volume id>:<destination path>
|
||||
@@ -420,17 +467,17 @@ func RemoveAnonContainerVols(ctx context.Context, pl *client.PortLayer, cID stri
|
||||
for _, entry := range namedVolumes {
|
||||
fields := strings.SplitN(entry, ":", 2)
|
||||
if len(fields) != 2 {
|
||||
log.Errorf("Invalid entry in the HostConfig.Binds metadata section for container %s: %s", cID, entry)
|
||||
op.Errorf("Invalid entry in the HostConfig.Binds metadata section for container %s: %s", cID, entry)
|
||||
continue
|
||||
}
|
||||
destPath := fields[1]
|
||||
namedMaskList[destPath] = struct{}{}
|
||||
}
|
||||
|
||||
proxy := StorageProxy{client: pl}
|
||||
joinedVols, err := proxy.fetchJoinedVolumes(ctx)
|
||||
proxy := VicStorageProxy{client: pl}
|
||||
joinedVols, err := proxy.fetchJoinedVolumes(op)
|
||||
if err != nil {
|
||||
log.Errorf("Unable to obtain joined volumes from portlayer, skipping removal of anonymous volumes for %s: %s", cID, err.Error())
|
||||
op.Errorf("Unable to obtain joined volumes from portlayer, skipping removal of anonymous volumes for %s: %s", cID, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
@@ -440,7 +487,7 @@ func RemoveAnonContainerVols(ctx context.Context, pl *client.PortLayer, cID stri
|
||||
|
||||
// NOTE(mavery): this check will start to fail when we fix our metadata correctness issues
|
||||
if len(volFields) != 3 {
|
||||
log.Debugf("Invalid entry in the volumes metadata section for container %s: %s", cID, vol)
|
||||
op.Debugf("Invalid entry in the volumes metadata section for container %s: %s", cID, vol)
|
||||
continue
|
||||
}
|
||||
volName := volFields[0]
|
||||
@@ -449,27 +496,27 @@ func RemoveAnonContainerVols(ctx context.Context, pl *client.PortLayer, cID stri
|
||||
_, isNamed := namedMaskList[volPath]
|
||||
_, joined := joinedVols[volName]
|
||||
if !joined && !isNamed {
|
||||
_, err := pl.Storage.RemoveVolume(storage.NewRemoveVolumeParamsWithContext(ctx).WithName(volName))
|
||||
_, err := pl.Storage.RemoveVolume(storage.NewRemoveVolumeParamsWithContext(op).WithOpID(&opID).WithName(volName))
|
||||
if err != nil {
|
||||
log.Debugf("Unable to remove anonymous volume %s in container %s: %s", volName, cID, err.Error())
|
||||
op.Debugf("Unable to remove anonymous volume %s in container %s: %s", volName, cID, err.Error())
|
||||
continue
|
||||
}
|
||||
log.Debugf("Successfully removed anonymous volume %s during remove operation against container(%s)", volName, cID)
|
||||
op.Debugf("Successfully removed anonymous volume %s during remove operation against container(%s)", volName, cID)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// processVolumeParam is used to turn any call from docker create -v <stuff> into a volumeFields object.
|
||||
// processVolumeParam is used to turn any call from docker create -v <stuff> into a VolumeFields object.
|
||||
// The -v has 3 forms. -v <anonymous mount path>, -v <Volume Name>:<Destination Mount Path> and
|
||||
// -v <Volume Name>:<Destination Mount Path>:<mount flags>
|
||||
func processVolumeParam(volString string) (volumeFields, error) {
|
||||
func processVolumeParam(volString string) (VolumeFields, error) {
|
||||
volumeStrings := strings.Split(volString, ":")
|
||||
fields := volumeFields{}
|
||||
fields := VolumeFields{}
|
||||
|
||||
// Error out if the intended volume is a directory on the client filesystem.
|
||||
numVolParams := len(volumeStrings)
|
||||
if numVolParams > 1 && strings.HasPrefix(volumeStrings[0], "/") {
|
||||
return volumeFields{}, errors.InvalidVolumeError{}
|
||||
return VolumeFields{}, errors.InvalidVolumeError{}
|
||||
}
|
||||
|
||||
// This switch determines which type of -v was invoked.
|
||||
@@ -492,7 +539,7 @@ func processVolumeParam(volString string) (volumeFields, error) {
|
||||
fields.Flags = volumeStrings[2]
|
||||
default:
|
||||
// NOTE: the docker cli should cover this case. This is here for posterity.
|
||||
return volumeFields{}, errors.InvalidBindError{Volume: volString}
|
||||
return VolumeFields{}, errors.InvalidBindError{Volume: volString}
|
||||
}
|
||||
return fields, nil
|
||||
}
|
||||
@@ -500,8 +547,8 @@ func processVolumeParam(volString string) (volumeFields, error) {
|
||||
// processVolumeFields parses fields for volume mappings specified in a create/run -v.
|
||||
// It returns a map of unique mountable volumes. This means that it removes dupes favoring
|
||||
// specified volumes over anonymous volumes.
|
||||
func processVolumeFields(volumes []string) (map[string]volumeFields, error) {
|
||||
volumeFields := make(map[string]volumeFields)
|
||||
func processVolumeFields(volumes []string) (map[string]VolumeFields, error) {
|
||||
vf := make(map[string]VolumeFields)
|
||||
|
||||
for _, v := range volumes {
|
||||
fields, err := processVolumeParam(v)
|
||||
@@ -509,12 +556,12 @@ func processVolumeFields(volumes []string) (map[string]volumeFields, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
volumeFields[fields.Dest] = fields
|
||||
vf[fields.Dest] = fields
|
||||
}
|
||||
return volumeFields, nil
|
||||
return vf, nil
|
||||
}
|
||||
|
||||
func finalizeVolumeList(specifiedVolumes, anonymousVolumes []string) ([]volumeFields, error) {
|
||||
func finalizeVolumeList(specifiedVolumes, anonymousVolumes []string) ([]VolumeFields, error) {
|
||||
log.Infof("Specified Volumes : %#v", specifiedVolumes)
|
||||
processedVolumes, err := processVolumeFields(specifiedVolumes)
|
||||
if err != nil {
|
||||
@@ -532,7 +579,7 @@ func finalizeVolumeList(specifiedVolumes, anonymousVolumes []string) ([]volumeFi
|
||||
processedAnonVolumes[k] = v
|
||||
}
|
||||
|
||||
finalizedVolumes := make([]volumeFields, 0, len(processedAnonVolumes))
|
||||
finalizedVolumes := make([]VolumeFields, 0, len(processedAnonVolumes))
|
||||
for _, v := range processedAnonVolumes {
|
||||
finalizedVolumes = append(finalizedVolumes, v)
|
||||
}
|
||||
|
||||
183
vendor/github.com/vmware/vic/lib/apiservers/engine/proxy/stream_proxy.go
generated
vendored
183
vendor/github.com/vmware/vic/lib/apiservers/engine/proxy/stream_proxy.go
generated
vendored
@@ -22,7 +22,6 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/docker/docker/api/types/backend"
|
||||
@@ -33,16 +32,18 @@ import (
|
||||
"github.com/vmware/vic/lib/apiservers/portlayer/client"
|
||||
"github.com/vmware/vic/lib/apiservers/portlayer/client/containers"
|
||||
"github.com/vmware/vic/lib/apiservers/portlayer/client/interaction"
|
||||
"github.com/vmware/vic/lib/apiservers/portlayer/client/events"
|
||||
"github.com/vmware/vic/pkg/trace"
|
||||
)
|
||||
|
||||
type VicStreamProxy interface {
|
||||
AttachStreams(ctx context.Context, ac *AttachConfig, stdin io.ReadCloser, stdout, stderr io.Writer) error
|
||||
type StreamProxy interface {
|
||||
AttachStreams(ctx context.Context, ac *AttachConfig, stdin io.ReadCloser, stdout, stderr io.Writer, autoclose bool) error
|
||||
StreamContainerLogs(ctx context.Context, name string, out io.Writer, started chan struct{}, showTimestamps bool, followLogs bool, since int64, tailLines int64) error
|
||||
StreamContainerStats(ctx context.Context, config *convert.ContainerStatsConfig) error
|
||||
StreamEvents(ctx context.Context, out io.Writer) error
|
||||
}
|
||||
|
||||
type StreamProxy struct {
|
||||
type VicStreamProxy struct {
|
||||
client *client.PortLayer
|
||||
}
|
||||
|
||||
@@ -70,14 +71,18 @@ type AttachConfig struct {
|
||||
CloseStdin bool
|
||||
}
|
||||
|
||||
func NewStreamProxy(client *client.PortLayer) VicStreamProxy {
|
||||
return &StreamProxy{client: client}
|
||||
func NewStreamProxy(client *client.PortLayer) *VicStreamProxy {
|
||||
return &VicStreamProxy{client: client}
|
||||
}
|
||||
|
||||
// AttachStreams takes the the hijacked connections from the calling client and attaches
|
||||
// them to the 3 streams from the portlayer's rest server.
|
||||
// stdin, stdout, stderr are the hijacked connection
|
||||
func (s *StreamProxy) AttachStreams(ctx context.Context, ac *AttachConfig, stdin io.ReadCloser, stdout, stderr io.Writer) error {
|
||||
// autoclose controls whether the underlying client transport will be closed when stdout/stderr
|
||||
func (s *VicStreamProxy) AttachStreams(ctx context.Context, ac *AttachConfig, stdin io.ReadCloser, stdout, stderr io.Writer, autoclose bool) error {
|
||||
op := trace.FromContext(ctx, "")
|
||||
defer trace.End(trace.Begin("", op))
|
||||
|
||||
// Cancel will close the child connections.
|
||||
var wg, outWg sync.WaitGroup
|
||||
|
||||
@@ -96,10 +101,11 @@ func (s *StreamProxy) AttachStreams(ctx context.Context, ac *AttachConfig, stdin
|
||||
}
|
||||
}
|
||||
|
||||
ctx, cancel := context.WithCancel(ctx)
|
||||
ctx, cancel := context.WithCancel(op)
|
||||
defer cancel()
|
||||
|
||||
if ac.UseStdin {
|
||||
if ac.UseStdin && autoclose {
|
||||
// if we're not autoclosing then we don't want to block waiting for copyStdin to exit
|
||||
wg.Add(1)
|
||||
}
|
||||
|
||||
@@ -125,22 +131,26 @@ func (s *StreamProxy) AttachStreams(ctx context.Context, ac *AttachConfig, stdin
|
||||
|
||||
if ac.UseStdin {
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
err := copyStdIn(ctx, s.client, ac, stdin, keys)
|
||||
if autoclose {
|
||||
defer wg.Done()
|
||||
}
|
||||
err := copyStdIn(ctx, s.client, ac, stdin, keys, autoclose)
|
||||
if err != nil {
|
||||
log.Errorf("container attach: stdin (%s): %s", ac.ID, err)
|
||||
op.Errorf("container attach: stdin (%s): %s", ac.ID, err)
|
||||
} else {
|
||||
log.Infof("container attach: stdin (%s) done", ac.ID)
|
||||
op.Infof("container attach: stdin (%s) done", ac.ID)
|
||||
}
|
||||
|
||||
// Check for EOF or canceled context. We can only detect EOF by checking the error string returned by swagger :/
|
||||
// We check this before calling cancel so that we will be sure to return detach errors before stdout/err exits,
|
||||
// even in the !autoclose case.
|
||||
if EOForCanceled(err) {
|
||||
errChan <- err
|
||||
}
|
||||
|
||||
if !ac.CloseStdin || ac.UseTty {
|
||||
cancel()
|
||||
}
|
||||
|
||||
// Check for EOF or canceled context. We can only detect EOF by checking the error string returned by swagger :/
|
||||
if EOForCanceled(err) {
|
||||
errChan <- err
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
@@ -151,9 +161,9 @@ func (s *StreamProxy) AttachStreams(ctx context.Context, ac *AttachConfig, stdin
|
||||
|
||||
err := copyStdOut(ctx, s.client, ac, stdout, attachAttemptTimeout)
|
||||
if err != nil {
|
||||
log.Errorf("container attach: stdout (%s): %s", ac.ID, err)
|
||||
op.Errorf("container attach: stdout (%s): %s", ac.ID, err)
|
||||
} else {
|
||||
log.Infof("container attach: stdout (%s) done", ac.ID)
|
||||
op.Infof("container attach: stdout (%s) done", ac.ID)
|
||||
}
|
||||
|
||||
// Check for EOF or canceled context. We can only detect EOF by checking the error string returned by swagger :/
|
||||
@@ -170,9 +180,9 @@ func (s *StreamProxy) AttachStreams(ctx context.Context, ac *AttachConfig, stdin
|
||||
|
||||
err := copyStdErr(ctx, s.client, ac, stderr)
|
||||
if err != nil {
|
||||
log.Errorf("container attach: stderr (%s): %s", ac.ID, err)
|
||||
op.Errorf("container attach: stderr (%s): %s", ac.ID, err)
|
||||
} else {
|
||||
log.Infof("container attach: stderr (%s) done", ac.ID)
|
||||
op.Infof("container attach: stderr (%s) done", ac.ID)
|
||||
}
|
||||
|
||||
// Check for EOF or canceled context. We can only detect EOF by checking the error string returned by swagger :/
|
||||
@@ -188,12 +198,12 @@ func (s *StreamProxy) AttachStreams(ctx context.Context, ac *AttachConfig, stdin
|
||||
// close the channel so that we don't leak (if there is an error)/or get blocked (if there are no errors)
|
||||
close(errChan)
|
||||
|
||||
log.Infof("cleaned up connections to %s. Checking errors", ac.ID)
|
||||
op.Infof("cleaned up connections to %s", ac.ID)
|
||||
for err := range errChan {
|
||||
if err != nil {
|
||||
// check if we got DetachError
|
||||
if _, ok := err.(errors.DetachError); ok {
|
||||
log.Infof("Detached from container detected")
|
||||
op.Infof("Detached from container detected")
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -202,20 +212,21 @@ func (s *StreamProxy) AttachStreams(ctx context.Context, ac *AttachConfig, stdin
|
||||
// Go-swagger returns untyped errors to us if the error is not one that we define
|
||||
// in the swagger spec. Even EOF. Therefore, we must scan the error string (if there
|
||||
// is an error string in the untyped error) for the term EOF.
|
||||
log.Errorf("container attach error: %s", err)
|
||||
op.Errorf("container attach error: %s", err)
|
||||
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
log.Infof("No error found. Returning nil...")
|
||||
return nil
|
||||
}
|
||||
|
||||
// StreamContainerLogs reads the log stream from the portlayer rest server and writes
|
||||
// it directly to the io.Writer that is passed in.
|
||||
func (s *StreamProxy) StreamContainerLogs(ctx context.Context, name string, out io.Writer, started chan struct{}, showTimestamps bool, followLogs bool, since int64, tailLines int64) error {
|
||||
defer trace.End(trace.Begin(""))
|
||||
func (s *VicStreamProxy) StreamContainerLogs(ctx context.Context, name string, out io.Writer, started chan struct{}, showTimestamps bool, followLogs bool, since int64, tailLines int64) error {
|
||||
op := trace.FromContext(ctx, "")
|
||||
defer trace.End(trace.Begin("", op))
|
||||
opID := op.ID()
|
||||
|
||||
if s.client == nil {
|
||||
return errors.NillPortlayerClientError("StreamProxy")
|
||||
@@ -223,12 +234,13 @@ func (s *StreamProxy) StreamContainerLogs(ctx context.Context, name string, out
|
||||
|
||||
close(started)
|
||||
|
||||
params := containers.NewGetContainerLogsParamsWithContext(ctx).
|
||||
params := containers.NewGetContainerLogsParamsWithContext(op).
|
||||
WithID(name).
|
||||
WithFollow(&followLogs).
|
||||
WithTimestamp(&showTimestamps).
|
||||
WithSince(&since).
|
||||
WithTaillines(&tailLines)
|
||||
WithTaillines(&tailLines).
|
||||
WithOpID(&opID)
|
||||
_, err := s.client.Containers.GetContainerLogs(params, out)
|
||||
if err != nil {
|
||||
switch err := err.(type) {
|
||||
@@ -253,8 +265,10 @@ func (s *StreamProxy) StreamContainerLogs(ctx context.Context, name string, out
|
||||
// StreamContainerStats will provide a stream of container stats written to the provided
|
||||
// io.Writer. Prior to writing to the provided io.Writer there will be a transformation
|
||||
// from the portLayer representation of stats to the docker format
|
||||
func (s *StreamProxy) StreamContainerStats(ctx context.Context, config *convert.ContainerStatsConfig) error {
|
||||
defer trace.End(trace.Begin(config.ContainerID))
|
||||
func (s *VicStreamProxy) StreamContainerStats(ctx context.Context, config *convert.ContainerStatsConfig) error {
|
||||
op := trace.FromContext(ctx, "")
|
||||
defer trace.End(trace.Begin(config.ContainerID, op))
|
||||
opID := op.ID()
|
||||
|
||||
if s.client == nil {
|
||||
return errors.NillPortlayerClientError("StreamProxy")
|
||||
@@ -264,7 +278,7 @@ func (s *StreamProxy) StreamContainerStats(ctx context.Context, config *convert.
|
||||
ctx, cancel := context.WithCancel(ctx)
|
||||
defer cancel()
|
||||
|
||||
params := containers.NewGetContainerStatsParamsWithContext(ctx)
|
||||
params := containers.NewGetContainerStatsParamsWithContext(op).WithOpID(&opID)
|
||||
params.ID = config.ContainerID
|
||||
params.Stream = config.Stream
|
||||
|
||||
@@ -303,11 +317,48 @@ func (s *StreamProxy) StreamContainerStats(ctx context.Context, config *convert.
|
||||
return nil
|
||||
}
|
||||
|
||||
// StreamEvents() handles all swagger interaction to the Portlayer's event manager
|
||||
//
|
||||
// Input:
|
||||
// context and a io.Writer
|
||||
func (s *VicStreamProxy) StreamEvents(ctx context.Context, out io.Writer) error {
|
||||
op := trace.FromContext(ctx, "")
|
||||
defer trace.End(trace.Begin("", op))
|
||||
opID := op.ID()
|
||||
|
||||
if s.client == nil {
|
||||
return errors.NillPortlayerClientError("StreamProxy")
|
||||
}
|
||||
|
||||
params := events.NewGetEventsParamsWithContext(ctx).WithOpID(&opID)
|
||||
if _, err := s.client.Events.GetEvents(params, out); err != nil {
|
||||
switch err := err.(type) {
|
||||
case *events.GetEventsInternalServerError:
|
||||
return errors.InternalServerError("Server error from the events port layer")
|
||||
default:
|
||||
//Check for EOF. Since the connection, transport, and data handling are
|
||||
//encapsulated inside of Swagger, we can only detect EOF by checking the
|
||||
//error string
|
||||
if strings.Contains(err.Error(), SwaggerSubstringEOF) {
|
||||
return nil
|
||||
}
|
||||
return errors.InternalServerError(fmt.Sprintf("Unknown error from the interaction port layer: %s", err))
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------
|
||||
// ContainerAttach() Utility Functions
|
||||
//------------------------------------
|
||||
|
||||
func copyStdIn(ctx context.Context, pl *client.PortLayer, ac *AttachConfig, stdin io.ReadCloser, keys []byte) error {
|
||||
func copyStdIn(ctx context.Context, pl *client.PortLayer, ac *AttachConfig, stdin io.ReadCloser, keys []byte, autoclose bool) error {
|
||||
op := trace.FromContext(ctx, "")
|
||||
defer trace.End(trace.Begin("", op))
|
||||
opID := op.ID()
|
||||
|
||||
// Pipe for stdin so we can interject and watch the input streams for detach keys.
|
||||
stdinReader, stdinWriter := io.Pipe()
|
||||
defer stdinReader.Close()
|
||||
@@ -315,26 +366,28 @@ func copyStdIn(ctx context.Context, pl *client.PortLayer, ac *AttachConfig, stdi
|
||||
var detach bool
|
||||
|
||||
done := make(chan struct{})
|
||||
go func() {
|
||||
// make sure we get out of io.Copy if context is canceled
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
// This will cause the transport to the API client to be shut down, so all output
|
||||
// streams will get closed as well.
|
||||
// See the closer in container_routes.go:postContainersAttach
|
||||
if autoclose {
|
||||
go func() {
|
||||
// make sure we get out of io.Copy if context is canceled
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
// This will cause the transport to the API client to be shut down, so all output
|
||||
// streams will get closed as well.
|
||||
// See the closer in container_routes.go:postContainersAttach
|
||||
|
||||
// We're closing this here to disrupt the io.Copy below
|
||||
// TODO: seems like we should be providing an io.Copy impl with ctx argument that honors
|
||||
// cancelation with the amount of code dedicated to working around it
|
||||
// We're closing this here to disrupt the io.Copy below
|
||||
// TODO: seems like we should be providing an io.Copy impl with ctx argument that honors
|
||||
// cancelation with the amount of code dedicated to working around it
|
||||
|
||||
// TODO: I think this still leaves a race between closing of the API client transport and
|
||||
// copying of the output streams, it's just likely the error will be dropped as the transport is
|
||||
// closed when it occurs.
|
||||
// We should move away from needing to close transports to interrupt reads.
|
||||
stdin.Close()
|
||||
case <-done:
|
||||
}
|
||||
}()
|
||||
// TODO: I think this still leaves a race between closing of the API client transport and
|
||||
// copying of the output streams, it's just likely the error will be dropped as the transport is
|
||||
// closed when it occurs.
|
||||
// We should move away from needing to close transports to interrupt reads.
|
||||
stdin.Close()
|
||||
case <-done:
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
go func() {
|
||||
defer close(done)
|
||||
@@ -347,7 +400,7 @@ func copyStdIn(ctx context.Context, pl *client.PortLayer, ac *AttachConfig, stdi
|
||||
// Write some init bytes into the pipe to force Swagger to make the initial
|
||||
// call to the portlayer, prior to any user input in whatever attach client
|
||||
// he/she is using.
|
||||
log.Debugf("copyStdIn writing primer bytes")
|
||||
op.Debugf("copyStdIn writing primer bytes")
|
||||
stdinWriter.Write([]byte(attachStdinInitString))
|
||||
if ac.UseTty {
|
||||
_, err = copyEscapable(stdinWriter, stdin, keys)
|
||||
@@ -357,10 +410,10 @@ func copyStdIn(ctx context.Context, pl *client.PortLayer, ac *AttachConfig, stdi
|
||||
|
||||
if err != nil {
|
||||
if _, ok := err.(errors.DetachError); ok {
|
||||
log.Infof("stdin detach detected")
|
||||
op.Infof("stdin detach detected")
|
||||
detach = true
|
||||
} else {
|
||||
log.Errorf("stdin err: %s", err)
|
||||
op.Errorf("stdin err: %s", err)
|
||||
}
|
||||
}
|
||||
}()
|
||||
@@ -369,19 +422,21 @@ func copyStdIn(ctx context.Context, pl *client.PortLayer, ac *AttachConfig, stdi
|
||||
|
||||
// Swagger wants an io.reader so give it the reader pipe. Also, the swagger call
|
||||
// to set the stdin is synchronous so we need to run in a goroutine
|
||||
setStdinParams := interaction.NewContainerSetStdinParamsWithContext(ctx).WithID(id)
|
||||
setStdinParams = setStdinParams.WithRawStream(stdinReader)
|
||||
setStdinParams := interaction.NewContainerSetStdinParamsWithContext(op).
|
||||
WithID(id).
|
||||
WithRawStream(stdinReader).
|
||||
WithOpID(&opID)
|
||||
|
||||
_, err := pl.Interaction.ContainerSetStdin(setStdinParams)
|
||||
<-done
|
||||
|
||||
if ac.CloseStdin && !ac.UseTty {
|
||||
// Close the stdin connection. Mimicing Docker's behavior.
|
||||
log.Errorf("Attach stream has stdinOnce set. Closing the stdin.")
|
||||
op.Errorf("Attach stream has stdinOnce set. Closing the stdin.")
|
||||
params := interaction.NewContainerCloseStdinParamsWithContext(ctx).WithID(id)
|
||||
_, err := pl.Interaction.ContainerCloseStdin(params)
|
||||
if err != nil {
|
||||
log.Errorf("CloseStdin failed with %s", err)
|
||||
op.Errorf("CloseStdin failed with %s", err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -394,19 +449,21 @@ func copyStdIn(ctx context.Context, pl *client.PortLayer, ac *AttachConfig, stdi
|
||||
}
|
||||
|
||||
func copyStdOut(ctx context.Context, pl *client.PortLayer, ac *AttachConfig, stdout io.Writer, attemptTimeout time.Duration) error {
|
||||
op := trace.FromContext(ctx, "")
|
||||
defer trace.End(trace.Begin("", op))
|
||||
id := ac.ID
|
||||
|
||||
//Calculate how much time to let portlayer attempt
|
||||
plAttemptTimeout := attemptTimeout - attachPLAttemptDiff //assumes personality deadline longer than portlayer's deadline
|
||||
plAttemptDeadline := time.Now().Add(plAttemptTimeout)
|
||||
swaggerDeadline := strfmt.DateTime(plAttemptDeadline)
|
||||
log.Debugf("* stdout portlayer deadline: %s", plAttemptDeadline.Format(time.UnixDate))
|
||||
log.Debugf("* stdout personality deadline: %s", time.Now().Add(attemptTimeout).Format(time.UnixDate))
|
||||
op.Debugf("* stdout portlayer deadline: %s", plAttemptDeadline.Format(time.UnixDate))
|
||||
op.Debugf("* stdout personality deadline: %s", time.Now().Add(attemptTimeout).Format(time.UnixDate))
|
||||
|
||||
log.Debugf("* stdout attach start %s", time.Now().Format(time.UnixDate))
|
||||
op.Debugf("* stdout attach start %s", time.Now().Format(time.UnixDate))
|
||||
getStdoutParams := interaction.NewContainerGetStdoutParamsWithContext(ctx).WithID(id).WithDeadline(&swaggerDeadline)
|
||||
_, err := pl.Interaction.ContainerGetStdout(getStdoutParams, stdout)
|
||||
log.Debugf("* stdout attach end %s", time.Now().Format(time.UnixDate))
|
||||
op.Debugf("* stdout attach end %s", time.Now().Format(time.UnixDate))
|
||||
if err != nil {
|
||||
if _, ok := err.(*interaction.ContainerGetStdoutNotFound); ok {
|
||||
return errors.ContainerResourceNotFoundError(id, "interaction connection")
|
||||
|
||||
35
vendor/github.com/vmware/vic/lib/apiservers/engine/proxy/system_proxy.go
generated
vendored
35
vendor/github.com/vmware/vic/lib/apiservers/engine/proxy/system_proxy.go
generated
vendored
@@ -37,7 +37,6 @@ import (
|
||||
|
||||
"golang.org/x/net/context"
|
||||
|
||||
log "github.com/Sirupsen/logrus"
|
||||
derr "github.com/docker/docker/api/errors"
|
||||
|
||||
"github.com/vmware/vic/lib/apiservers/engine/errors"
|
||||
@@ -48,36 +47,37 @@ import (
|
||||
"github.com/vmware/vic/pkg/trace"
|
||||
)
|
||||
|
||||
type VicSystemProxy interface {
|
||||
type SystemProxy interface {
|
||||
PingPortlayer(ctx context.Context) bool
|
||||
ContainerCount(ctx context.Context) (int, int, int, error)
|
||||
VCHInfo(ctx context.Context) (*models.VCHInfo, error)
|
||||
}
|
||||
|
||||
type SystemProxy struct {
|
||||
type VicSystemProxy struct {
|
||||
client *client.PortLayer
|
||||
}
|
||||
|
||||
func NewSystemProxy(client *client.PortLayer) VicSystemProxy {
|
||||
func NewSystemProxy(client *client.PortLayer) *VicSystemProxy {
|
||||
if client == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
return &SystemProxy{client: client}
|
||||
return &VicSystemProxy{client: client}
|
||||
}
|
||||
|
||||
func (s *SystemProxy) PingPortlayer(ctx context.Context) bool {
|
||||
defer trace.End(trace.Begin(""))
|
||||
func (s *VicSystemProxy) PingPortlayer(ctx context.Context) bool {
|
||||
op := trace.FromContext(ctx, "")
|
||||
defer trace.End(trace.Begin("", op))
|
||||
|
||||
if s.client == nil {
|
||||
log.Errorf("Portlayer client is invalid")
|
||||
op.Errorf("Portlayer client is invalid")
|
||||
return false
|
||||
}
|
||||
|
||||
pingParams := misc.NewPingParamsWithContext(ctx)
|
||||
_, err := s.client.Misc.Ping(pingParams)
|
||||
if err != nil {
|
||||
log.Info("Ping to portlayer failed")
|
||||
op.Info("Ping to portlayer failed")
|
||||
return false
|
||||
}
|
||||
return true
|
||||
@@ -85,8 +85,10 @@ func (s *SystemProxy) PingPortlayer(ctx context.Context) bool {
|
||||
|
||||
// Use the Portlayer's support for docker ps to get the container count
|
||||
// return order: running, paused, stopped counts
|
||||
func (s *SystemProxy) ContainerCount(ctx context.Context) (int, int, int, error) {
|
||||
defer trace.End(trace.Begin(""))
|
||||
func (s *VicSystemProxy) ContainerCount(ctx context.Context) (int, int, int, error) {
|
||||
op := trace.FromContext(ctx, "")
|
||||
defer trace.End(trace.Begin("", op))
|
||||
opID := op.ID()
|
||||
|
||||
var running, paused, stopped int
|
||||
|
||||
@@ -95,7 +97,8 @@ func (s *SystemProxy) ContainerCount(ctx context.Context) (int, int, int, error)
|
||||
}
|
||||
|
||||
all := true
|
||||
containList, err := s.client.Containers.GetContainerList(containers.NewGetContainerListParamsWithContext(ctx).WithAll(&all))
|
||||
params := containers.NewGetContainerListParamsWithContext(ctx).WithAll(&all).WithOpID(&opID)
|
||||
containList, err := s.client.Containers.GetContainerList(params)
|
||||
if err != nil {
|
||||
return 0, 0, 0, derr.NewErrorWithStatusCode(fmt.Errorf("Failed to get container list: %s", err), http.StatusInternalServerError)
|
||||
}
|
||||
@@ -112,14 +115,16 @@ func (s *SystemProxy) ContainerCount(ctx context.Context) (int, int, int, error)
|
||||
return running, paused, stopped, nil
|
||||
}
|
||||
|
||||
func (s *SystemProxy) VCHInfo(ctx context.Context) (*models.VCHInfo, error) {
|
||||
defer trace.End(trace.Begin(""))
|
||||
func (s *VicSystemProxy) VCHInfo(ctx context.Context) (*models.VCHInfo, error) {
|
||||
op := trace.FromContext(ctx, "")
|
||||
defer trace.End(trace.Begin("", op))
|
||||
opID := op.ID()
|
||||
|
||||
if s.client == nil {
|
||||
return nil, errors.NillPortlayerClientError("SystemProxy")
|
||||
}
|
||||
|
||||
params := misc.NewGetVCHInfoParamsWithContext(ctx)
|
||||
params := misc.NewGetVCHInfoParamsWithContext(ctx).WithOpID(&opID)
|
||||
resp, err := s.client.Misc.GetVCHInfo(params)
|
||||
if err != nil {
|
||||
//There are no custom error for this operation. If we get back an error, it's
|
||||
|
||||
@@ -61,6 +61,8 @@ for the commit operation typically these are written to a http.Request
|
||||
*/
|
||||
type CommitParams struct {
|
||||
|
||||
/*OpID*/
|
||||
OpID *string
|
||||
/*Handle*/
|
||||
Handle string
|
||||
/*WaitTime*/
|
||||
@@ -104,6 +106,17 @@ func (o *CommitParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithOpID adds the opID to the commit params
|
||||
func (o *CommitParams) WithOpID(opID *string) *CommitParams {
|
||||
o.SetOpID(opID)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetOpID adds the opId to the commit params
|
||||
func (o *CommitParams) SetOpID(opID *string) {
|
||||
o.OpID = opID
|
||||
}
|
||||
|
||||
// WithHandle adds the handle to the commit params
|
||||
func (o *CommitParams) WithHandle(handle string) *CommitParams {
|
||||
o.SetHandle(handle)
|
||||
@@ -132,6 +145,15 @@ func (o *CommitParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Regist
|
||||
r.SetTimeout(o.timeout)
|
||||
var res []error
|
||||
|
||||
if o.OpID != nil {
|
||||
|
||||
// header param Op-ID
|
||||
if err := r.SetHeaderParam("Op-ID", *o.OpID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// path param handle
|
||||
if err := r.SetPathParam("handle", o.Handle); err != nil {
|
||||
return err
|
||||
|
||||
@@ -81,6 +81,8 @@ for the container remove operation typically these are written to a http.Request
|
||||
*/
|
||||
type ContainerRemoveParams struct {
|
||||
|
||||
/*OpID*/
|
||||
OpID *string
|
||||
/*Force*/
|
||||
Force *bool
|
||||
/*ID*/
|
||||
@@ -126,6 +128,17 @@ func (o *ContainerRemoveParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithOpID adds the opID to the container remove params
|
||||
func (o *ContainerRemoveParams) WithOpID(opID *string) *ContainerRemoveParams {
|
||||
o.SetOpID(opID)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetOpID adds the opId to the container remove params
|
||||
func (o *ContainerRemoveParams) SetOpID(opID *string) {
|
||||
o.OpID = opID
|
||||
}
|
||||
|
||||
// WithForce adds the force to the container remove params
|
||||
func (o *ContainerRemoveParams) WithForce(force *bool) *ContainerRemoveParams {
|
||||
o.SetForce(force)
|
||||
@@ -165,6 +178,15 @@ func (o *ContainerRemoveParams) WriteToRequest(r runtime.ClientRequest, reg strf
|
||||
r.SetTimeout(o.timeout)
|
||||
var res []error
|
||||
|
||||
if o.OpID != nil {
|
||||
|
||||
// header param Op-ID
|
||||
if err := r.SetHeaderParam("Op-ID", *o.OpID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if o.Force != nil {
|
||||
|
||||
// query param force
|
||||
|
||||
@@ -60,6 +60,8 @@ for the container rename operation typically these are written to a http.Request
|
||||
*/
|
||||
type ContainerRenameParams struct {
|
||||
|
||||
/*OpID*/
|
||||
OpID *string
|
||||
/*Handle*/
|
||||
Handle string
|
||||
/*Name
|
||||
@@ -106,6 +108,17 @@ func (o *ContainerRenameParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithOpID adds the opID to the container rename params
|
||||
func (o *ContainerRenameParams) WithOpID(opID *string) *ContainerRenameParams {
|
||||
o.SetOpID(opID)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetOpID adds the opId to the container rename params
|
||||
func (o *ContainerRenameParams) SetOpID(opID *string) {
|
||||
o.OpID = opID
|
||||
}
|
||||
|
||||
// WithHandle adds the handle to the container rename params
|
||||
func (o *ContainerRenameParams) WithHandle(handle string) *ContainerRenameParams {
|
||||
o.SetHandle(handle)
|
||||
@@ -134,6 +147,15 @@ func (o *ContainerRenameParams) WriteToRequest(r runtime.ClientRequest, reg strf
|
||||
r.SetTimeout(o.timeout)
|
||||
var res []error
|
||||
|
||||
if o.OpID != nil {
|
||||
|
||||
// header param Op-ID
|
||||
if err := r.SetHeaderParam("Op-ID", *o.OpID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// path param handle
|
||||
if err := r.SetPathParam("handle", o.Handle); err != nil {
|
||||
return err
|
||||
|
||||
@@ -61,6 +61,8 @@ for the container signal operation typically these are written to a http.Request
|
||||
*/
|
||||
type ContainerSignalParams struct {
|
||||
|
||||
/*OpID*/
|
||||
OpID *string
|
||||
/*ID*/
|
||||
ID string
|
||||
/*Signal*/
|
||||
@@ -104,6 +106,17 @@ func (o *ContainerSignalParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithOpID adds the opID to the container signal params
|
||||
func (o *ContainerSignalParams) WithOpID(opID *string) *ContainerSignalParams {
|
||||
o.SetOpID(opID)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetOpID adds the opId to the container signal params
|
||||
func (o *ContainerSignalParams) SetOpID(opID *string) {
|
||||
o.OpID = opID
|
||||
}
|
||||
|
||||
// WithID adds the id to the container signal params
|
||||
func (o *ContainerSignalParams) WithID(id string) *ContainerSignalParams {
|
||||
o.SetID(id)
|
||||
@@ -132,6 +145,15 @@ func (o *ContainerSignalParams) WriteToRequest(r runtime.ClientRequest, reg strf
|
||||
r.SetTimeout(o.timeout)
|
||||
var res []error
|
||||
|
||||
if o.OpID != nil {
|
||||
|
||||
// header param Op-ID
|
||||
if err := r.SetHeaderParam("Op-ID", *o.OpID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// path param id
|
||||
if err := r.SetPathParam("id", o.ID); err != nil {
|
||||
return err
|
||||
|
||||
@@ -61,6 +61,8 @@ for the container wait operation typically these are written to a http.Request
|
||||
*/
|
||||
type ContainerWaitParams struct {
|
||||
|
||||
/*OpID*/
|
||||
OpID *string
|
||||
/*ID*/
|
||||
ID string
|
||||
/*Timeout*/
|
||||
@@ -104,6 +106,17 @@ func (o *ContainerWaitParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithOpID adds the opID to the container wait params
|
||||
func (o *ContainerWaitParams) WithOpID(opID *string) *ContainerWaitParams {
|
||||
o.SetOpID(opID)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetOpID adds the opId to the container wait params
|
||||
func (o *ContainerWaitParams) SetOpID(opID *string) {
|
||||
o.OpID = opID
|
||||
}
|
||||
|
||||
// WithID adds the id to the container wait params
|
||||
func (o *ContainerWaitParams) WithID(id string) *ContainerWaitParams {
|
||||
o.SetID(id)
|
||||
@@ -132,6 +145,15 @@ func (o *ContainerWaitParams) WriteToRequest(r runtime.ClientRequest, reg strfmt
|
||||
r.SetTimeout(o.requestTimeout)
|
||||
var res []error
|
||||
|
||||
if o.OpID != nil {
|
||||
|
||||
// header param Op-ID
|
||||
if err := r.SetHeaderParam("Op-ID", *o.OpID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// path param id
|
||||
if err := r.SetPathParam("id", o.ID); err != nil {
|
||||
return err
|
||||
|
||||
@@ -62,6 +62,8 @@ for the create operation typically these are written to a http.Request
|
||||
*/
|
||||
type CreateParams struct {
|
||||
|
||||
/*OpID*/
|
||||
OpID *string
|
||||
/*CreateConfig*/
|
||||
CreateConfig *models.ContainerCreateConfig
|
||||
/*Name*/
|
||||
@@ -105,6 +107,17 @@ func (o *CreateParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithOpID adds the opID to the create params
|
||||
func (o *CreateParams) WithOpID(opID *string) *CreateParams {
|
||||
o.SetOpID(opID)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetOpID adds the opId to the create params
|
||||
func (o *CreateParams) SetOpID(opID *string) {
|
||||
o.OpID = opID
|
||||
}
|
||||
|
||||
// WithCreateConfig adds the createConfig to the create params
|
||||
func (o *CreateParams) WithCreateConfig(createConfig *models.ContainerCreateConfig) *CreateParams {
|
||||
o.SetCreateConfig(createConfig)
|
||||
@@ -133,6 +146,15 @@ func (o *CreateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Regist
|
||||
r.SetTimeout(o.timeout)
|
||||
var res []error
|
||||
|
||||
if o.OpID != nil {
|
||||
|
||||
// header param Op-ID
|
||||
if err := r.SetHeaderParam("Op-ID", *o.OpID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if o.CreateConfig == nil {
|
||||
o.CreateConfig = new(models.ContainerCreateConfig)
|
||||
}
|
||||
|
||||
@@ -60,6 +60,8 @@ for the get container info operation typically these are written to a http.Reque
|
||||
*/
|
||||
type GetContainerInfoParams struct {
|
||||
|
||||
/*OpID*/
|
||||
OpID *string
|
||||
/*ID*/
|
||||
ID string
|
||||
|
||||
@@ -101,6 +103,17 @@ func (o *GetContainerInfoParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithOpID adds the opID to the get container info params
|
||||
func (o *GetContainerInfoParams) WithOpID(opID *string) *GetContainerInfoParams {
|
||||
o.SetOpID(opID)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetOpID adds the opId to the get container info params
|
||||
func (o *GetContainerInfoParams) SetOpID(opID *string) {
|
||||
o.OpID = opID
|
||||
}
|
||||
|
||||
// WithID adds the id to the get container info params
|
||||
func (o *GetContainerInfoParams) WithID(id string) *GetContainerInfoParams {
|
||||
o.SetID(id)
|
||||
@@ -118,6 +131,15 @@ func (o *GetContainerInfoParams) WriteToRequest(r runtime.ClientRequest, reg str
|
||||
r.SetTimeout(o.timeout)
|
||||
var res []error
|
||||
|
||||
if o.OpID != nil {
|
||||
|
||||
// header param Op-ID
|
||||
if err := r.SetHeaderParam("Op-ID", *o.OpID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// path param id
|
||||
if err := r.SetPathParam("id", o.ID); err != nil {
|
||||
return err
|
||||
|
||||
@@ -61,6 +61,8 @@ for the get container list operation typically these are written to a http.Reque
|
||||
*/
|
||||
type GetContainerListParams struct {
|
||||
|
||||
/*OpID*/
|
||||
OpID *string
|
||||
/*All*/
|
||||
All *bool
|
||||
|
||||
@@ -102,6 +104,17 @@ func (o *GetContainerListParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithOpID adds the opID to the get container list params
|
||||
func (o *GetContainerListParams) WithOpID(opID *string) *GetContainerListParams {
|
||||
o.SetOpID(opID)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetOpID adds the opId to the get container list params
|
||||
func (o *GetContainerListParams) SetOpID(opID *string) {
|
||||
o.OpID = opID
|
||||
}
|
||||
|
||||
// WithAll adds the all to the get container list params
|
||||
func (o *GetContainerListParams) WithAll(all *bool) *GetContainerListParams {
|
||||
o.SetAll(all)
|
||||
@@ -119,6 +132,15 @@ func (o *GetContainerListParams) WriteToRequest(r runtime.ClientRequest, reg str
|
||||
r.SetTimeout(o.timeout)
|
||||
var res []error
|
||||
|
||||
if o.OpID != nil {
|
||||
|
||||
// header param Op-ID
|
||||
if err := r.SetHeaderParam("Op-ID", *o.OpID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if o.All != nil {
|
||||
|
||||
// query param all
|
||||
|
||||
@@ -81,6 +81,8 @@ for the get container logs operation typically these are written to a http.Reque
|
||||
*/
|
||||
type GetContainerLogsParams struct {
|
||||
|
||||
/*OpID*/
|
||||
OpID *string
|
||||
/*Deadline*/
|
||||
Deadline *int64
|
||||
/*Follow*/
|
||||
@@ -132,6 +134,17 @@ func (o *GetContainerLogsParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithOpID adds the opID to the get container logs params
|
||||
func (o *GetContainerLogsParams) WithOpID(opID *string) *GetContainerLogsParams {
|
||||
o.SetOpID(opID)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetOpID adds the opId to the get container logs params
|
||||
func (o *GetContainerLogsParams) SetOpID(opID *string) {
|
||||
o.OpID = opID
|
||||
}
|
||||
|
||||
// WithDeadline adds the deadline to the get container logs params
|
||||
func (o *GetContainerLogsParams) WithDeadline(deadline *int64) *GetContainerLogsParams {
|
||||
o.SetDeadline(deadline)
|
||||
@@ -204,6 +217,15 @@ func (o *GetContainerLogsParams) WriteToRequest(r runtime.ClientRequest, reg str
|
||||
r.SetTimeout(o.timeout)
|
||||
var res []error
|
||||
|
||||
if o.OpID != nil {
|
||||
|
||||
// header param Op-ID
|
||||
if err := r.SetHeaderParam("Op-ID", *o.OpID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if o.Deadline != nil {
|
||||
|
||||
// query param deadline
|
||||
|
||||
@@ -61,6 +61,8 @@ for the get container stats operation typically these are written to a http.Requ
|
||||
*/
|
||||
type GetContainerStatsParams struct {
|
||||
|
||||
/*OpID*/
|
||||
OpID *string
|
||||
/*ID*/
|
||||
ID string
|
||||
/*Stream*/
|
||||
@@ -104,6 +106,17 @@ func (o *GetContainerStatsParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithOpID adds the opID to the get container stats params
|
||||
func (o *GetContainerStatsParams) WithOpID(opID *string) *GetContainerStatsParams {
|
||||
o.SetOpID(opID)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetOpID adds the opId to the get container stats params
|
||||
func (o *GetContainerStatsParams) SetOpID(opID *string) {
|
||||
o.OpID = opID
|
||||
}
|
||||
|
||||
// WithID adds the id to the get container stats params
|
||||
func (o *GetContainerStatsParams) WithID(id string) *GetContainerStatsParams {
|
||||
o.SetID(id)
|
||||
@@ -132,6 +145,15 @@ func (o *GetContainerStatsParams) WriteToRequest(r runtime.ClientRequest, reg st
|
||||
r.SetTimeout(o.timeout)
|
||||
var res []error
|
||||
|
||||
if o.OpID != nil {
|
||||
|
||||
// header param Op-ID
|
||||
if err := r.SetHeaderParam("Op-ID", *o.OpID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// path param id
|
||||
if err := r.SetPathParam("id", o.ID); err != nil {
|
||||
return err
|
||||
|
||||
@@ -60,6 +60,8 @@ for the get operation typically these are written to a http.Request
|
||||
*/
|
||||
type GetParams struct {
|
||||
|
||||
/*OpID*/
|
||||
OpID *string
|
||||
/*ID*/
|
||||
ID string
|
||||
|
||||
@@ -101,6 +103,17 @@ func (o *GetParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithOpID adds the opID to the get params
|
||||
func (o *GetParams) WithOpID(opID *string) *GetParams {
|
||||
o.SetOpID(opID)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetOpID adds the opId to the get params
|
||||
func (o *GetParams) SetOpID(opID *string) {
|
||||
o.OpID = opID
|
||||
}
|
||||
|
||||
// WithID adds the id to the get params
|
||||
func (o *GetParams) WithID(id string) *GetParams {
|
||||
o.SetID(id)
|
||||
@@ -118,6 +131,15 @@ func (o *GetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry)
|
||||
r.SetTimeout(o.timeout)
|
||||
var res []error
|
||||
|
||||
if o.OpID != nil {
|
||||
|
||||
// header param Op-ID
|
||||
if err := r.SetHeaderParam("Op-ID", *o.OpID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// path param id
|
||||
if err := r.SetPathParam("id", o.ID); err != nil {
|
||||
return err
|
||||
|
||||
@@ -60,6 +60,8 @@ for the get state operation typically these are written to a http.Request
|
||||
*/
|
||||
type GetStateParams struct {
|
||||
|
||||
/*OpID*/
|
||||
OpID *string
|
||||
/*Handle*/
|
||||
Handle string
|
||||
|
||||
@@ -101,6 +103,17 @@ func (o *GetStateParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithOpID adds the opID to the get state params
|
||||
func (o *GetStateParams) WithOpID(opID *string) *GetStateParams {
|
||||
o.SetOpID(opID)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetOpID adds the opId to the get state params
|
||||
func (o *GetStateParams) SetOpID(opID *string) {
|
||||
o.OpID = opID
|
||||
}
|
||||
|
||||
// WithHandle adds the handle to the get state params
|
||||
func (o *GetStateParams) WithHandle(handle string) *GetStateParams {
|
||||
o.SetHandle(handle)
|
||||
@@ -118,6 +131,15 @@ func (o *GetStateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Regi
|
||||
r.SetTimeout(o.timeout)
|
||||
var res []error
|
||||
|
||||
if o.OpID != nil {
|
||||
|
||||
// header param Op-ID
|
||||
if err := r.SetHeaderParam("Op-ID", *o.OpID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// path param handle
|
||||
if err := r.SetPathParam("handle", o.Handle); err != nil {
|
||||
return err
|
||||
|
||||
@@ -60,6 +60,8 @@ for the state change operation typically these are written to a http.Request
|
||||
*/
|
||||
type StateChangeParams struct {
|
||||
|
||||
/*OpID*/
|
||||
OpID *string
|
||||
/*Handle*/
|
||||
Handle string
|
||||
/*State*/
|
||||
@@ -103,6 +105,17 @@ func (o *StateChangeParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithOpID adds the opID to the state change params
|
||||
func (o *StateChangeParams) WithOpID(opID *string) *StateChangeParams {
|
||||
o.SetOpID(opID)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetOpID adds the opId to the state change params
|
||||
func (o *StateChangeParams) SetOpID(opID *string) {
|
||||
o.OpID = opID
|
||||
}
|
||||
|
||||
// WithHandle adds the handle to the state change params
|
||||
func (o *StateChangeParams) WithHandle(handle string) *StateChangeParams {
|
||||
o.SetHandle(handle)
|
||||
@@ -131,6 +144,15 @@ func (o *StateChangeParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R
|
||||
r.SetTimeout(o.timeout)
|
||||
var res []error
|
||||
|
||||
if o.OpID != nil {
|
||||
|
||||
// header param Op-ID
|
||||
if err := r.SetHeaderParam("Op-ID", *o.OpID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// path param handle
|
||||
if err := r.SetPathParam("handle", o.Handle); err != nil {
|
||||
return err
|
||||
|
||||
@@ -19,7 +19,7 @@ import (
|
||||
// NewGetEventsParams creates a new GetEventsParams object
|
||||
// with the default values initialized.
|
||||
func NewGetEventsParams() *GetEventsParams {
|
||||
|
||||
var ()
|
||||
return &GetEventsParams{
|
||||
|
||||
timeout: cr.DefaultTimeout,
|
||||
@@ -29,7 +29,7 @@ func NewGetEventsParams() *GetEventsParams {
|
||||
// NewGetEventsParamsWithTimeout creates a new GetEventsParams object
|
||||
// with the default values initialized, and the ability to set a timeout on a request
|
||||
func NewGetEventsParamsWithTimeout(timeout time.Duration) *GetEventsParams {
|
||||
|
||||
var ()
|
||||
return &GetEventsParams{
|
||||
|
||||
timeout: timeout,
|
||||
@@ -39,7 +39,7 @@ func NewGetEventsParamsWithTimeout(timeout time.Duration) *GetEventsParams {
|
||||
// NewGetEventsParamsWithContext creates a new GetEventsParams object
|
||||
// with the default values initialized, and the ability to set a context for a request
|
||||
func NewGetEventsParamsWithContext(ctx context.Context) *GetEventsParams {
|
||||
|
||||
var ()
|
||||
return &GetEventsParams{
|
||||
|
||||
Context: ctx,
|
||||
@@ -49,7 +49,7 @@ func NewGetEventsParamsWithContext(ctx context.Context) *GetEventsParams {
|
||||
// NewGetEventsParamsWithHTTPClient creates a new GetEventsParams object
|
||||
// with the default values initialized, and the ability to set a custom HTTPClient for a request
|
||||
func NewGetEventsParamsWithHTTPClient(client *http.Client) *GetEventsParams {
|
||||
|
||||
var ()
|
||||
return &GetEventsParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
@@ -59,6 +59,10 @@ func NewGetEventsParamsWithHTTPClient(client *http.Client) *GetEventsParams {
|
||||
for the get events operation typically these are written to a http.Request
|
||||
*/
|
||||
type GetEventsParams struct {
|
||||
|
||||
/*OpID*/
|
||||
OpID *string
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
@@ -97,12 +101,32 @@ func (o *GetEventsParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithOpID adds the opID to the get events params
|
||||
func (o *GetEventsParams) WithOpID(opID *string) *GetEventsParams {
|
||||
o.SetOpID(opID)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetOpID adds the opId to the get events params
|
||||
func (o *GetEventsParams) SetOpID(opID *string) {
|
||||
o.OpID = opID
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *GetEventsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
r.SetTimeout(o.timeout)
|
||||
var res []error
|
||||
|
||||
if o.OpID != nil {
|
||||
|
||||
// header param Op-ID
|
||||
if err := r.SetHeaderParam("Op-ID", *o.OpID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
|
||||
@@ -60,6 +60,8 @@ for the container close stdin operation typically these are written to a http.Re
|
||||
*/
|
||||
type ContainerCloseStdinParams struct {
|
||||
|
||||
/*OpID*/
|
||||
OpID *string
|
||||
/*ID*/
|
||||
ID string
|
||||
|
||||
@@ -101,6 +103,17 @@ func (o *ContainerCloseStdinParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithOpID adds the opID to the container close stdin params
|
||||
func (o *ContainerCloseStdinParams) WithOpID(opID *string) *ContainerCloseStdinParams {
|
||||
o.SetOpID(opID)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetOpID adds the opId to the container close stdin params
|
||||
func (o *ContainerCloseStdinParams) SetOpID(opID *string) {
|
||||
o.OpID = opID
|
||||
}
|
||||
|
||||
// WithID adds the id to the container close stdin params
|
||||
func (o *ContainerCloseStdinParams) WithID(id string) *ContainerCloseStdinParams {
|
||||
o.SetID(id)
|
||||
@@ -118,6 +131,15 @@ func (o *ContainerCloseStdinParams) WriteToRequest(r runtime.ClientRequest, reg
|
||||
r.SetTimeout(o.timeout)
|
||||
var res []error
|
||||
|
||||
if o.OpID != nil {
|
||||
|
||||
// header param Op-ID
|
||||
if err := r.SetHeaderParam("Op-ID", *o.OpID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// path param id
|
||||
if err := r.SetPathParam("id", o.ID); err != nil {
|
||||
return err
|
||||
|
||||
@@ -60,6 +60,8 @@ for the container get stderr operation typically these are written to a http.Req
|
||||
*/
|
||||
type ContainerGetStderrParams struct {
|
||||
|
||||
/*OpID*/
|
||||
OpID *string
|
||||
/*Deadline*/
|
||||
Deadline *strfmt.DateTime
|
||||
/*ID*/
|
||||
@@ -103,6 +105,17 @@ func (o *ContainerGetStderrParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithOpID adds the opID to the container get stderr params
|
||||
func (o *ContainerGetStderrParams) WithOpID(opID *string) *ContainerGetStderrParams {
|
||||
o.SetOpID(opID)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetOpID adds the opId to the container get stderr params
|
||||
func (o *ContainerGetStderrParams) SetOpID(opID *string) {
|
||||
o.OpID = opID
|
||||
}
|
||||
|
||||
// WithDeadline adds the deadline to the container get stderr params
|
||||
func (o *ContainerGetStderrParams) WithDeadline(deadline *strfmt.DateTime) *ContainerGetStderrParams {
|
||||
o.SetDeadline(deadline)
|
||||
@@ -131,6 +144,15 @@ func (o *ContainerGetStderrParams) WriteToRequest(r runtime.ClientRequest, reg s
|
||||
r.SetTimeout(o.timeout)
|
||||
var res []error
|
||||
|
||||
if o.OpID != nil {
|
||||
|
||||
// header param Op-ID
|
||||
if err := r.SetHeaderParam("Op-ID", *o.OpID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if o.Deadline != nil {
|
||||
|
||||
// query param deadline
|
||||
|
||||
@@ -60,6 +60,8 @@ for the container get stdout operation typically these are written to a http.Req
|
||||
*/
|
||||
type ContainerGetStdoutParams struct {
|
||||
|
||||
/*OpID*/
|
||||
OpID *string
|
||||
/*Deadline*/
|
||||
Deadline *strfmt.DateTime
|
||||
/*ID*/
|
||||
@@ -103,6 +105,17 @@ func (o *ContainerGetStdoutParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithOpID adds the opID to the container get stdout params
|
||||
func (o *ContainerGetStdoutParams) WithOpID(opID *string) *ContainerGetStdoutParams {
|
||||
o.SetOpID(opID)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetOpID adds the opId to the container get stdout params
|
||||
func (o *ContainerGetStdoutParams) SetOpID(opID *string) {
|
||||
o.OpID = opID
|
||||
}
|
||||
|
||||
// WithDeadline adds the deadline to the container get stdout params
|
||||
func (o *ContainerGetStdoutParams) WithDeadline(deadline *strfmt.DateTime) *ContainerGetStdoutParams {
|
||||
o.SetDeadline(deadline)
|
||||
@@ -131,6 +144,15 @@ func (o *ContainerGetStdoutParams) WriteToRequest(r runtime.ClientRequest, reg s
|
||||
r.SetTimeout(o.timeout)
|
||||
var res []error
|
||||
|
||||
if o.OpID != nil {
|
||||
|
||||
// header param Op-ID
|
||||
if err := r.SetHeaderParam("Op-ID", *o.OpID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if o.Deadline != nil {
|
||||
|
||||
// query param deadline
|
||||
|
||||
@@ -61,6 +61,8 @@ for the container resize operation typically these are written to a http.Request
|
||||
*/
|
||||
type ContainerResizeParams struct {
|
||||
|
||||
/*OpID*/
|
||||
OpID *string
|
||||
/*Height*/
|
||||
Height int32
|
||||
/*ID*/
|
||||
@@ -106,6 +108,17 @@ func (o *ContainerResizeParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithOpID adds the opID to the container resize params
|
||||
func (o *ContainerResizeParams) WithOpID(opID *string) *ContainerResizeParams {
|
||||
o.SetOpID(opID)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetOpID adds the opId to the container resize params
|
||||
func (o *ContainerResizeParams) SetOpID(opID *string) {
|
||||
o.OpID = opID
|
||||
}
|
||||
|
||||
// WithHeight adds the height to the container resize params
|
||||
func (o *ContainerResizeParams) WithHeight(height int32) *ContainerResizeParams {
|
||||
o.SetHeight(height)
|
||||
@@ -145,6 +158,15 @@ func (o *ContainerResizeParams) WriteToRequest(r runtime.ClientRequest, reg strf
|
||||
r.SetTimeout(o.timeout)
|
||||
var res []error
|
||||
|
||||
if o.OpID != nil {
|
||||
|
||||
// header param Op-ID
|
||||
if err := r.SetHeaderParam("Op-ID", *o.OpID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// query param height
|
||||
qrHeight := o.Height
|
||||
qHeight := swag.FormatInt32(qrHeight)
|
||||
|
||||
@@ -61,6 +61,8 @@ for the container set stdin operation typically these are written to a http.Requ
|
||||
*/
|
||||
type ContainerSetStdinParams struct {
|
||||
|
||||
/*OpID*/
|
||||
OpID *string
|
||||
/*Deadline*/
|
||||
Deadline *strfmt.DateTime
|
||||
/*ID*/
|
||||
@@ -106,6 +108,17 @@ func (o *ContainerSetStdinParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithOpID adds the opID to the container set stdin params
|
||||
func (o *ContainerSetStdinParams) WithOpID(opID *string) *ContainerSetStdinParams {
|
||||
o.SetOpID(opID)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetOpID adds the opId to the container set stdin params
|
||||
func (o *ContainerSetStdinParams) SetOpID(opID *string) {
|
||||
o.OpID = opID
|
||||
}
|
||||
|
||||
// WithDeadline adds the deadline to the container set stdin params
|
||||
func (o *ContainerSetStdinParams) WithDeadline(deadline *strfmt.DateTime) *ContainerSetStdinParams {
|
||||
o.SetDeadline(deadline)
|
||||
@@ -145,6 +158,15 @@ func (o *ContainerSetStdinParams) WriteToRequest(r runtime.ClientRequest, reg st
|
||||
r.SetTimeout(o.timeout)
|
||||
var res []error
|
||||
|
||||
if o.OpID != nil {
|
||||
|
||||
// header param Op-ID
|
||||
if err := r.SetHeaderParam("Op-ID", *o.OpID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if o.Deadline != nil {
|
||||
|
||||
// query param deadline
|
||||
|
||||
@@ -62,6 +62,8 @@ for the interaction bind operation typically these are written to a http.Request
|
||||
*/
|
||||
type InteractionBindParams struct {
|
||||
|
||||
/*OpID*/
|
||||
OpID *string
|
||||
/*Config*/
|
||||
Config *models.InteractionBindConfig
|
||||
|
||||
@@ -103,6 +105,17 @@ func (o *InteractionBindParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithOpID adds the opID to the interaction bind params
|
||||
func (o *InteractionBindParams) WithOpID(opID *string) *InteractionBindParams {
|
||||
o.SetOpID(opID)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetOpID adds the opId to the interaction bind params
|
||||
func (o *InteractionBindParams) SetOpID(opID *string) {
|
||||
o.OpID = opID
|
||||
}
|
||||
|
||||
// WithConfig adds the config to the interaction bind params
|
||||
func (o *InteractionBindParams) WithConfig(config *models.InteractionBindConfig) *InteractionBindParams {
|
||||
o.SetConfig(config)
|
||||
@@ -120,6 +133,15 @@ func (o *InteractionBindParams) WriteToRequest(r runtime.ClientRequest, reg strf
|
||||
r.SetTimeout(o.timeout)
|
||||
var res []error
|
||||
|
||||
if o.OpID != nil {
|
||||
|
||||
// header param Op-ID
|
||||
if err := r.SetHeaderParam("Op-ID", *o.OpID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if o.Config == nil {
|
||||
o.Config = new(models.InteractionBindConfig)
|
||||
}
|
||||
|
||||
@@ -62,6 +62,8 @@ for the interaction join operation typically these are written to a http.Request
|
||||
*/
|
||||
type InteractionJoinParams struct {
|
||||
|
||||
/*OpID*/
|
||||
OpID *string
|
||||
/*Config*/
|
||||
Config *models.InteractionJoinConfig
|
||||
|
||||
@@ -103,6 +105,17 @@ func (o *InteractionJoinParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithOpID adds the opID to the interaction join params
|
||||
func (o *InteractionJoinParams) WithOpID(opID *string) *InteractionJoinParams {
|
||||
o.SetOpID(opID)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetOpID adds the opId to the interaction join params
|
||||
func (o *InteractionJoinParams) SetOpID(opID *string) {
|
||||
o.OpID = opID
|
||||
}
|
||||
|
||||
// WithConfig adds the config to the interaction join params
|
||||
func (o *InteractionJoinParams) WithConfig(config *models.InteractionJoinConfig) *InteractionJoinParams {
|
||||
o.SetConfig(config)
|
||||
@@ -120,6 +133,15 @@ func (o *InteractionJoinParams) WriteToRequest(r runtime.ClientRequest, reg strf
|
||||
r.SetTimeout(o.timeout)
|
||||
var res []error
|
||||
|
||||
if o.OpID != nil {
|
||||
|
||||
// header param Op-ID
|
||||
if err := r.SetHeaderParam("Op-ID", *o.OpID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if o.Config == nil {
|
||||
o.Config = new(models.InteractionJoinConfig)
|
||||
}
|
||||
|
||||
@@ -62,6 +62,8 @@ for the interaction unbind operation typically these are written to a http.Reque
|
||||
*/
|
||||
type InteractionUnbindParams struct {
|
||||
|
||||
/*OpID*/
|
||||
OpID *string
|
||||
/*Config*/
|
||||
Config *models.InteractionUnbindConfig
|
||||
|
||||
@@ -103,6 +105,17 @@ func (o *InteractionUnbindParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithOpID adds the opID to the interaction unbind params
|
||||
func (o *InteractionUnbindParams) WithOpID(opID *string) *InteractionUnbindParams {
|
||||
o.SetOpID(opID)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetOpID adds the opId to the interaction unbind params
|
||||
func (o *InteractionUnbindParams) SetOpID(opID *string) {
|
||||
o.OpID = opID
|
||||
}
|
||||
|
||||
// WithConfig adds the config to the interaction unbind params
|
||||
func (o *InteractionUnbindParams) WithConfig(config *models.InteractionUnbindConfig) *InteractionUnbindParams {
|
||||
o.SetConfig(config)
|
||||
@@ -120,6 +133,15 @@ func (o *InteractionUnbindParams) WriteToRequest(r runtime.ClientRequest, reg st
|
||||
r.SetTimeout(o.timeout)
|
||||
var res []error
|
||||
|
||||
if o.OpID != nil {
|
||||
|
||||
// header param Op-ID
|
||||
if err := r.SetHeaderParam("Op-ID", *o.OpID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if o.Config == nil {
|
||||
o.Config = new(models.InteractionUnbindConfig)
|
||||
}
|
||||
|
||||
@@ -60,6 +60,8 @@ for the delete value operation typically these are written to a http.Request
|
||||
*/
|
||||
type DeleteValueParams struct {
|
||||
|
||||
/*OpID*/
|
||||
OpID *string
|
||||
/*Key*/
|
||||
Key string
|
||||
|
||||
@@ -101,6 +103,17 @@ func (o *DeleteValueParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithOpID adds the opID to the delete value params
|
||||
func (o *DeleteValueParams) WithOpID(opID *string) *DeleteValueParams {
|
||||
o.SetOpID(opID)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetOpID adds the opId to the delete value params
|
||||
func (o *DeleteValueParams) SetOpID(opID *string) {
|
||||
o.OpID = opID
|
||||
}
|
||||
|
||||
// WithKey adds the key to the delete value params
|
||||
func (o *DeleteValueParams) WithKey(key string) *DeleteValueParams {
|
||||
o.SetKey(key)
|
||||
@@ -118,6 +131,15 @@ func (o *DeleteValueParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R
|
||||
r.SetTimeout(o.timeout)
|
||||
var res []error
|
||||
|
||||
if o.OpID != nil {
|
||||
|
||||
// header param Op-ID
|
||||
if err := r.SetHeaderParam("Op-ID", *o.OpID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// path param key
|
||||
if err := r.SetPathParam("key", o.Key); err != nil {
|
||||
return err
|
||||
|
||||
22
vendor/github.com/vmware/vic/lib/apiservers/portlayer/client/kv/get_value_parameters.go
generated
vendored
22
vendor/github.com/vmware/vic/lib/apiservers/portlayer/client/kv/get_value_parameters.go
generated
vendored
@@ -60,6 +60,8 @@ for the get value operation typically these are written to a http.Request
|
||||
*/
|
||||
type GetValueParams struct {
|
||||
|
||||
/*OpID*/
|
||||
OpID *string
|
||||
/*Key*/
|
||||
Key string
|
||||
|
||||
@@ -101,6 +103,17 @@ func (o *GetValueParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithOpID adds the opID to the get value params
|
||||
func (o *GetValueParams) WithOpID(opID *string) *GetValueParams {
|
||||
o.SetOpID(opID)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetOpID adds the opId to the get value params
|
||||
func (o *GetValueParams) SetOpID(opID *string) {
|
||||
o.OpID = opID
|
||||
}
|
||||
|
||||
// WithKey adds the key to the get value params
|
||||
func (o *GetValueParams) WithKey(key string) *GetValueParams {
|
||||
o.SetKey(key)
|
||||
@@ -118,6 +131,15 @@ func (o *GetValueParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Regi
|
||||
r.SetTimeout(o.timeout)
|
||||
var res []error
|
||||
|
||||
if o.OpID != nil {
|
||||
|
||||
// header param Op-ID
|
||||
if err := r.SetHeaderParam("Op-ID", *o.OpID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// path param key
|
||||
if err := r.SetPathParam("key", o.Key); err != nil {
|
||||
return err
|
||||
|
||||
22
vendor/github.com/vmware/vic/lib/apiservers/portlayer/client/kv/put_value_parameters.go
generated
vendored
22
vendor/github.com/vmware/vic/lib/apiservers/portlayer/client/kv/put_value_parameters.go
generated
vendored
@@ -62,6 +62,8 @@ for the put value operation typically these are written to a http.Request
|
||||
*/
|
||||
type PutValueParams struct {
|
||||
|
||||
/*OpID*/
|
||||
OpID *string
|
||||
/*Key*/
|
||||
Key string
|
||||
/*KeyValue*/
|
||||
@@ -105,6 +107,17 @@ func (o *PutValueParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithOpID adds the opID to the put value params
|
||||
func (o *PutValueParams) WithOpID(opID *string) *PutValueParams {
|
||||
o.SetOpID(opID)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetOpID adds the opId to the put value params
|
||||
func (o *PutValueParams) SetOpID(opID *string) {
|
||||
o.OpID = opID
|
||||
}
|
||||
|
||||
// WithKey adds the key to the put value params
|
||||
func (o *PutValueParams) WithKey(key string) *PutValueParams {
|
||||
o.SetKey(key)
|
||||
@@ -133,6 +146,15 @@ func (o *PutValueParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Regi
|
||||
r.SetTimeout(o.timeout)
|
||||
var res []error
|
||||
|
||||
if o.OpID != nil {
|
||||
|
||||
// header param Op-ID
|
||||
if err := r.SetHeaderParam("Op-ID", *o.OpID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// path param key
|
||||
if err := r.SetPathParam("key", o.Key); err != nil {
|
||||
return err
|
||||
|
||||
@@ -62,6 +62,8 @@ for the logging bind operation typically these are written to a http.Request
|
||||
*/
|
||||
type LoggingBindParams struct {
|
||||
|
||||
/*OpID*/
|
||||
OpID *string
|
||||
/*Config*/
|
||||
Config *models.LoggingBindConfig
|
||||
|
||||
@@ -103,6 +105,17 @@ func (o *LoggingBindParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithOpID adds the opID to the logging bind params
|
||||
func (o *LoggingBindParams) WithOpID(opID *string) *LoggingBindParams {
|
||||
o.SetOpID(opID)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetOpID adds the opId to the logging bind params
|
||||
func (o *LoggingBindParams) SetOpID(opID *string) {
|
||||
o.OpID = opID
|
||||
}
|
||||
|
||||
// WithConfig adds the config to the logging bind params
|
||||
func (o *LoggingBindParams) WithConfig(config *models.LoggingBindConfig) *LoggingBindParams {
|
||||
o.SetConfig(config)
|
||||
@@ -120,6 +133,15 @@ func (o *LoggingBindParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R
|
||||
r.SetTimeout(o.timeout)
|
||||
var res []error
|
||||
|
||||
if o.OpID != nil {
|
||||
|
||||
// header param Op-ID
|
||||
if err := r.SetHeaderParam("Op-ID", *o.OpID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if o.Config == nil {
|
||||
o.Config = new(models.LoggingBindConfig)
|
||||
}
|
||||
|
||||
@@ -62,6 +62,8 @@ for the logging join operation typically these are written to a http.Request
|
||||
*/
|
||||
type LoggingJoinParams struct {
|
||||
|
||||
/*OpID*/
|
||||
OpID *string
|
||||
/*Config*/
|
||||
Config *models.LoggingJoinConfig
|
||||
|
||||
@@ -103,6 +105,17 @@ func (o *LoggingJoinParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithOpID adds the opID to the logging join params
|
||||
func (o *LoggingJoinParams) WithOpID(opID *string) *LoggingJoinParams {
|
||||
o.SetOpID(opID)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetOpID adds the opId to the logging join params
|
||||
func (o *LoggingJoinParams) SetOpID(opID *string) {
|
||||
o.OpID = opID
|
||||
}
|
||||
|
||||
// WithConfig adds the config to the logging join params
|
||||
func (o *LoggingJoinParams) WithConfig(config *models.LoggingJoinConfig) *LoggingJoinParams {
|
||||
o.SetConfig(config)
|
||||
@@ -120,6 +133,15 @@ func (o *LoggingJoinParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R
|
||||
r.SetTimeout(o.timeout)
|
||||
var res []error
|
||||
|
||||
if o.OpID != nil {
|
||||
|
||||
// header param Op-ID
|
||||
if err := r.SetHeaderParam("Op-ID", *o.OpID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if o.Config == nil {
|
||||
o.Config = new(models.LoggingJoinConfig)
|
||||
}
|
||||
|
||||
@@ -62,6 +62,8 @@ for the logging unbind operation typically these are written to a http.Request
|
||||
*/
|
||||
type LoggingUnbindParams struct {
|
||||
|
||||
/*OpID*/
|
||||
OpID *string
|
||||
/*Config*/
|
||||
Config *models.LoggingUnbindConfig
|
||||
|
||||
@@ -103,6 +105,17 @@ func (o *LoggingUnbindParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithOpID adds the opID to the logging unbind params
|
||||
func (o *LoggingUnbindParams) WithOpID(opID *string) *LoggingUnbindParams {
|
||||
o.SetOpID(opID)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetOpID adds the opId to the logging unbind params
|
||||
func (o *LoggingUnbindParams) SetOpID(opID *string) {
|
||||
o.OpID = opID
|
||||
}
|
||||
|
||||
// WithConfig adds the config to the logging unbind params
|
||||
func (o *LoggingUnbindParams) WithConfig(config *models.LoggingUnbindConfig) *LoggingUnbindParams {
|
||||
o.SetConfig(config)
|
||||
@@ -120,6 +133,15 @@ func (o *LoggingUnbindParams) WriteToRequest(r runtime.ClientRequest, reg strfmt
|
||||
r.SetTimeout(o.timeout)
|
||||
var res []error
|
||||
|
||||
if o.OpID != nil {
|
||||
|
||||
// header param Op-ID
|
||||
if err := r.SetHeaderParam("Op-ID", *o.OpID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if o.Config == nil {
|
||||
o.Config = new(models.LoggingUnbindConfig)
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ import (
|
||||
// NewGetVCHInfoParams creates a new GetVCHInfoParams object
|
||||
// with the default values initialized.
|
||||
func NewGetVCHInfoParams() *GetVCHInfoParams {
|
||||
|
||||
var ()
|
||||
return &GetVCHInfoParams{
|
||||
|
||||
timeout: cr.DefaultTimeout,
|
||||
@@ -29,7 +29,7 @@ func NewGetVCHInfoParams() *GetVCHInfoParams {
|
||||
// NewGetVCHInfoParamsWithTimeout creates a new GetVCHInfoParams object
|
||||
// with the default values initialized, and the ability to set a timeout on a request
|
||||
func NewGetVCHInfoParamsWithTimeout(timeout time.Duration) *GetVCHInfoParams {
|
||||
|
||||
var ()
|
||||
return &GetVCHInfoParams{
|
||||
|
||||
timeout: timeout,
|
||||
@@ -39,7 +39,7 @@ func NewGetVCHInfoParamsWithTimeout(timeout time.Duration) *GetVCHInfoParams {
|
||||
// NewGetVCHInfoParamsWithContext creates a new GetVCHInfoParams object
|
||||
// with the default values initialized, and the ability to set a context for a request
|
||||
func NewGetVCHInfoParamsWithContext(ctx context.Context) *GetVCHInfoParams {
|
||||
|
||||
var ()
|
||||
return &GetVCHInfoParams{
|
||||
|
||||
Context: ctx,
|
||||
@@ -49,7 +49,7 @@ func NewGetVCHInfoParamsWithContext(ctx context.Context) *GetVCHInfoParams {
|
||||
// NewGetVCHInfoParamsWithHTTPClient creates a new GetVCHInfoParams object
|
||||
// with the default values initialized, and the ability to set a custom HTTPClient for a request
|
||||
func NewGetVCHInfoParamsWithHTTPClient(client *http.Client) *GetVCHInfoParams {
|
||||
|
||||
var ()
|
||||
return &GetVCHInfoParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
@@ -59,6 +59,10 @@ func NewGetVCHInfoParamsWithHTTPClient(client *http.Client) *GetVCHInfoParams {
|
||||
for the get v c h info operation typically these are written to a http.Request
|
||||
*/
|
||||
type GetVCHInfoParams struct {
|
||||
|
||||
/*OpID*/
|
||||
OpID *string
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
@@ -97,12 +101,32 @@ func (o *GetVCHInfoParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithOpID adds the opID to the get v c h info params
|
||||
func (o *GetVCHInfoParams) WithOpID(opID *string) *GetVCHInfoParams {
|
||||
o.SetOpID(opID)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetOpID adds the opId to the get v c h info params
|
||||
func (o *GetVCHInfoParams) SetOpID(opID *string) {
|
||||
o.OpID = opID
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *GetVCHInfoParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
r.SetTimeout(o.timeout)
|
||||
var res []error
|
||||
|
||||
if o.OpID != nil {
|
||||
|
||||
// header param Op-ID
|
||||
if err := r.SetHeaderParam("Op-ID", *o.OpID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
|
||||
@@ -62,6 +62,8 @@ for the add container operation typically these are written to a http.Request
|
||||
*/
|
||||
type AddContainerParams struct {
|
||||
|
||||
/*OpID*/
|
||||
OpID *string
|
||||
/*Config*/
|
||||
Config *models.ScopesAddContainerConfig
|
||||
/*Scope*/
|
||||
@@ -105,6 +107,17 @@ func (o *AddContainerParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithOpID adds the opID to the add container params
|
||||
func (o *AddContainerParams) WithOpID(opID *string) *AddContainerParams {
|
||||
o.SetOpID(opID)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetOpID adds the opId to the add container params
|
||||
func (o *AddContainerParams) SetOpID(opID *string) {
|
||||
o.OpID = opID
|
||||
}
|
||||
|
||||
// WithConfig adds the config to the add container params
|
||||
func (o *AddContainerParams) WithConfig(config *models.ScopesAddContainerConfig) *AddContainerParams {
|
||||
o.SetConfig(config)
|
||||
@@ -133,6 +146,15 @@ func (o *AddContainerParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.
|
||||
r.SetTimeout(o.timeout)
|
||||
var res []error
|
||||
|
||||
if o.OpID != nil {
|
||||
|
||||
// header param Op-ID
|
||||
if err := r.SetHeaderParam("Op-ID", *o.OpID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if o.Config == nil {
|
||||
o.Config = new(models.ScopesAddContainerConfig)
|
||||
}
|
||||
|
||||
@@ -60,6 +60,8 @@ for the bind container operation typically these are written to a http.Request
|
||||
*/
|
||||
type BindContainerParams struct {
|
||||
|
||||
/*OpID*/
|
||||
OpID *string
|
||||
/*Handle*/
|
||||
Handle string
|
||||
|
||||
@@ -101,6 +103,17 @@ func (o *BindContainerParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithOpID adds the opID to the bind container params
|
||||
func (o *BindContainerParams) WithOpID(opID *string) *BindContainerParams {
|
||||
o.SetOpID(opID)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetOpID adds the opId to the bind container params
|
||||
func (o *BindContainerParams) SetOpID(opID *string) {
|
||||
o.OpID = opID
|
||||
}
|
||||
|
||||
// WithHandle adds the handle to the bind container params
|
||||
func (o *BindContainerParams) WithHandle(handle string) *BindContainerParams {
|
||||
o.SetHandle(handle)
|
||||
@@ -118,6 +131,15 @@ func (o *BindContainerParams) WriteToRequest(r runtime.ClientRequest, reg strfmt
|
||||
r.SetTimeout(o.timeout)
|
||||
var res []error
|
||||
|
||||
if o.OpID != nil {
|
||||
|
||||
// header param Op-ID
|
||||
if err := r.SetHeaderParam("Op-ID", *o.OpID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// path param handle
|
||||
if err := r.SetPathParam("handle", o.Handle); err != nil {
|
||||
return err
|
||||
|
||||
@@ -62,6 +62,8 @@ for the create scope operation typically these are written to a http.Request
|
||||
*/
|
||||
type CreateScopeParams struct {
|
||||
|
||||
/*OpID*/
|
||||
OpID *string
|
||||
/*Config*/
|
||||
Config *models.ScopeConfig
|
||||
|
||||
@@ -103,6 +105,17 @@ func (o *CreateScopeParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithOpID adds the opID to the create scope params
|
||||
func (o *CreateScopeParams) WithOpID(opID *string) *CreateScopeParams {
|
||||
o.SetOpID(opID)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetOpID adds the opId to the create scope params
|
||||
func (o *CreateScopeParams) SetOpID(opID *string) {
|
||||
o.OpID = opID
|
||||
}
|
||||
|
||||
// WithConfig adds the config to the create scope params
|
||||
func (o *CreateScopeParams) WithConfig(config *models.ScopeConfig) *CreateScopeParams {
|
||||
o.SetConfig(config)
|
||||
@@ -120,6 +133,15 @@ func (o *CreateScopeParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R
|
||||
r.SetTimeout(o.timeout)
|
||||
var res []error
|
||||
|
||||
if o.OpID != nil {
|
||||
|
||||
// header param Op-ID
|
||||
if err := r.SetHeaderParam("Op-ID", *o.OpID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if o.Config == nil {
|
||||
o.Config = new(models.ScopeConfig)
|
||||
}
|
||||
|
||||
@@ -60,6 +60,8 @@ for the delete scope operation typically these are written to a http.Request
|
||||
*/
|
||||
type DeleteScopeParams struct {
|
||||
|
||||
/*OpID*/
|
||||
OpID *string
|
||||
/*IDName*/
|
||||
IDName string
|
||||
|
||||
@@ -101,6 +103,17 @@ func (o *DeleteScopeParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithOpID adds the opID to the delete scope params
|
||||
func (o *DeleteScopeParams) WithOpID(opID *string) *DeleteScopeParams {
|
||||
o.SetOpID(opID)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetOpID adds the opId to the delete scope params
|
||||
func (o *DeleteScopeParams) SetOpID(opID *string) {
|
||||
o.OpID = opID
|
||||
}
|
||||
|
||||
// WithIDName adds the iDName to the delete scope params
|
||||
func (o *DeleteScopeParams) WithIDName(iDName string) *DeleteScopeParams {
|
||||
o.SetIDName(iDName)
|
||||
@@ -118,6 +131,15 @@ func (o *DeleteScopeParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R
|
||||
r.SetTimeout(o.timeout)
|
||||
var res []error
|
||||
|
||||
if o.OpID != nil {
|
||||
|
||||
// header param Op-ID
|
||||
if err := r.SetHeaderParam("Op-ID", *o.OpID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// path param idName
|
||||
if err := r.SetPathParam("idName", o.IDName); err != nil {
|
||||
return err
|
||||
|
||||
@@ -60,6 +60,8 @@ for the get container endpoints operation typically these are written to a http.
|
||||
*/
|
||||
type GetContainerEndpointsParams struct {
|
||||
|
||||
/*OpID*/
|
||||
OpID *string
|
||||
/*HandleOrID*/
|
||||
HandleOrID string
|
||||
|
||||
@@ -101,6 +103,17 @@ func (o *GetContainerEndpointsParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithOpID adds the opID to the get container endpoints params
|
||||
func (o *GetContainerEndpointsParams) WithOpID(opID *string) *GetContainerEndpointsParams {
|
||||
o.SetOpID(opID)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetOpID adds the opId to the get container endpoints params
|
||||
func (o *GetContainerEndpointsParams) SetOpID(opID *string) {
|
||||
o.OpID = opID
|
||||
}
|
||||
|
||||
// WithHandleOrID adds the handleOrID to the get container endpoints params
|
||||
func (o *GetContainerEndpointsParams) WithHandleOrID(handleOrID string) *GetContainerEndpointsParams {
|
||||
o.SetHandleOrID(handleOrID)
|
||||
@@ -118,6 +131,15 @@ func (o *GetContainerEndpointsParams) WriteToRequest(r runtime.ClientRequest, re
|
||||
r.SetTimeout(o.timeout)
|
||||
var res []error
|
||||
|
||||
if o.OpID != nil {
|
||||
|
||||
// header param Op-ID
|
||||
if err := r.SetHeaderParam("Op-ID", *o.OpID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// path param handleOrId
|
||||
if err := r.SetPathParam("handleOrId", o.HandleOrID); err != nil {
|
||||
return err
|
||||
|
||||
@@ -19,7 +19,7 @@ import (
|
||||
// NewListAllParams creates a new ListAllParams object
|
||||
// with the default values initialized.
|
||||
func NewListAllParams() *ListAllParams {
|
||||
|
||||
var ()
|
||||
return &ListAllParams{
|
||||
|
||||
timeout: cr.DefaultTimeout,
|
||||
@@ -29,7 +29,7 @@ func NewListAllParams() *ListAllParams {
|
||||
// NewListAllParamsWithTimeout creates a new ListAllParams object
|
||||
// with the default values initialized, and the ability to set a timeout on a request
|
||||
func NewListAllParamsWithTimeout(timeout time.Duration) *ListAllParams {
|
||||
|
||||
var ()
|
||||
return &ListAllParams{
|
||||
|
||||
timeout: timeout,
|
||||
@@ -39,7 +39,7 @@ func NewListAllParamsWithTimeout(timeout time.Duration) *ListAllParams {
|
||||
// NewListAllParamsWithContext creates a new ListAllParams object
|
||||
// with the default values initialized, and the ability to set a context for a request
|
||||
func NewListAllParamsWithContext(ctx context.Context) *ListAllParams {
|
||||
|
||||
var ()
|
||||
return &ListAllParams{
|
||||
|
||||
Context: ctx,
|
||||
@@ -49,7 +49,7 @@ func NewListAllParamsWithContext(ctx context.Context) *ListAllParams {
|
||||
// NewListAllParamsWithHTTPClient creates a new ListAllParams object
|
||||
// with the default values initialized, and the ability to set a custom HTTPClient for a request
|
||||
func NewListAllParamsWithHTTPClient(client *http.Client) *ListAllParams {
|
||||
|
||||
var ()
|
||||
return &ListAllParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
@@ -59,6 +59,10 @@ func NewListAllParamsWithHTTPClient(client *http.Client) *ListAllParams {
|
||||
for the list all operation typically these are written to a http.Request
|
||||
*/
|
||||
type ListAllParams struct {
|
||||
|
||||
/*OpID*/
|
||||
OpID *string
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
@@ -97,12 +101,32 @@ func (o *ListAllParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithOpID adds the opID to the list all params
|
||||
func (o *ListAllParams) WithOpID(opID *string) *ListAllParams {
|
||||
o.SetOpID(opID)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetOpID adds the opId to the list all params
|
||||
func (o *ListAllParams) SetOpID(opID *string) {
|
||||
o.OpID = opID
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *ListAllParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
r.SetTimeout(o.timeout)
|
||||
var res []error
|
||||
|
||||
if o.OpID != nil {
|
||||
|
||||
// header param Op-ID
|
||||
if err := r.SetHeaderParam("Op-ID", *o.OpID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
|
||||
22
vendor/github.com/vmware/vic/lib/apiservers/portlayer/client/scopes/list_parameters.go
generated
vendored
22
vendor/github.com/vmware/vic/lib/apiservers/portlayer/client/scopes/list_parameters.go
generated
vendored
@@ -60,6 +60,8 @@ for the list operation typically these are written to a http.Request
|
||||
*/
|
||||
type ListParams struct {
|
||||
|
||||
/*OpID*/
|
||||
OpID *string
|
||||
/*IDName*/
|
||||
IDName string
|
||||
|
||||
@@ -101,6 +103,17 @@ func (o *ListParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithOpID adds the opID to the list params
|
||||
func (o *ListParams) WithOpID(opID *string) *ListParams {
|
||||
o.SetOpID(opID)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetOpID adds the opId to the list params
|
||||
func (o *ListParams) SetOpID(opID *string) {
|
||||
o.OpID = opID
|
||||
}
|
||||
|
||||
// WithIDName adds the iDName to the list params
|
||||
func (o *ListParams) WithIDName(iDName string) *ListParams {
|
||||
o.SetIDName(iDName)
|
||||
@@ -118,6 +131,15 @@ func (o *ListParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry
|
||||
r.SetTimeout(o.timeout)
|
||||
var res []error
|
||||
|
||||
if o.OpID != nil {
|
||||
|
||||
// header param Op-ID
|
||||
if err := r.SetHeaderParam("Op-ID", *o.OpID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// path param idName
|
||||
if err := r.SetPathParam("idName", o.IDName); err != nil {
|
||||
return err
|
||||
|
||||
@@ -60,6 +60,8 @@ for the remove container operation typically these are written to a http.Request
|
||||
*/
|
||||
type RemoveContainerParams struct {
|
||||
|
||||
/*OpID*/
|
||||
OpID *string
|
||||
/*Handle*/
|
||||
Handle string
|
||||
/*Scope*/
|
||||
@@ -103,6 +105,17 @@ func (o *RemoveContainerParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithOpID adds the opID to the remove container params
|
||||
func (o *RemoveContainerParams) WithOpID(opID *string) *RemoveContainerParams {
|
||||
o.SetOpID(opID)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetOpID adds the opId to the remove container params
|
||||
func (o *RemoveContainerParams) SetOpID(opID *string) {
|
||||
o.OpID = opID
|
||||
}
|
||||
|
||||
// WithHandle adds the handle to the remove container params
|
||||
func (o *RemoveContainerParams) WithHandle(handle string) *RemoveContainerParams {
|
||||
o.SetHandle(handle)
|
||||
@@ -131,6 +144,15 @@ func (o *RemoveContainerParams) WriteToRequest(r runtime.ClientRequest, reg strf
|
||||
r.SetTimeout(o.timeout)
|
||||
var res []error
|
||||
|
||||
if o.OpID != nil {
|
||||
|
||||
// header param Op-ID
|
||||
if err := r.SetHeaderParam("Op-ID", *o.OpID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// path param handle
|
||||
if err := r.SetPathParam("handle", o.Handle); err != nil {
|
||||
return err
|
||||
|
||||
@@ -60,6 +60,8 @@ for the unbind container operation typically these are written to a http.Request
|
||||
*/
|
||||
type UnbindContainerParams struct {
|
||||
|
||||
/*OpID*/
|
||||
OpID *string
|
||||
/*Handle*/
|
||||
Handle string
|
||||
|
||||
@@ -101,6 +103,17 @@ func (o *UnbindContainerParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithOpID adds the opID to the unbind container params
|
||||
func (o *UnbindContainerParams) WithOpID(opID *string) *UnbindContainerParams {
|
||||
o.SetOpID(opID)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetOpID adds the opId to the unbind container params
|
||||
func (o *UnbindContainerParams) SetOpID(opID *string) {
|
||||
o.OpID = opID
|
||||
}
|
||||
|
||||
// WithHandle adds the handle to the unbind container params
|
||||
func (o *UnbindContainerParams) WithHandle(handle string) *UnbindContainerParams {
|
||||
o.SetHandle(handle)
|
||||
@@ -118,6 +131,15 @@ func (o *UnbindContainerParams) WriteToRequest(r runtime.ClientRequest, reg strf
|
||||
r.SetTimeout(o.timeout)
|
||||
var res []error
|
||||
|
||||
if o.OpID != nil {
|
||||
|
||||
// header param Op-ID
|
||||
if err := r.SetHeaderParam("Op-ID", *o.OpID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// path param handle
|
||||
if err := r.SetPathParam("handle", o.Handle); err != nil {
|
||||
return err
|
||||
|
||||
@@ -62,6 +62,8 @@ for the create image store operation typically these are written to a http.Reque
|
||||
*/
|
||||
type CreateImageStoreParams struct {
|
||||
|
||||
/*OpID*/
|
||||
OpID *string
|
||||
/*Body*/
|
||||
Body *models.ImageStore
|
||||
|
||||
@@ -103,6 +105,17 @@ func (o *CreateImageStoreParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithOpID adds the opID to the create image store params
|
||||
func (o *CreateImageStoreParams) WithOpID(opID *string) *CreateImageStoreParams {
|
||||
o.SetOpID(opID)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetOpID adds the opId to the create image store params
|
||||
func (o *CreateImageStoreParams) SetOpID(opID *string) {
|
||||
o.OpID = opID
|
||||
}
|
||||
|
||||
// WithBody adds the body to the create image store params
|
||||
func (o *CreateImageStoreParams) WithBody(body *models.ImageStore) *CreateImageStoreParams {
|
||||
o.SetBody(body)
|
||||
@@ -120,6 +133,15 @@ func (o *CreateImageStoreParams) WriteToRequest(r runtime.ClientRequest, reg str
|
||||
r.SetTimeout(o.timeout)
|
||||
var res []error
|
||||
|
||||
if o.OpID != nil {
|
||||
|
||||
// header param Op-ID
|
||||
if err := r.SetHeaderParam("Op-ID", *o.OpID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if o.Body == nil {
|
||||
o.Body = new(models.ImageStore)
|
||||
}
|
||||
|
||||
@@ -62,6 +62,8 @@ for the create volume operation typically these are written to a http.Request
|
||||
*/
|
||||
type CreateVolumeParams struct {
|
||||
|
||||
/*OpID*/
|
||||
OpID *string
|
||||
/*VolumeRequest*/
|
||||
VolumeRequest *models.VolumeRequest
|
||||
|
||||
@@ -103,6 +105,17 @@ func (o *CreateVolumeParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithOpID adds the opID to the create volume params
|
||||
func (o *CreateVolumeParams) WithOpID(opID *string) *CreateVolumeParams {
|
||||
o.SetOpID(opID)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetOpID adds the opId to the create volume params
|
||||
func (o *CreateVolumeParams) SetOpID(opID *string) {
|
||||
o.OpID = opID
|
||||
}
|
||||
|
||||
// WithVolumeRequest adds the volumeRequest to the create volume params
|
||||
func (o *CreateVolumeParams) WithVolumeRequest(volumeRequest *models.VolumeRequest) *CreateVolumeParams {
|
||||
o.SetVolumeRequest(volumeRequest)
|
||||
@@ -120,6 +133,15 @@ func (o *CreateVolumeParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.
|
||||
r.SetTimeout(o.timeout)
|
||||
var res []error
|
||||
|
||||
if o.OpID != nil {
|
||||
|
||||
// header param Op-ID
|
||||
if err := r.SetHeaderParam("Op-ID", *o.OpID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if o.VolumeRequest == nil {
|
||||
o.VolumeRequest = new(models.VolumeRequest)
|
||||
}
|
||||
|
||||
@@ -61,6 +61,8 @@ for the delete image operation typically these are written to a http.Request
|
||||
*/
|
||||
type DeleteImageParams struct {
|
||||
|
||||
/*OpID*/
|
||||
OpID *string
|
||||
/*ID*/
|
||||
ID string
|
||||
/*KeepNodes*/
|
||||
@@ -106,6 +108,17 @@ func (o *DeleteImageParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithOpID adds the opID to the delete image params
|
||||
func (o *DeleteImageParams) WithOpID(opID *string) *DeleteImageParams {
|
||||
o.SetOpID(opID)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetOpID adds the opId to the delete image params
|
||||
func (o *DeleteImageParams) SetOpID(opID *string) {
|
||||
o.OpID = opID
|
||||
}
|
||||
|
||||
// WithID adds the id to the delete image params
|
||||
func (o *DeleteImageParams) WithID(id string) *DeleteImageParams {
|
||||
o.SetID(id)
|
||||
@@ -145,6 +158,15 @@ func (o *DeleteImageParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R
|
||||
r.SetTimeout(o.timeout)
|
||||
var res []error
|
||||
|
||||
if o.OpID != nil {
|
||||
|
||||
// header param Op-ID
|
||||
if err := r.SetHeaderParam("Op-ID", *o.OpID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// path param id
|
||||
if err := r.SetPathParam("id", o.ID); err != nil {
|
||||
return err
|
||||
|
||||
@@ -61,6 +61,8 @@ for the export archive operation typically these are written to a http.Request
|
||||
*/
|
||||
type ExportArchiveParams struct {
|
||||
|
||||
/*OpID*/
|
||||
OpID *string
|
||||
/*Ancestor*/
|
||||
Ancestor *string
|
||||
/*AncestorStore*/
|
||||
@@ -112,6 +114,17 @@ func (o *ExportArchiveParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithOpID adds the opID to the export archive params
|
||||
func (o *ExportArchiveParams) WithOpID(opID *string) *ExportArchiveParams {
|
||||
o.SetOpID(opID)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetOpID adds the opId to the export archive params
|
||||
func (o *ExportArchiveParams) SetOpID(opID *string) {
|
||||
o.OpID = opID
|
||||
}
|
||||
|
||||
// WithAncestor adds the ancestor to the export archive params
|
||||
func (o *ExportArchiveParams) WithAncestor(ancestor *string) *ExportArchiveParams {
|
||||
o.SetAncestor(ancestor)
|
||||
@@ -184,6 +197,15 @@ func (o *ExportArchiveParams) WriteToRequest(r runtime.ClientRequest, reg strfmt
|
||||
r.SetTimeout(o.timeout)
|
||||
var res []error
|
||||
|
||||
if o.OpID != nil {
|
||||
|
||||
// header param Op-ID
|
||||
if err := r.SetHeaderParam("Op-ID", *o.OpID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if o.Ancestor != nil {
|
||||
|
||||
// query param ancestor
|
||||
|
||||
@@ -60,6 +60,8 @@ for the get image operation typically these are written to a http.Request
|
||||
*/
|
||||
type GetImageParams struct {
|
||||
|
||||
/*OpID*/
|
||||
OpID *string
|
||||
/*ID*/
|
||||
ID string
|
||||
/*StoreName*/
|
||||
@@ -103,6 +105,17 @@ func (o *GetImageParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithOpID adds the opID to the get image params
|
||||
func (o *GetImageParams) WithOpID(opID *string) *GetImageParams {
|
||||
o.SetOpID(opID)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetOpID adds the opId to the get image params
|
||||
func (o *GetImageParams) SetOpID(opID *string) {
|
||||
o.OpID = opID
|
||||
}
|
||||
|
||||
// WithID adds the id to the get image params
|
||||
func (o *GetImageParams) WithID(id string) *GetImageParams {
|
||||
o.SetID(id)
|
||||
@@ -131,6 +144,15 @@ func (o *GetImageParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Regi
|
||||
r.SetTimeout(o.timeout)
|
||||
var res []error
|
||||
|
||||
if o.OpID != nil {
|
||||
|
||||
// header param Op-ID
|
||||
if err := r.SetHeaderParam("Op-ID", *o.OpID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// path param id
|
||||
if err := r.SetPathParam("id", o.ID); err != nil {
|
||||
return err
|
||||
|
||||
@@ -60,6 +60,8 @@ for the get image tar operation typically these are written to a http.Request
|
||||
*/
|
||||
type GetImageTarParams struct {
|
||||
|
||||
/*OpID*/
|
||||
OpID *string
|
||||
/*ID*/
|
||||
ID string
|
||||
/*StoreName*/
|
||||
@@ -103,6 +105,17 @@ func (o *GetImageTarParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithOpID adds the opID to the get image tar params
|
||||
func (o *GetImageTarParams) WithOpID(opID *string) *GetImageTarParams {
|
||||
o.SetOpID(opID)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetOpID adds the opId to the get image tar params
|
||||
func (o *GetImageTarParams) SetOpID(opID *string) {
|
||||
o.OpID = opID
|
||||
}
|
||||
|
||||
// WithID adds the id to the get image tar params
|
||||
func (o *GetImageTarParams) WithID(id string) *GetImageTarParams {
|
||||
o.SetID(id)
|
||||
@@ -131,6 +144,15 @@ func (o *GetImageTarParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R
|
||||
r.SetTimeout(o.timeout)
|
||||
var res []error
|
||||
|
||||
if o.OpID != nil {
|
||||
|
||||
// header param Op-ID
|
||||
if err := r.SetHeaderParam("Op-ID", *o.OpID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// path param id
|
||||
if err := r.SetPathParam("id", o.ID); err != nil {
|
||||
return err
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user