From 209751c85d95be4387580f981d0ef4d960171006 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Thu, 18 Jul 2019 16:11:57 +0000 Subject: [PATCH] Generated from a23d0bdd515690bb563e778441c8428272e222df fix some readme.go.md files --- profiles/latest/aad/mgmt/aad/aadapi/models.go | 26 + profiles/latest/aad/mgmt/aad/models.go | 95 ++ .../preview/aad/mgmt/aad/aadapi/models.go | 26 + profiles/preview/aad/mgmt/aad/models.go | 95 ++ .../devops/mgmt/devops/devopsapi/models.go | 26 + .../preview/devops/mgmt/devops/models.go | 134 +++ .../mgmt/2017-04-01/aad/aadapi/interfaces.go | 48 + services/aad/mgmt/2017-04-01/aad/client.go | 49 + .../mgmt/2017-04-01/aad/diagnosticsettings.go | 333 +++++++ .../aad/diagnosticsettingscategory.go | 109 +++ services/aad/mgmt/2017-04-01/aad/models.go | 315 ++++++ .../aad/mgmt/2017-04-01/aad/operations.go | 109 +++ services/aad/mgmt/2017-04-01/aad/version.go | 30 + .../mgmt/2019-07-01-preview/devops/client.go | 51 + .../devops/devopsapi/interfaces.go | 50 + .../mgmt/2019-07-01-preview/devops/models.go | 914 ++++++++++++++++++ .../2019-07-01-preview/devops/operations.go | 147 +++ .../2019-07-01-preview/devops/pipelines.go | 599 ++++++++++++ .../devops/pipelinetemplatedefinitions.go | 147 +++ .../mgmt/2019-07-01-preview/devops/version.go | 30 + 20 files changed, 3333 insertions(+) create mode 100644 profiles/latest/aad/mgmt/aad/aadapi/models.go create mode 100644 profiles/latest/aad/mgmt/aad/models.go create mode 100644 profiles/preview/aad/mgmt/aad/aadapi/models.go create mode 100644 profiles/preview/aad/mgmt/aad/models.go create mode 100644 profiles/preview/preview/devops/mgmt/devops/devopsapi/models.go create mode 100644 profiles/preview/preview/devops/mgmt/devops/models.go create mode 100644 services/aad/mgmt/2017-04-01/aad/aadapi/interfaces.go create mode 100644 services/aad/mgmt/2017-04-01/aad/client.go create mode 100644 services/aad/mgmt/2017-04-01/aad/diagnosticsettings.go create mode 100644 services/aad/mgmt/2017-04-01/aad/diagnosticsettingscategory.go create mode 100644 services/aad/mgmt/2017-04-01/aad/models.go create mode 100644 services/aad/mgmt/2017-04-01/aad/operations.go create mode 100644 services/aad/mgmt/2017-04-01/aad/version.go create mode 100644 services/preview/devops/mgmt/2019-07-01-preview/devops/client.go create mode 100644 services/preview/devops/mgmt/2019-07-01-preview/devops/devopsapi/interfaces.go create mode 100644 services/preview/devops/mgmt/2019-07-01-preview/devops/models.go create mode 100644 services/preview/devops/mgmt/2019-07-01-preview/devops/operations.go create mode 100644 services/preview/devops/mgmt/2019-07-01-preview/devops/pipelines.go create mode 100644 services/preview/devops/mgmt/2019-07-01-preview/devops/pipelinetemplatedefinitions.go create mode 100644 services/preview/devops/mgmt/2019-07-01-preview/devops/version.go diff --git a/profiles/latest/aad/mgmt/aad/aadapi/models.go b/profiles/latest/aad/mgmt/aad/aadapi/models.go new file mode 100644 index 000000000000..3bfa5c73d4cc --- /dev/null +++ b/profiles/latest/aad/mgmt/aad/aadapi/models.go @@ -0,0 +1,26 @@ +// +build go1.9 + +// Copyright 2019 Microsoft Corporation +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// This code was auto-generated by: +// github.com/Azure/azure-sdk-for-go/tools/profileBuilder + +package aadapi + +import original "github.com/Azure/azure-sdk-for-go/services/aad/mgmt/2017-04-01/aad/aadapi" + +type DiagnosticSettingsCategoryClientAPI = original.DiagnosticSettingsCategoryClientAPI +type DiagnosticSettingsClientAPI = original.DiagnosticSettingsClientAPI +type OperationsClientAPI = original.OperationsClientAPI diff --git a/profiles/latest/aad/mgmt/aad/models.go b/profiles/latest/aad/mgmt/aad/models.go new file mode 100644 index 000000000000..e16bc5cedaee --- /dev/null +++ b/profiles/latest/aad/mgmt/aad/models.go @@ -0,0 +1,95 @@ +// +build go1.9 + +// Copyright 2019 Microsoft Corporation +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// This code was auto-generated by: +// github.com/Azure/azure-sdk-for-go/tools/profileBuilder + +package aad + +import original "github.com/Azure/azure-sdk-for-go/services/aad/mgmt/2017-04-01/aad" + +const ( + DefaultBaseURI = original.DefaultBaseURI +) + +type Category = original.Category + +const ( + AuditLogs Category = original.AuditLogs + SignInLogs Category = original.SignInLogs +) + +type CategoryType = original.CategoryType + +const ( + Logs CategoryType = original.Logs +) + +type BaseClient = original.BaseClient +type DiagnosticSettings = original.DiagnosticSettings +type DiagnosticSettingsCategory = original.DiagnosticSettingsCategory +type DiagnosticSettingsCategoryClient = original.DiagnosticSettingsCategoryClient +type DiagnosticSettingsCategoryResource = original.DiagnosticSettingsCategoryResource +type DiagnosticSettingsCategoryResourceCollection = original.DiagnosticSettingsCategoryResourceCollection +type DiagnosticSettingsClient = original.DiagnosticSettingsClient +type DiagnosticSettingsResource = original.DiagnosticSettingsResource +type DiagnosticSettingsResourceCollection = original.DiagnosticSettingsResourceCollection +type Display = original.Display +type ErrorDefinition = original.ErrorDefinition +type ErrorResponse = original.ErrorResponse +type LogSettings = original.LogSettings +type OperationsClient = original.OperationsClient +type OperationsDiscovery = original.OperationsDiscovery +type OperationsDiscoveryCollection = original.OperationsDiscoveryCollection +type ProxyOnlyResource = original.ProxyOnlyResource +type RetentionPolicy = original.RetentionPolicy + +func New() BaseClient { + return original.New() +} +func NewDiagnosticSettingsCategoryClient() DiagnosticSettingsCategoryClient { + return original.NewDiagnosticSettingsCategoryClient() +} +func NewDiagnosticSettingsCategoryClientWithBaseURI(baseURI string) DiagnosticSettingsCategoryClient { + return original.NewDiagnosticSettingsCategoryClientWithBaseURI(baseURI) +} +func NewDiagnosticSettingsClient() DiagnosticSettingsClient { + return original.NewDiagnosticSettingsClient() +} +func NewDiagnosticSettingsClientWithBaseURI(baseURI string) DiagnosticSettingsClient { + return original.NewDiagnosticSettingsClientWithBaseURI(baseURI) +} +func NewOperationsClient() OperationsClient { + return original.NewOperationsClient() +} +func NewOperationsClientWithBaseURI(baseURI string) OperationsClient { + return original.NewOperationsClientWithBaseURI(baseURI) +} +func NewWithBaseURI(baseURI string) BaseClient { + return original.NewWithBaseURI(baseURI) +} +func PossibleCategoryTypeValues() []CategoryType { + return original.PossibleCategoryTypeValues() +} +func PossibleCategoryValues() []Category { + return original.PossibleCategoryValues() +} +func UserAgent() string { + return original.UserAgent() + " profiles/latest" +} +func Version() string { + return original.Version() +} diff --git a/profiles/preview/aad/mgmt/aad/aadapi/models.go b/profiles/preview/aad/mgmt/aad/aadapi/models.go new file mode 100644 index 000000000000..3bfa5c73d4cc --- /dev/null +++ b/profiles/preview/aad/mgmt/aad/aadapi/models.go @@ -0,0 +1,26 @@ +// +build go1.9 + +// Copyright 2019 Microsoft Corporation +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// This code was auto-generated by: +// github.com/Azure/azure-sdk-for-go/tools/profileBuilder + +package aadapi + +import original "github.com/Azure/azure-sdk-for-go/services/aad/mgmt/2017-04-01/aad/aadapi" + +type DiagnosticSettingsCategoryClientAPI = original.DiagnosticSettingsCategoryClientAPI +type DiagnosticSettingsClientAPI = original.DiagnosticSettingsClientAPI +type OperationsClientAPI = original.OperationsClientAPI diff --git a/profiles/preview/aad/mgmt/aad/models.go b/profiles/preview/aad/mgmt/aad/models.go new file mode 100644 index 000000000000..3f86107822d7 --- /dev/null +++ b/profiles/preview/aad/mgmt/aad/models.go @@ -0,0 +1,95 @@ +// +build go1.9 + +// Copyright 2019 Microsoft Corporation +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// This code was auto-generated by: +// github.com/Azure/azure-sdk-for-go/tools/profileBuilder + +package aad + +import original "github.com/Azure/azure-sdk-for-go/services/aad/mgmt/2017-04-01/aad" + +const ( + DefaultBaseURI = original.DefaultBaseURI +) + +type Category = original.Category + +const ( + AuditLogs Category = original.AuditLogs + SignInLogs Category = original.SignInLogs +) + +type CategoryType = original.CategoryType + +const ( + Logs CategoryType = original.Logs +) + +type BaseClient = original.BaseClient +type DiagnosticSettings = original.DiagnosticSettings +type DiagnosticSettingsCategory = original.DiagnosticSettingsCategory +type DiagnosticSettingsCategoryClient = original.DiagnosticSettingsCategoryClient +type DiagnosticSettingsCategoryResource = original.DiagnosticSettingsCategoryResource +type DiagnosticSettingsCategoryResourceCollection = original.DiagnosticSettingsCategoryResourceCollection +type DiagnosticSettingsClient = original.DiagnosticSettingsClient +type DiagnosticSettingsResource = original.DiagnosticSettingsResource +type DiagnosticSettingsResourceCollection = original.DiagnosticSettingsResourceCollection +type Display = original.Display +type ErrorDefinition = original.ErrorDefinition +type ErrorResponse = original.ErrorResponse +type LogSettings = original.LogSettings +type OperationsClient = original.OperationsClient +type OperationsDiscovery = original.OperationsDiscovery +type OperationsDiscoveryCollection = original.OperationsDiscoveryCollection +type ProxyOnlyResource = original.ProxyOnlyResource +type RetentionPolicy = original.RetentionPolicy + +func New() BaseClient { + return original.New() +} +func NewDiagnosticSettingsCategoryClient() DiagnosticSettingsCategoryClient { + return original.NewDiagnosticSettingsCategoryClient() +} +func NewDiagnosticSettingsCategoryClientWithBaseURI(baseURI string) DiagnosticSettingsCategoryClient { + return original.NewDiagnosticSettingsCategoryClientWithBaseURI(baseURI) +} +func NewDiagnosticSettingsClient() DiagnosticSettingsClient { + return original.NewDiagnosticSettingsClient() +} +func NewDiagnosticSettingsClientWithBaseURI(baseURI string) DiagnosticSettingsClient { + return original.NewDiagnosticSettingsClientWithBaseURI(baseURI) +} +func NewOperationsClient() OperationsClient { + return original.NewOperationsClient() +} +func NewOperationsClientWithBaseURI(baseURI string) OperationsClient { + return original.NewOperationsClientWithBaseURI(baseURI) +} +func NewWithBaseURI(baseURI string) BaseClient { + return original.NewWithBaseURI(baseURI) +} +func PossibleCategoryTypeValues() []CategoryType { + return original.PossibleCategoryTypeValues() +} +func PossibleCategoryValues() []Category { + return original.PossibleCategoryValues() +} +func UserAgent() string { + return original.UserAgent() + " profiles/preview" +} +func Version() string { + return original.Version() +} diff --git a/profiles/preview/preview/devops/mgmt/devops/devopsapi/models.go b/profiles/preview/preview/devops/mgmt/devops/devopsapi/models.go new file mode 100644 index 000000000000..48c25bc90d06 --- /dev/null +++ b/profiles/preview/preview/devops/mgmt/devops/devopsapi/models.go @@ -0,0 +1,26 @@ +// +build go1.9 + +// Copyright 2019 Microsoft Corporation +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// This code was auto-generated by: +// github.com/Azure/azure-sdk-for-go/tools/profileBuilder + +package devopsapi + +import original "github.com/Azure/azure-sdk-for-go/services/preview/devops/mgmt/2019-07-01-preview/devops/devopsapi" + +type OperationsClientAPI = original.OperationsClientAPI +type PipelineTemplateDefinitionsClientAPI = original.PipelineTemplateDefinitionsClientAPI +type PipelinesClientAPI = original.PipelinesClientAPI diff --git a/profiles/preview/preview/devops/mgmt/devops/models.go b/profiles/preview/preview/devops/mgmt/devops/models.go new file mode 100644 index 000000000000..5d677ca28cd9 --- /dev/null +++ b/profiles/preview/preview/devops/mgmt/devops/models.go @@ -0,0 +1,134 @@ +// +build go1.9 + +// Copyright 2019 Microsoft Corporation +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// This code was auto-generated by: +// github.com/Azure/azure-sdk-for-go/tools/profileBuilder + +package devops + +import ( + "context" + + original "github.com/Azure/azure-sdk-for-go/services/preview/devops/mgmt/2019-07-01-preview/devops" +) + +const ( + DefaultBaseURI = original.DefaultBaseURI +) + +type CodeRepositoryType = original.CodeRepositoryType + +const ( + GitHub CodeRepositoryType = original.GitHub + VstsGit CodeRepositoryType = original.VstsGit +) + +type InputDataType = original.InputDataType + +const ( + InputDataTypeAuthorization InputDataType = original.InputDataTypeAuthorization + InputDataTypeBool InputDataType = original.InputDataTypeBool + InputDataTypeInt InputDataType = original.InputDataTypeInt + InputDataTypeSecureString InputDataType = original.InputDataTypeSecureString + InputDataTypeString InputDataType = original.InputDataTypeString +) + +type Authorization = original.Authorization +type BaseClient = original.BaseClient +type BootstrapConfiguration = original.BootstrapConfiguration +type CloudError = original.CloudError +type CloudErrorBody = original.CloudErrorBody +type CodeRepository = original.CodeRepository +type InputDescriptor = original.InputDescriptor +type InputValue = original.InputValue +type Operation = original.Operation +type OperationDisplayValue = original.OperationDisplayValue +type OperationListResult = original.OperationListResult +type OperationListResultIterator = original.OperationListResultIterator +type OperationListResultPage = original.OperationListResultPage +type OperationsClient = original.OperationsClient +type OrganizationReference = original.OrganizationReference +type Pipeline = original.Pipeline +type PipelineListResult = original.PipelineListResult +type PipelineListResultIterator = original.PipelineListResultIterator +type PipelineListResultPage = original.PipelineListResultPage +type PipelineProperties = original.PipelineProperties +type PipelineTemplate = original.PipelineTemplate +type PipelineTemplateDefinition = original.PipelineTemplateDefinition +type PipelineTemplateDefinitionListResult = original.PipelineTemplateDefinitionListResult +type PipelineTemplateDefinitionListResultIterator = original.PipelineTemplateDefinitionListResultIterator +type PipelineTemplateDefinitionListResultPage = original.PipelineTemplateDefinitionListResultPage +type PipelineTemplateDefinitionsClient = original.PipelineTemplateDefinitionsClient +type PipelineUpdateParameters = original.PipelineUpdateParameters +type PipelinesClient = original.PipelinesClient +type PipelinesCreateOrUpdateFuture = original.PipelinesCreateOrUpdateFuture +type ProjectReference = original.ProjectReference +type Resource = original.Resource + +func New(subscriptionID string) BaseClient { + return original.New(subscriptionID) +} +func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { + return original.NewOperationListResultIterator(page) +} +func NewOperationListResultPage(getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { + return original.NewOperationListResultPage(getNextPage) +} +func NewOperationsClient(subscriptionID string) OperationsClient { + return original.NewOperationsClient(subscriptionID) +} +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return original.NewOperationsClientWithBaseURI(baseURI, subscriptionID) +} +func NewPipelineListResultIterator(page PipelineListResultPage) PipelineListResultIterator { + return original.NewPipelineListResultIterator(page) +} +func NewPipelineListResultPage(getNextPage func(context.Context, PipelineListResult) (PipelineListResult, error)) PipelineListResultPage { + return original.NewPipelineListResultPage(getNextPage) +} +func NewPipelineTemplateDefinitionListResultIterator(page PipelineTemplateDefinitionListResultPage) PipelineTemplateDefinitionListResultIterator { + return original.NewPipelineTemplateDefinitionListResultIterator(page) +} +func NewPipelineTemplateDefinitionListResultPage(getNextPage func(context.Context, PipelineTemplateDefinitionListResult) (PipelineTemplateDefinitionListResult, error)) PipelineTemplateDefinitionListResultPage { + return original.NewPipelineTemplateDefinitionListResultPage(getNextPage) +} +func NewPipelineTemplateDefinitionsClient(subscriptionID string) PipelineTemplateDefinitionsClient { + return original.NewPipelineTemplateDefinitionsClient(subscriptionID) +} +func NewPipelineTemplateDefinitionsClientWithBaseURI(baseURI string, subscriptionID string) PipelineTemplateDefinitionsClient { + return original.NewPipelineTemplateDefinitionsClientWithBaseURI(baseURI, subscriptionID) +} +func NewPipelinesClient(subscriptionID string) PipelinesClient { + return original.NewPipelinesClient(subscriptionID) +} +func NewPipelinesClientWithBaseURI(baseURI string, subscriptionID string) PipelinesClient { + return original.NewPipelinesClientWithBaseURI(baseURI, subscriptionID) +} +func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { + return original.NewWithBaseURI(baseURI, subscriptionID) +} +func PossibleCodeRepositoryTypeValues() []CodeRepositoryType { + return original.PossibleCodeRepositoryTypeValues() +} +func PossibleInputDataTypeValues() []InputDataType { + return original.PossibleInputDataTypeValues() +} +func UserAgent() string { + return original.UserAgent() + " profiles/preview" +} +func Version() string { + return original.Version() +} diff --git a/services/aad/mgmt/2017-04-01/aad/aadapi/interfaces.go b/services/aad/mgmt/2017-04-01/aad/aadapi/interfaces.go new file mode 100644 index 000000000000..6bea0e0122f3 --- /dev/null +++ b/services/aad/mgmt/2017-04-01/aad/aadapi/interfaces.go @@ -0,0 +1,48 @@ +package aadapi + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/services/aad/mgmt/2017-04-01/aad" + "github.com/Azure/go-autorest/autorest" +) + +// OperationsClientAPI contains the set of methods on the OperationsClient type. +type OperationsClientAPI interface { + List(ctx context.Context) (result aad.OperationsDiscoveryCollection, err error) +} + +var _ OperationsClientAPI = (*aad.OperationsClient)(nil) + +// DiagnosticSettingsClientAPI contains the set of methods on the DiagnosticSettingsClient type. +type DiagnosticSettingsClientAPI interface { + CreateOrUpdate(ctx context.Context, parameters aad.DiagnosticSettingsResource, name string) (result aad.DiagnosticSettingsResource, err error) + Delete(ctx context.Context, name string) (result autorest.Response, err error) + Get(ctx context.Context, name string) (result aad.DiagnosticSettingsResource, err error) + List(ctx context.Context) (result aad.DiagnosticSettingsResourceCollection, err error) +} + +var _ DiagnosticSettingsClientAPI = (*aad.DiagnosticSettingsClient)(nil) + +// DiagnosticSettingsCategoryClientAPI contains the set of methods on the DiagnosticSettingsCategoryClient type. +type DiagnosticSettingsCategoryClientAPI interface { + List(ctx context.Context) (result aad.DiagnosticSettingsCategoryResourceCollection, err error) +} + +var _ DiagnosticSettingsCategoryClientAPI = (*aad.DiagnosticSettingsCategoryClient)(nil) diff --git a/services/aad/mgmt/2017-04-01/aad/client.go b/services/aad/mgmt/2017-04-01/aad/client.go new file mode 100644 index 000000000000..ebb03052e7f6 --- /dev/null +++ b/services/aad/mgmt/2017-04-01/aad/client.go @@ -0,0 +1,49 @@ +// Package aad implements the Azure ARM Aad service API version 2017-04-01. +// +// Azure Active Directory Client. +package aad + +// 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 Aad + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Aad. +type BaseClient struct { + autorest.Client + BaseURI string +} + +// New creates an instance of the BaseClient client. +func New() BaseClient { + return NewWithBaseURI(DefaultBaseURI) +} + +// NewWithBaseURI creates an instance of the BaseClient client. +func NewWithBaseURI(baseURI string) BaseClient { + return BaseClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + } +} diff --git a/services/aad/mgmt/2017-04-01/aad/diagnosticsettings.go b/services/aad/mgmt/2017-04-01/aad/diagnosticsettings.go new file mode 100644 index 000000000000..5ff8e8ac68f5 --- /dev/null +++ b/services/aad/mgmt/2017-04-01/aad/diagnosticsettings.go @@ -0,0 +1,333 @@ +package aad + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// DiagnosticSettingsClient is the azure Active Directory Client. +type DiagnosticSettingsClient struct { + BaseClient +} + +// NewDiagnosticSettingsClient creates an instance of the DiagnosticSettingsClient client. +func NewDiagnosticSettingsClient() DiagnosticSettingsClient { + return NewDiagnosticSettingsClientWithBaseURI(DefaultBaseURI) +} + +// NewDiagnosticSettingsClientWithBaseURI creates an instance of the DiagnosticSettingsClient client. +func NewDiagnosticSettingsClientWithBaseURI(baseURI string) DiagnosticSettingsClient { + return DiagnosticSettingsClient{NewWithBaseURI(baseURI)} +} + +// CreateOrUpdate creates or updates diagnostic settings for AadIam. +// Parameters: +// parameters - parameters supplied to the operation. +// name - the name of the diagnostic setting. +func (client DiagnosticSettingsClient) CreateOrUpdate(ctx context.Context, parameters DiagnosticSettingsResource, name string) (result DiagnosticSettingsResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticSettingsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, parameters, name) + if err != nil { + err = autorest.NewErrorWithError(err, "aad.DiagnosticSettingsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "aad.DiagnosticSettingsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "aad.DiagnosticSettingsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client DiagnosticSettingsClient) CreateOrUpdatePreparer(ctx context.Context, parameters DiagnosticSettingsResource, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + } + + const APIVersion = "2017-04-01" + 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("/providers/microsoft.aadiam/diagnosticSettings/{name}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client DiagnosticSettingsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client DiagnosticSettingsClient) CreateOrUpdateResponder(resp *http.Response) (result DiagnosticSettingsResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes existing diagnostic setting for AadIam. +// Parameters: +// name - the name of the diagnostic setting. +func (client DiagnosticSettingsClient) Delete(ctx context.Context, name string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticSettingsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, name) + if err != nil { + err = autorest.NewErrorWithError(err, "aad.DiagnosticSettingsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "aad.DiagnosticSettingsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "aad.DiagnosticSettingsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client DiagnosticSettingsClient) DeletePreparer(ctx context.Context, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + } + + const APIVersion = "2017-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/microsoft.aadiam/diagnosticSettings/{name}", 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 DiagnosticSettingsClient) DeleteSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client DiagnosticSettingsClient) 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 active diagnostic setting for AadIam. +// Parameters: +// name - the name of the diagnostic setting. +func (client DiagnosticSettingsClient) Get(ctx context.Context, name string) (result DiagnosticSettingsResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticSettingsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, name) + if err != nil { + err = autorest.NewErrorWithError(err, "aad.DiagnosticSettingsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "aad.DiagnosticSettingsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "aad.DiagnosticSettingsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client DiagnosticSettingsClient) GetPreparer(ctx context.Context, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + } + + const APIVersion = "2017-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/microsoft.aadiam/diagnosticSettings/{name}", 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 DiagnosticSettingsClient) GetSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client DiagnosticSettingsClient) GetResponder(resp *http.Response) (result DiagnosticSettingsResource, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets the active diagnostic settings list for AadIam. +func (client DiagnosticSettingsClient) List(ctx context.Context) (result DiagnosticSettingsResourceCollection, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticSettingsClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "aad.DiagnosticSettingsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "aad.DiagnosticSettingsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "aad.DiagnosticSettingsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client DiagnosticSettingsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2017-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/microsoft.aadiam/diagnosticSettings"), + 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 DiagnosticSettingsClient) ListSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client DiagnosticSettingsClient) ListResponder(resp *http.Response) (result DiagnosticSettingsResourceCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/aad/mgmt/2017-04-01/aad/diagnosticsettingscategory.go b/services/aad/mgmt/2017-04-01/aad/diagnosticsettingscategory.go new file mode 100644 index 000000000000..f6c31d9c2d96 --- /dev/null +++ b/services/aad/mgmt/2017-04-01/aad/diagnosticsettingscategory.go @@ -0,0 +1,109 @@ +package aad + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// DiagnosticSettingsCategoryClient is the azure Active Directory Client. +type DiagnosticSettingsCategoryClient struct { + BaseClient +} + +// NewDiagnosticSettingsCategoryClient creates an instance of the DiagnosticSettingsCategoryClient client. +func NewDiagnosticSettingsCategoryClient() DiagnosticSettingsCategoryClient { + return NewDiagnosticSettingsCategoryClientWithBaseURI(DefaultBaseURI) +} + +// NewDiagnosticSettingsCategoryClientWithBaseURI creates an instance of the DiagnosticSettingsCategoryClient client. +func NewDiagnosticSettingsCategoryClientWithBaseURI(baseURI string) DiagnosticSettingsCategoryClient { + return DiagnosticSettingsCategoryClient{NewWithBaseURI(baseURI)} +} + +// List lists the diagnostic settings categories for AadIam. +func (client DiagnosticSettingsCategoryClient) List(ctx context.Context) (result DiagnosticSettingsCategoryResourceCollection, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticSettingsCategoryClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "aad.DiagnosticSettingsCategoryClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "aad.DiagnosticSettingsCategoryClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "aad.DiagnosticSettingsCategoryClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client DiagnosticSettingsCategoryClient) ListPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2017-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/microsoft.aadiam/diagnosticSettingsCategories"), + 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 DiagnosticSettingsCategoryClient) ListSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client DiagnosticSettingsCategoryClient) ListResponder(resp *http.Response) (result DiagnosticSettingsCategoryResourceCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/aad/mgmt/2017-04-01/aad/models.go b/services/aad/mgmt/2017-04-01/aad/models.go new file mode 100644 index 000000000000..154c3d1da50c --- /dev/null +++ b/services/aad/mgmt/2017-04-01/aad/models.go @@ -0,0 +1,315 @@ +package aad + +// 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 ( + "encoding/json" + "github.com/Azure/go-autorest/autorest" +) + +// The package's fully qualified name. +const fqdn = "github.com/Azure/azure-sdk-for-go/services/aad/mgmt/2017-04-01/aad" + +// Category enumerates the values for category. +type Category string + +const ( + // AuditLogs ... + AuditLogs Category = "AuditLogs" + // SignInLogs ... + SignInLogs Category = "SignInLogs" +) + +// PossibleCategoryValues returns an array of possible values for the Category const type. +func PossibleCategoryValues() []Category { + return []Category{AuditLogs, SignInLogs} +} + +// CategoryType enumerates the values for category type. +type CategoryType string + +const ( + // Logs ... + Logs CategoryType = "Logs" +) + +// PossibleCategoryTypeValues returns an array of possible values for the CategoryType const type. +func PossibleCategoryTypeValues() []CategoryType { + return []CategoryType{Logs} +} + +// DiagnosticSettings the diagnostic settings. +type DiagnosticSettings struct { + // StorageAccountID - The resource ID of the storage account to which you would like to send Diagnostic Logs. + StorageAccountID *string `json:"storageAccountId,omitempty"` + // ServiceBusRuleID - The service bus rule Id of the diagnostic setting. This is here to maintain backwards compatibility. + ServiceBusRuleID *string `json:"serviceBusRuleId,omitempty"` + // WorkspaceID - The workspace ID (resource ID of a Log Analytics workspace) for a Log Analytics workspace to which you would like to send Diagnostic Logs. Example: /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2 + WorkspaceID *string `json:"workspaceId,omitempty"` + // EventHubAuthorizationRuleID - The resource Id for the event hub authorization rule. + EventHubAuthorizationRuleID *string `json:"eventHubAuthorizationRuleId,omitempty"` + // EventHubName - The name of the event hub. If none is specified, the default event hub will be selected. + EventHubName *string `json:"eventHubName,omitempty"` + // Logs - The list of logs settings. + Logs *[]LogSettings `json:"logs,omitempty"` +} + +// DiagnosticSettingsCategory the diagnostic settings Category. +type DiagnosticSettingsCategory struct { + // CategoryType - The type of the diagnostic settings category. Possible values include: 'Logs' + CategoryType CategoryType `json:"categoryType,omitempty"` +} + +// DiagnosticSettingsCategoryResource the diagnostic settings category resource. +type DiagnosticSettingsCategoryResource struct { + // DiagnosticSettingsCategory - The properties of a Diagnostic Settings Category. + *DiagnosticSettingsCategory `json:"properties,omitempty"` + // ID - READ-ONLY; Azure resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Azure resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Azure resource type + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for DiagnosticSettingsCategoryResource. +func (dscr DiagnosticSettingsCategoryResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dscr.DiagnosticSettingsCategory != nil { + objectMap["properties"] = dscr.DiagnosticSettingsCategory + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for DiagnosticSettingsCategoryResource struct. +func (dscr *DiagnosticSettingsCategoryResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var diagnosticSettingsCategory DiagnosticSettingsCategory + err = json.Unmarshal(*v, &diagnosticSettingsCategory) + if err != nil { + return err + } + dscr.DiagnosticSettingsCategory = &diagnosticSettingsCategory + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + dscr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + dscr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + dscr.Type = &typeVar + } + } + } + + return nil +} + +// DiagnosticSettingsCategoryResourceCollection represents a collection of diagnostic setting category +// resources. +type DiagnosticSettingsCategoryResourceCollection struct { + autorest.Response `json:"-"` + // Value - The collection of diagnostic settings category resources. + Value *[]DiagnosticSettingsCategoryResource `json:"value,omitempty"` +} + +// DiagnosticSettingsResource the diagnostic setting resource. +type DiagnosticSettingsResource struct { + autorest.Response `json:"-"` + // DiagnosticSettings - Properties of a Diagnostic Settings Resource. + *DiagnosticSettings `json:"properties,omitempty"` + // ID - READ-ONLY; Azure resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Azure resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Azure resource type + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for DiagnosticSettingsResource. +func (dsr DiagnosticSettingsResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dsr.DiagnosticSettings != nil { + objectMap["properties"] = dsr.DiagnosticSettings + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for DiagnosticSettingsResource struct. +func (dsr *DiagnosticSettingsResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var diagnosticSettings DiagnosticSettings + err = json.Unmarshal(*v, &diagnosticSettings) + if err != nil { + return err + } + dsr.DiagnosticSettings = &diagnosticSettings + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + dsr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + dsr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + dsr.Type = &typeVar + } + } + } + + return nil +} + +// DiagnosticSettingsResourceCollection represents a collection of alert rule resources. +type DiagnosticSettingsResourceCollection struct { + autorest.Response `json:"-"` + // Value - The collection of diagnostic settings resources. + Value *[]DiagnosticSettingsResource `json:"value,omitempty"` +} + +// Display contains the localized display information for this particular operation / action. These value +// will be used by several clients for (1) custom role definitions for RBAC; (2) complex query filters for +// the event service; and (3) audit history / records for management operations. +type Display struct { + // Publisher - The publisher. The localized friendly form of the resource publisher name. + Publisher *string `json:"publisher,omitempty"` + // Provider - The provider. The localized friendly form of the resource provider name – it is expected to also include the publisher/company responsible. It should use Title Casing and begin with "Microsoft" for 1st party services. e.g. "Microsoft Monitoring Insights" or "Microsoft Compute." + Provider *string `json:"provider,omitempty"` + // Resource - The resource. The localized friendly form of the resource related to this action/operation – it should match the public documentation for the resource provider. It should use Title Casing. This value should be unique for a particular URL type (e.g. nested types should *not* reuse their parent’s display.resource field). e.g. "Virtual Machines" or "Scheduler Job Collections", or "Virtual Machine VM Sizes" or "Scheduler Jobs" + Resource *string `json:"resource,omitempty"` + // Operation - The operation. The localized friendly name for the operation, as it should be shown to the user. It should be concise (to fit in drop downs) but clear (i.e. self-documenting). It should use Title Casing. Prescriptive guidance: Read Create or Update Delete 'ActionName' + Operation *string `json:"operation,omitempty"` + // Description - The description. The localized friendly description for the operation, as it should be shown to the user. It should be thorough, yet concise – it will be used in tool tips and detailed views. Prescriptive guidance for namespaces: Read any 'display.provider' resource Create or Update any 'display.provider' resource Delete any 'display.provider' resource Perform any other action on any 'display.provider' resource Prescriptive guidance for namespaces: Read any 'display.resource' Create or Update any 'display.resource' Delete any 'display.resource' 'ActionName' any 'display.resources' + Description *string `json:"description,omitempty"` +} + +// ErrorDefinition error definition. +type ErrorDefinition struct { + // Code - READ-ONLY; Service specific error code which serves as the substatus for the HTTP error code. + Code *string `json:"code,omitempty"` + // Message - READ-ONLY; Description of the error. + Message *string `json:"message,omitempty"` + // Details - READ-ONLY; Internal error details. + Details *[]ErrorDefinition `json:"details,omitempty"` +} + +// ErrorResponse error response. +type ErrorResponse struct { + // Error - The error details. + Error *ErrorDefinition `json:"error,omitempty"` +} + +// LogSettings part of MultiTenantDiagnosticSettings. Specifies the settings for a particular log. +type LogSettings struct { + // Category - Name of a Diagnostic Log category for a resource type this setting is applied to. To obtain the list of Diagnostic Log categories for a resource, first perform a GET diagnostic settings operation. Possible values include: 'AuditLogs', 'SignInLogs' + Category Category `json:"category,omitempty"` + // Enabled - A value indicating whether this log is enabled. + Enabled *bool `json:"enabled,omitempty"` + // RetentionPolicy - The retention policy for this log. + RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` +} + +// OperationsDiscovery operations discovery class. +type OperationsDiscovery struct { + // Name - Name of the API. The name of the operation being performed on this particular object. It should match the action name that appears in RBAC / the event service. Examples of operations include: * Microsoft.Compute/virtualMachine/capture/action * Microsoft.Compute/virtualMachine/restart/action * Microsoft.Compute/virtualMachine/write * Microsoft.Compute/virtualMachine/read * Microsoft.Compute/virtualMachine/delete Each action should include, in order: (1) Resource Provider Namespace (2) Type hierarchy for which the action applies (e.g. server/databases for a SQL Azure database) (3) Read, Write, Action or Delete indicating which type applies. If it is a PUT/PATCH on a collection or named value, Write should be used. If it is a GET, Read should be used. If it is a DELETE, Delete should be used. If it is a POST, Action should be used. + Name *string `json:"name,omitempty"` + // Display - Object type + Display *Display `json:"display,omitempty"` + // Origin - Origin. The intended executor of the operation; governs the display of the operation in the RBAC UX and the audit logs UX. Default value is "user,system" + Origin *string `json:"origin,omitempty"` + // Properties - Properties. Reserved for future use. + Properties interface{} `json:"properties,omitempty"` +} + +// OperationsDiscoveryCollection collection of ClientDiscovery details. +type OperationsDiscoveryCollection struct { + autorest.Response `json:"-"` + // Value - The ClientDiscovery details. + Value *[]OperationsDiscovery `json:"value,omitempty"` +} + +// ProxyOnlyResource a proxy only azure resource object. +type ProxyOnlyResource struct { + // ID - READ-ONLY; Azure resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Azure resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Azure resource type + Type *string `json:"type,omitempty"` +} + +// RetentionPolicy specifies the retention policy for the log. +type RetentionPolicy struct { + // Enabled - A value indicating whether the retention policy is enabled. + Enabled *bool `json:"enabled,omitempty"` + // Days - The number of days for the retention in days. A value of 0 will retain the events indefinitely. + Days *int32 `json:"days,omitempty"` +} diff --git a/services/aad/mgmt/2017-04-01/aad/operations.go b/services/aad/mgmt/2017-04-01/aad/operations.go new file mode 100644 index 000000000000..9df2a7a2e715 --- /dev/null +++ b/services/aad/mgmt/2017-04-01/aad/operations.go @@ -0,0 +1,109 @@ +package aad + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// OperationsClient is the azure Active Directory Client. +type OperationsClient struct { + BaseClient +} + +// NewOperationsClient creates an instance of the OperationsClient client. +func NewOperationsClient() OperationsClient { + return NewOperationsClientWithBaseURI(DefaultBaseURI) +} + +// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client. +func NewOperationsClientWithBaseURI(baseURI string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI)} +} + +// List operation to return the list of available operations. +func (client OperationsClient) List(ctx context.Context) (result OperationsDiscoveryCollection, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "aad.OperationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "aad.OperationsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "aad.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 = "2017-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/microsoft.aadiam/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) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client OperationsClient) ListResponder(resp *http.Response) (result OperationsDiscoveryCollection, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/aad/mgmt/2017-04-01/aad/version.go b/services/aad/mgmt/2017-04-01/aad/version.go new file mode 100644 index 000000000000..ea8d95a339d5 --- /dev/null +++ b/services/aad/mgmt/2017-04-01/aad/version.go @@ -0,0 +1,30 @@ +package aad + +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 + " aad/2017-04-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +} diff --git a/services/preview/devops/mgmt/2019-07-01-preview/devops/client.go b/services/preview/devops/mgmt/2019-07-01-preview/devops/client.go new file mode 100644 index 000000000000..a478f8ea875d --- /dev/null +++ b/services/preview/devops/mgmt/2019-07-01-preview/devops/client.go @@ -0,0 +1,51 @@ +// Package devops implements the Azure ARM Devops service API version 2019-07-01-preview. +// +// Azure DevOps Resource Provider +package devops + +// 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 Devops + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Devops. +type BaseClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the BaseClient client. +func New(subscriptionID string) BaseClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the BaseClient client. +func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { + return BaseClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/services/preview/devops/mgmt/2019-07-01-preview/devops/devopsapi/interfaces.go b/services/preview/devops/mgmt/2019-07-01-preview/devops/devopsapi/interfaces.go new file mode 100644 index 000000000000..b3ad46d91d27 --- /dev/null +++ b/services/preview/devops/mgmt/2019-07-01-preview/devops/devopsapi/interfaces.go @@ -0,0 +1,50 @@ +package devopsapi + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/services/preview/devops/mgmt/2019-07-01-preview/devops" + "github.com/Azure/go-autorest/autorest" +) + +// OperationsClientAPI contains the set of methods on the OperationsClient type. +type OperationsClientAPI interface { + List(ctx context.Context) (result devops.OperationListResultPage, err error) +} + +var _ OperationsClientAPI = (*devops.OperationsClient)(nil) + +// PipelineTemplateDefinitionsClientAPI contains the set of methods on the PipelineTemplateDefinitionsClient type. +type PipelineTemplateDefinitionsClientAPI interface { + List(ctx context.Context) (result devops.PipelineTemplateDefinitionListResultPage, err error) +} + +var _ PipelineTemplateDefinitionsClientAPI = (*devops.PipelineTemplateDefinitionsClient)(nil) + +// PipelinesClientAPI contains the set of methods on the PipelinesClient type. +type PipelinesClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, pipelineName string, createOperationParameters devops.Pipeline) (result devops.PipelinesCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, pipelineName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, pipelineName string) (result devops.Pipeline, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result devops.PipelineListResultPage, err error) + ListBySubscription(ctx context.Context) (result devops.PipelineListResultPage, err error) + Update(ctx context.Context, resourceGroupName string, pipelineName string, updateOperationParameters devops.PipelineUpdateParameters) (result devops.Pipeline, err error) +} + +var _ PipelinesClientAPI = (*devops.PipelinesClient)(nil) diff --git a/services/preview/devops/mgmt/2019-07-01-preview/devops/models.go b/services/preview/devops/mgmt/2019-07-01-preview/devops/models.go new file mode 100644 index 000000000000..7fb1422d77b6 --- /dev/null +++ b/services/preview/devops/mgmt/2019-07-01-preview/devops/models.go @@ -0,0 +1,914 @@ +package devops + +// 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" + "encoding/json" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/to" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// The package's fully qualified name. +const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/devops/mgmt/2019-07-01-preview/devops" + +// CodeRepositoryType enumerates the values for code repository type. +type CodeRepositoryType string + +const ( + // GitHub ... + GitHub CodeRepositoryType = "gitHub" + // VstsGit ... + VstsGit CodeRepositoryType = "vstsGit" +) + +// PossibleCodeRepositoryTypeValues returns an array of possible values for the CodeRepositoryType const type. +func PossibleCodeRepositoryTypeValues() []CodeRepositoryType { + return []CodeRepositoryType{GitHub, VstsGit} +} + +// InputDataType enumerates the values for input data type. +type InputDataType string + +const ( + // InputDataTypeAuthorization ... + InputDataTypeAuthorization InputDataType = "Authorization" + // InputDataTypeBool ... + InputDataTypeBool InputDataType = "Bool" + // InputDataTypeInt ... + InputDataTypeInt InputDataType = "Int" + // InputDataTypeSecureString ... + InputDataTypeSecureString InputDataType = "SecureString" + // InputDataTypeString ... + InputDataTypeString InputDataType = "String" +) + +// PossibleInputDataTypeValues returns an array of possible values for the InputDataType const type. +func PossibleInputDataTypeValues() []InputDataType { + return []InputDataType{InputDataTypeAuthorization, InputDataTypeBool, InputDataTypeInt, InputDataTypeSecureString, InputDataTypeString} +} + +// Authorization authorization info used to access a resource (like code repository). +type Authorization struct { + // AuthorizationType - Type of authorization. + AuthorizationType *string `json:"authorizationType,omitempty"` + // Parameters - Authorization parameters corresponding to the authorization type. + Parameters map[string]*string `json:"parameters"` +} + +// MarshalJSON is the custom marshaler for Authorization. +func (a Authorization) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if a.AuthorizationType != nil { + objectMap["authorizationType"] = a.AuthorizationType + } + if a.Parameters != nil { + objectMap["parameters"] = a.Parameters + } + return json.Marshal(objectMap) +} + +// BootstrapConfiguration configuration used to bootstrap a Pipeline. +type BootstrapConfiguration struct { + // Repository - Repository containing the source code for the pipeline. + Repository *CodeRepository `json:"repository,omitempty"` + // Template - Template used to bootstrap the pipeline. + Template *PipelineTemplate `json:"template,omitempty"` +} + +// CloudError an error response from the Pipelines Resource Provider. +type CloudError struct { + // Error - Details of the error from the Pipelines Resource Provider. + Error *CloudErrorBody `json:"error,omitempty"` +} + +// CloudErrorBody an error response from the Pipelines Resource Provider. +type CloudErrorBody struct { + // Code - An identifier for the error. Codes are invariant and are intended to be consumed programmatically. + Code *string `json:"code,omitempty"` + // Message - A message describing the error, intended to be suitable for display in a user interface. + Message *string `json:"message,omitempty"` + // Target - The target of the particular error. For example, the name of the property in error or the method where the error occurred. + Target *string `json:"target,omitempty"` + // Details - A list of additional details about the error. + Details *[]CloudErrorBody `json:"details,omitempty"` +} + +// CodeRepository repository containing the source code for a pipeline. +type CodeRepository struct { + // RepositoryType - Type of code repository. Possible values include: 'GitHub', 'VstsGit' + RepositoryType CodeRepositoryType `json:"repositoryType,omitempty"` + // ID - Unique immutable identifier of the code repository. + ID *string `json:"id,omitempty"` + // DefaultBranch - Default branch used to configure Continuous Integration (CI) in the pipeline. + DefaultBranch *string `json:"defaultBranch,omitempty"` + // Authorization - Authorization info to access the code repository. + Authorization *Authorization `json:"authorization,omitempty"` + // Properties - Repository-specific properties. + Properties map[string]*string `json:"properties"` +} + +// MarshalJSON is the custom marshaler for CodeRepository. +func (cr CodeRepository) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cr.RepositoryType != "" { + objectMap["repositoryType"] = cr.RepositoryType + } + if cr.ID != nil { + objectMap["id"] = cr.ID + } + if cr.DefaultBranch != nil { + objectMap["defaultBranch"] = cr.DefaultBranch + } + if cr.Authorization != nil { + objectMap["authorization"] = cr.Authorization + } + if cr.Properties != nil { + objectMap["properties"] = cr.Properties + } + return json.Marshal(objectMap) +} + +// InputDescriptor representation of a pipeline template input parameter. +type InputDescriptor struct { + // ID - Identifier of the input parameter. + ID *string `json:"id,omitempty"` + // Description - Description of the input parameter. + Description *string `json:"description,omitempty"` + // Type - Data type of the value of the input parameter. Possible values include: 'InputDataTypeString', 'InputDataTypeSecureString', 'InputDataTypeInt', 'InputDataTypeBool', 'InputDataTypeAuthorization' + Type InputDataType `json:"type,omitempty"` + // PossibleValues - List of possible values for the input parameter. + PossibleValues *[]InputValue `json:"possibleValues,omitempty"` +} + +// InputValue representation of a pipeline template input parameter value. +type InputValue struct { + // Value - Value of an input parameter. + Value *string `json:"value,omitempty"` + // DisplayValue - Description of the input parameter value. + DisplayValue *string `json:"displayValue,omitempty"` +} + +// Operation properties of an Operation. +type Operation struct { + // Name - READ-ONLY; Name of the operation. + Name *string `json:"name,omitempty"` + // IsDataAction - Indicates whether the operation applies to data-plane. + IsDataAction *string `json:"isDataAction,omitempty"` + // OperationDisplayValue - Display information of the operation. + *OperationDisplayValue `json:"display,omitempty"` +} + +// MarshalJSON is the custom marshaler for Operation. +func (o Operation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if o.IsDataAction != nil { + objectMap["isDataAction"] = o.IsDataAction + } + if o.OperationDisplayValue != nil { + objectMap["display"] = o.OperationDisplayValue + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Operation struct. +func (o *Operation) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + o.Name = &name + } + case "isDataAction": + if v != nil { + var isDataAction string + err = json.Unmarshal(*v, &isDataAction) + if err != nil { + return err + } + o.IsDataAction = &isDataAction + } + case "display": + if v != nil { + var operationDisplayValue OperationDisplayValue + err = json.Unmarshal(*v, &operationDisplayValue) + if err != nil { + return err + } + o.OperationDisplayValue = &operationDisplayValue + } + } + } + + return nil +} + +// OperationDisplayValue display information of an operation. +type OperationDisplayValue struct { + // Operation - READ-ONLY; Friendly name of the operation. + Operation *string `json:"operation,omitempty"` + // Resource - READ-ONLY; Friendly name of the resource type the operation applies to. + Resource *string `json:"resource,omitempty"` + // Description - READ-ONLY; Friendly description of the operation. + Description *string `json:"description,omitempty"` + // Provider - READ-ONLY; Friendly name of the resource provider. + Provider *string `json:"provider,omitempty"` +} + +// OperationListResult result of a request to list all operations supported by Microsoft.DevOps resource +// provider. +type OperationListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of operations supported by Microsoft.DevOps resource provider. + Value *[]Operation `json:"value,omitempty"` + // NextLink - The URL to get the next set of operations, if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// OperationListResultIterator provides access to a complete listing of Operation values. +type OperationListResultIterator struct { + i int + page OperationListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *OperationListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter OperationListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter OperationListResultIterator) Response() OperationListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter OperationListResultIterator) Value() Operation { + if !iter.page.NotDone() { + return Operation{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the OperationListResultIterator type. +func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { + return OperationListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (olr OperationListResult) IsEmpty() bool { + return olr.Value == nil || len(*olr.Value) == 0 +} + +// operationListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) { + if olr.NextLink == nil || len(to.String(olr.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(olr.NextLink))) +} + +// OperationListResultPage contains a page of Operation values. +type OperationListResultPage struct { + fn func(context.Context, OperationListResult) (OperationListResult, error) + olr OperationListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + next, err := page.fn(ctx, page.olr) + if err != nil { + return err + } + page.olr = next + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *OperationListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page OperationListResultPage) NotDone() bool { + return !page.olr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page OperationListResultPage) Response() OperationListResult { + return page.olr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page OperationListResultPage) Values() []Operation { + if page.olr.IsEmpty() { + return nil + } + return *page.olr.Value +} + +// Creates a new instance of the OperationListResultPage type. +func NewOperationListResultPage(getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { + return OperationListResultPage{fn: getNextPage} +} + +// OrganizationReference reference to an Azure DevOps Organization. +type OrganizationReference struct { + // ID - READ-ONLY; Unique immutable identifier for the Azure DevOps Organization. + ID *string `json:"id,omitempty"` + // Name - Name of the Azure DevOps Organization. + Name *string `json:"name,omitempty"` +} + +// Pipeline azure DevOps Pipeline used to configure Continuous Integration (CI) & Continuous Delivery (CD) +// for Azure resources. +type Pipeline struct { + autorest.Response `json:"-"` + // PipelineProperties - Custom properties of the Pipeline. + *PipelineProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Type - READ-ONLY; Resource Type + Type *string `json:"type,omitempty"` + // Tags - Resource Tags + Tags map[string]*string `json:"tags"` + // Location - Resource Location + Location *string `json:"location,omitempty"` + // Name - READ-ONLY; Resource Name + Name *string `json:"name,omitempty"` +} + +// MarshalJSON is the custom marshaler for Pipeline. +func (p Pipeline) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if p.PipelineProperties != nil { + objectMap["properties"] = p.PipelineProperties + } + if p.Tags != nil { + objectMap["tags"] = p.Tags + } + if p.Location != nil { + objectMap["location"] = p.Location + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Pipeline struct. +func (p *Pipeline) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var pipelineProperties PipelineProperties + err = json.Unmarshal(*v, &pipelineProperties) + if err != nil { + return err + } + p.PipelineProperties = &pipelineProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + p.ID = &ID + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + p.Type = &typeVar + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + p.Tags = tags + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + p.Location = &location + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + p.Name = &name + } + } + } + + return nil +} + +// PipelineListResult result of a request to list all Azure Pipelines under a given scope. +type PipelineListResult struct { + autorest.Response `json:"-"` + // Value - List of pipelines. + Value *[]Pipeline `json:"value,omitempty"` + // NextLink - URL to get the next set of Pipelines, if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// PipelineListResultIterator provides access to a complete listing of Pipeline values. +type PipelineListResultIterator struct { + i int + page PipelineListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *PipelineListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PipelineListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *PipelineListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter PipelineListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter PipelineListResultIterator) Response() PipelineListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter PipelineListResultIterator) Value() Pipeline { + if !iter.page.NotDone() { + return Pipeline{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the PipelineListResultIterator type. +func NewPipelineListResultIterator(page PipelineListResultPage) PipelineListResultIterator { + return PipelineListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (plr PipelineListResult) IsEmpty() bool { + return plr.Value == nil || len(*plr.Value) == 0 +} + +// pipelineListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (plr PipelineListResult) pipelineListResultPreparer(ctx context.Context) (*http.Request, error) { + if plr.NextLink == nil || len(to.String(plr.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(plr.NextLink))) +} + +// PipelineListResultPage contains a page of Pipeline values. +type PipelineListResultPage struct { + fn func(context.Context, PipelineListResult) (PipelineListResult, error) + plr PipelineListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *PipelineListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PipelineListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + next, err := page.fn(ctx, page.plr) + if err != nil { + return err + } + page.plr = next + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *PipelineListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page PipelineListResultPage) NotDone() bool { + return !page.plr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page PipelineListResultPage) Response() PipelineListResult { + return page.plr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page PipelineListResultPage) Values() []Pipeline { + if page.plr.IsEmpty() { + return nil + } + return *page.plr.Value +} + +// Creates a new instance of the PipelineListResultPage type. +func NewPipelineListResultPage(getNextPage func(context.Context, PipelineListResult) (PipelineListResult, error)) PipelineListResultPage { + return PipelineListResultPage{fn: getNextPage} +} + +// PipelineProperties custom properties of a Pipeline. +type PipelineProperties struct { + // PipelineID - READ-ONLY; Unique identifier of the Azure Pipeline within the Azure DevOps Project. + PipelineID *int32 `json:"pipelineId,omitempty"` + // Organization - Reference to the Azure DevOps Organization containing the Pipeline. + Organization *OrganizationReference `json:"organization,omitempty"` + // Project - Reference to the Azure DevOps Project containing the Pipeline. + Project *ProjectReference `json:"project,omitempty"` + // BootstrapConfiguration - Configuration used to bootstrap the Pipeline. + BootstrapConfiguration *BootstrapConfiguration `json:"bootstrapConfiguration,omitempty"` +} + +// PipelinesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type PipelinesCreateOrUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *PipelinesCreateOrUpdateFuture) Result(client PipelinesClient) (p Pipeline, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "devops.PipelinesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("devops.PipelinesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if p.Response.Response, err = future.GetResult(sender); err == nil && p.Response.Response.StatusCode != http.StatusNoContent { + p, err = client.CreateOrUpdateResponder(p.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "devops.PipelinesCreateOrUpdateFuture", "Result", p.Response.Response, "Failure responding to request") + } + } + return +} + +// PipelineTemplate template used to bootstrap the pipeline. +type PipelineTemplate struct { + // ID - Unique identifier of the pipeline template. + ID *string `json:"id,omitempty"` + // Parameters - Dictionary of input parameters used in the pipeline template. + Parameters map[string]*string `json:"parameters"` +} + +// MarshalJSON is the custom marshaler for PipelineTemplate. +func (pt PipelineTemplate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pt.ID != nil { + objectMap["id"] = pt.ID + } + if pt.Parameters != nil { + objectMap["parameters"] = pt.Parameters + } + return json.Marshal(objectMap) +} + +// PipelineTemplateDefinition definition of a pipeline template. +type PipelineTemplateDefinition struct { + // ID - Unique identifier of the pipeline template. + ID *string `json:"id,omitempty"` + // Description - Description of the pipeline enabled by the template. + Description *string `json:"description,omitempty"` + // Inputs - List of input parameters required by the template to create a pipeline. + Inputs *[]InputDescriptor `json:"inputs,omitempty"` +} + +// PipelineTemplateDefinitionListResult result of a request to list all pipeline template definitions. +type PipelineTemplateDefinitionListResult struct { + autorest.Response `json:"-"` + // Value - List of pipeline template definitions. + Value *[]PipelineTemplateDefinition `json:"value,omitempty"` + // NextLink - The URL to get the next set of pipeline template definitions, if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// PipelineTemplateDefinitionListResultIterator provides access to a complete listing of +// PipelineTemplateDefinition values. +type PipelineTemplateDefinitionListResultIterator struct { + i int + page PipelineTemplateDefinitionListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *PipelineTemplateDefinitionListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PipelineTemplateDefinitionListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *PipelineTemplateDefinitionListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter PipelineTemplateDefinitionListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter PipelineTemplateDefinitionListResultIterator) Response() PipelineTemplateDefinitionListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter PipelineTemplateDefinitionListResultIterator) Value() PipelineTemplateDefinition { + if !iter.page.NotDone() { + return PipelineTemplateDefinition{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the PipelineTemplateDefinitionListResultIterator type. +func NewPipelineTemplateDefinitionListResultIterator(page PipelineTemplateDefinitionListResultPage) PipelineTemplateDefinitionListResultIterator { + return PipelineTemplateDefinitionListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (ptdlr PipelineTemplateDefinitionListResult) IsEmpty() bool { + return ptdlr.Value == nil || len(*ptdlr.Value) == 0 +} + +// pipelineTemplateDefinitionListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (ptdlr PipelineTemplateDefinitionListResult) pipelineTemplateDefinitionListResultPreparer(ctx context.Context) (*http.Request, error) { + if ptdlr.NextLink == nil || len(to.String(ptdlr.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ptdlr.NextLink))) +} + +// PipelineTemplateDefinitionListResultPage contains a page of PipelineTemplateDefinition values. +type PipelineTemplateDefinitionListResultPage struct { + fn func(context.Context, PipelineTemplateDefinitionListResult) (PipelineTemplateDefinitionListResult, error) + ptdlr PipelineTemplateDefinitionListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *PipelineTemplateDefinitionListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PipelineTemplateDefinitionListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + next, err := page.fn(ctx, page.ptdlr) + if err != nil { + return err + } + page.ptdlr = next + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *PipelineTemplateDefinitionListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page PipelineTemplateDefinitionListResultPage) NotDone() bool { + return !page.ptdlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page PipelineTemplateDefinitionListResultPage) Response() PipelineTemplateDefinitionListResult { + return page.ptdlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page PipelineTemplateDefinitionListResultPage) Values() []PipelineTemplateDefinition { + if page.ptdlr.IsEmpty() { + return nil + } + return *page.ptdlr.Value +} + +// Creates a new instance of the PipelineTemplateDefinitionListResultPage type. +func NewPipelineTemplateDefinitionListResultPage(getNextPage func(context.Context, PipelineTemplateDefinitionListResult) (PipelineTemplateDefinitionListResult, error)) PipelineTemplateDefinitionListResultPage { + return PipelineTemplateDefinitionListResultPage{fn: getNextPage} +} + +// PipelineUpdateParameters request payload used to update an existing Azure Pipeline. +type PipelineUpdateParameters struct { + // Tags - Dictionary of key-value pairs to be set as tags on the Azure Pipeline. This will overwrite any existing tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for PipelineUpdateParameters. +func (pup PipelineUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pup.Tags != nil { + objectMap["tags"] = pup.Tags + } + return json.Marshal(objectMap) +} + +// ProjectReference reference to an Azure DevOps Project. +type ProjectReference struct { + // ID - READ-ONLY; Unique immutable identifier of the Azure DevOps Project. + ID *string `json:"id,omitempty"` + // Name - Name of the Azure DevOps Project. + Name *string `json:"name,omitempty"` +} + +// Resource an Azure Resource Manager (ARM) resource. +type Resource struct { + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Type - READ-ONLY; Resource Type + Type *string `json:"type,omitempty"` + // Tags - Resource Tags + Tags map[string]*string `json:"tags"` + // Location - Resource Location + Location *string `json:"location,omitempty"` + // Name - READ-ONLY; Resource Name + Name *string `json:"name,omitempty"` +} + +// MarshalJSON is the custom marshaler for Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if r.Tags != nil { + objectMap["tags"] = r.Tags + } + if r.Location != nil { + objectMap["location"] = r.Location + } + return json.Marshal(objectMap) +} diff --git a/services/preview/devops/mgmt/2019-07-01-preview/devops/operations.go b/services/preview/devops/mgmt/2019-07-01-preview/devops/operations.go new file mode 100644 index 000000000000..7591c10ecf80 --- /dev/null +++ b/services/preview/devops/mgmt/2019-07-01-preview/devops/operations.go @@ -0,0 +1,147 @@ +package devops + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// OperationsClient is the azure DevOps Resource Provider +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 operations supported by Microsoft.DevOps resource provider. +func (client OperationsClient) List(ctx context.Context) (result OperationListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.olr.Response.Response != nil { + sc = result.olr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "devops.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, "devops.OperationsClient", "List", resp, "Failure sending request") + return + } + + result.olr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devops.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 = "2019-07-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.DevOps/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) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// 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(ctx context.Context, lastResults OperationListResult) (result OperationListResult, err error) { + req, err := lastResults.operationListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "devops.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, "devops.OperationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devops.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) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} diff --git a/services/preview/devops/mgmt/2019-07-01-preview/devops/pipelines.go b/services/preview/devops/mgmt/2019-07-01-preview/devops/pipelines.go new file mode 100644 index 000000000000..70420edcaf52 --- /dev/null +++ b/services/preview/devops/mgmt/2019-07-01-preview/devops/pipelines.go @@ -0,0 +1,599 @@ +package devops + +// 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" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// PipelinesClient is the azure DevOps Resource Provider +type PipelinesClient struct { + BaseClient +} + +// NewPipelinesClient creates an instance of the PipelinesClient client. +func NewPipelinesClient(subscriptionID string) PipelinesClient { + return NewPipelinesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewPipelinesClientWithBaseURI creates an instance of the PipelinesClient client. +func NewPipelinesClientWithBaseURI(baseURI string, subscriptionID string) PipelinesClient { + return PipelinesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates an Azure Pipeline. +// Parameters: +// resourceGroupName - name of the resource group within the Azure subscription. +// pipelineName - the name of the Azure Pipeline resource in ARM. +// createOperationParameters - the request payload to create the Azure Pipeline. +func (client PipelinesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, pipelineName string, createOperationParameters Pipeline) (result PipelinesCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PipelinesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: createOperationParameters, + Constraints: []validation.Constraint{{Target: "createOperationParameters.PipelineProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "createOperationParameters.PipelineProperties.Organization", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "createOperationParameters.PipelineProperties.Organization.Name", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "createOperationParameters.PipelineProperties.Project", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "createOperationParameters.PipelineProperties.Project.Name", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "createOperationParameters.PipelineProperties.BootstrapConfiguration", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "createOperationParameters.PipelineProperties.BootstrapConfiguration.Repository", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "createOperationParameters.PipelineProperties.BootstrapConfiguration.Repository.ID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "createOperationParameters.PipelineProperties.BootstrapConfiguration.Repository.DefaultBranch", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "createOperationParameters.PipelineProperties.BootstrapConfiguration.Repository.Authorization", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "createOperationParameters.PipelineProperties.BootstrapConfiguration.Repository.Authorization.AuthorizationType", Name: validation.Null, Rule: true, Chain: nil}}}, + }}, + {Target: "createOperationParameters.PipelineProperties.BootstrapConfiguration.Template", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "createOperationParameters.PipelineProperties.BootstrapConfiguration.Template.ID", Name: validation.Null, Rule: true, Chain: nil}}}, + }}, + }}}}}); err != nil { + return result, validation.NewError("devops.PipelinesClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, pipelineName, createOperationParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "devops.PipelinesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "devops.PipelinesClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client PipelinesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, pipelineName string, createOperationParameters Pipeline) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "pipelineName": autorest.Encode("path", pipelineName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-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.DevOps/pipelines/{pipelineName}", pathParameters), + autorest.WithJSON(createOperationParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client PipelinesClient) CreateOrUpdateSender(req *http.Request) (future PipelinesCreateOrUpdateFuture, err error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, sd...) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client PipelinesClient) CreateOrUpdateResponder(resp *http.Response) (result Pipeline, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an Azure Pipeline. +// Parameters: +// resourceGroupName - name of the resource group within the Azure subscription. +// pipelineName - the name of the Azure Pipeline resource. +func (client PipelinesClient) Delete(ctx context.Context, resourceGroupName string, pipelineName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PipelinesClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, pipelineName) + if err != nil { + err = autorest.NewErrorWithError(err, "devops.PipelinesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "devops.PipelinesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devops.PipelinesClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client PipelinesClient) DeletePreparer(ctx context.Context, resourceGroupName string, pipelineName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "pipelineName": autorest.Encode("path", pipelineName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-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.DevOps/pipelines/{pipelineName}", 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 PipelinesClient) DeleteSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client PipelinesClient) 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 an existing Azure Pipeline. +// Parameters: +// resourceGroupName - name of the resource group within the Azure subscription. +// pipelineName - the name of the Azure Pipeline resource in ARM. +func (client PipelinesClient) Get(ctx context.Context, resourceGroupName string, pipelineName string) (result Pipeline, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PipelinesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, pipelineName) + if err != nil { + err = autorest.NewErrorWithError(err, "devops.PipelinesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devops.PipelinesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devops.PipelinesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client PipelinesClient) GetPreparer(ctx context.Context, resourceGroupName string, pipelineName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "pipelineName": autorest.Encode("path", pipelineName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-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.DevOps/pipelines/{pipelineName}", 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 PipelinesClient) GetSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client PipelinesClient) GetResponder(resp *http.Response) (result Pipeline, 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 lists all Azure Pipelines under the specified resource group. +// Parameters: +// resourceGroupName - name of the resource group within the Azure subscription. +func (client PipelinesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result PipelineListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PipelinesClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.plr.Response.Response != nil { + sc = result.plr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "devops.PipelinesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.plr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devops.PipelinesClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.plr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devops.PipelinesClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client PipelinesClient) 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 = "2019-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.DevOps/pipelines", 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 PipelinesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client PipelinesClient) ListByResourceGroupResponder(resp *http.Response) (result PipelineListResult, 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 PipelinesClient) listByResourceGroupNextResults(ctx context.Context, lastResults PipelineListResult) (result PipelineListResult, err error) { + req, err := lastResults.pipelineListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "devops.PipelinesClient", "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, "devops.PipelinesClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devops.PipelinesClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client PipelinesClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result PipelineListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PipelinesClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) + return +} + +// ListBySubscription lists all Azure Pipelines under the specified subscription. +func (client PipelinesClient) ListBySubscription(ctx context.Context) (result PipelineListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PipelinesClient.ListBySubscription") + defer func() { + sc := -1 + if result.plr.Response.Response != nil { + sc = result.plr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listBySubscriptionNextResults + req, err := client.ListBySubscriptionPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "devops.PipelinesClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.plr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devops.PipelinesClient", "ListBySubscription", resp, "Failure sending request") + return + } + + result.plr, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devops.PipelinesClient", "ListBySubscription", resp, "Failure responding to request") + } + + return +} + +// ListBySubscriptionPreparer prepares the ListBySubscription request. +func (client PipelinesClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-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.DevOps/pipelines", 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 PipelinesClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (client PipelinesClient) ListBySubscriptionResponder(resp *http.Response) (result PipelineListResult, 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 PipelinesClient) listBySubscriptionNextResults(ctx context.Context, lastResults PipelineListResult) (result PipelineListResult, err error) { + req, err := lastResults.pipelineListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "devops.PipelinesClient", "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, "devops.PipelinesClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") + } + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devops.PipelinesClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. +func (client PipelinesClient) ListBySubscriptionComplete(ctx context.Context) (result PipelineListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PipelinesClient.ListBySubscription") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListBySubscription(ctx) + return +} + +// Update updates the properties of an Azure Pipeline. Currently, only tags can be updated. +// Parameters: +// resourceGroupName - name of the resource group within the Azure subscription. +// pipelineName - the name of the Azure Pipeline resource. +// updateOperationParameters - the request payload containing the properties to update in the Azure Pipeline. +func (client PipelinesClient) Update(ctx context.Context, resourceGroupName string, pipelineName string, updateOperationParameters PipelineUpdateParameters) (result Pipeline, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PipelinesClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, pipelineName, updateOperationParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "devops.PipelinesClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devops.PipelinesClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devops.PipelinesClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client PipelinesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, pipelineName string, updateOperationParameters PipelineUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "pipelineName": autorest.Encode("path", pipelineName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-07-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevOps/pipelines/{pipelineName}", pathParameters), + autorest.WithJSON(updateOperationParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client PipelinesClient) UpdateSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client PipelinesClient) UpdateResponder(resp *http.Response) (result Pipeline, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/devops/mgmt/2019-07-01-preview/devops/pipelinetemplatedefinitions.go b/services/preview/devops/mgmt/2019-07-01-preview/devops/pipelinetemplatedefinitions.go new file mode 100644 index 000000000000..5c0c55c35639 --- /dev/null +++ b/services/preview/devops/mgmt/2019-07-01-preview/devops/pipelinetemplatedefinitions.go @@ -0,0 +1,147 @@ +package devops + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// PipelineTemplateDefinitionsClient is the azure DevOps Resource Provider +type PipelineTemplateDefinitionsClient struct { + BaseClient +} + +// NewPipelineTemplateDefinitionsClient creates an instance of the PipelineTemplateDefinitionsClient client. +func NewPipelineTemplateDefinitionsClient(subscriptionID string) PipelineTemplateDefinitionsClient { + return NewPipelineTemplateDefinitionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewPipelineTemplateDefinitionsClientWithBaseURI creates an instance of the PipelineTemplateDefinitionsClient client. +func NewPipelineTemplateDefinitionsClientWithBaseURI(baseURI string, subscriptionID string) PipelineTemplateDefinitionsClient { + return PipelineTemplateDefinitionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List lists all pipeline templates which can be used to configure an Azure Pipeline. +func (client PipelineTemplateDefinitionsClient) List(ctx context.Context) (result PipelineTemplateDefinitionListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PipelineTemplateDefinitionsClient.List") + defer func() { + sc := -1 + if result.ptdlr.Response.Response != nil { + sc = result.ptdlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "devops.PipelineTemplateDefinitionsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.ptdlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "devops.PipelineTemplateDefinitionsClient", "List", resp, "Failure sending request") + return + } + + result.ptdlr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devops.PipelineTemplateDefinitionsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client PipelineTemplateDefinitionsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2019-07-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.DevOps/pipelineTemplateDefinitions"), + 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 PipelineTemplateDefinitionsClient) ListSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client PipelineTemplateDefinitionsClient) ListResponder(resp *http.Response) (result PipelineTemplateDefinitionListResult, 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 PipelineTemplateDefinitionsClient) listNextResults(ctx context.Context, lastResults PipelineTemplateDefinitionListResult) (result PipelineTemplateDefinitionListResult, err error) { + req, err := lastResults.pipelineTemplateDefinitionListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "devops.PipelineTemplateDefinitionsClient", "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, "devops.PipelineTemplateDefinitionsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "devops.PipelineTemplateDefinitionsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client PipelineTemplateDefinitionsClient) ListComplete(ctx context.Context) (result PipelineTemplateDefinitionListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PipelineTemplateDefinitionsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} diff --git a/services/preview/devops/mgmt/2019-07-01-preview/devops/version.go b/services/preview/devops/mgmt/2019-07-01-preview/devops/version.go new file mode 100644 index 000000000000..a4e9c0942af3 --- /dev/null +++ b/services/preview/devops/mgmt/2019-07-01-preview/devops/version.go @@ -0,0 +1,30 @@ +package devops + +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 + " devops/2019-07-01-preview" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +}