diff --git a/profiles/latest/hybriddatamanager/mgmt/hybriddata/hybriddataapi/models.go b/profiles/latest/hybriddatamanager/mgmt/hybriddata/hybriddataapi/models.go new file mode 100644 index 000000000000..bb1a12c17f72 --- /dev/null +++ b/profiles/latest/hybriddatamanager/mgmt/hybriddata/hybriddataapi/models.go @@ -0,0 +1,31 @@ +// +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 hybriddataapi + +import original "github.com/Azure/azure-sdk-for-go/services/hybriddatamanager/mgmt/2016-06-01/hybriddata/hybriddataapi" + +type DataManagersClientAPI = original.DataManagersClientAPI +type DataServicesClientAPI = original.DataServicesClientAPI +type DataStoreTypesClientAPI = original.DataStoreTypesClientAPI +type DataStoresClientAPI = original.DataStoresClientAPI +type JobDefinitionsClientAPI = original.JobDefinitionsClientAPI +type JobsClientAPI = original.JobsClientAPI +type OperationsClientAPI = original.OperationsClientAPI +type PublicKeysClientAPI = original.PublicKeysClientAPI diff --git a/profiles/latest/hybriddatamanager/mgmt/hybriddata/models.go b/profiles/latest/hybriddatamanager/mgmt/hybriddata/models.go new file mode 100644 index 000000000000..575c9f0ba193 --- /dev/null +++ b/profiles/latest/hybriddatamanager/mgmt/hybriddata/models.go @@ -0,0 +1,298 @@ +// +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 hybriddata + +import ( + "context" + + original "github.com/Azure/azure-sdk-for-go/services/hybriddatamanager/mgmt/2016-06-01/hybriddata" +) + +const ( + DefaultBaseURI = original.DefaultBaseURI +) + +type IsJobCancellable = original.IsJobCancellable + +const ( + Cancellable IsJobCancellable = original.Cancellable + NotCancellable IsJobCancellable = original.NotCancellable +) + +type JobStatus = original.JobStatus + +const ( + Cancelled JobStatus = original.Cancelled + Cancelling JobStatus = original.Cancelling + Failed JobStatus = original.Failed + InProgress JobStatus = original.InProgress + None JobStatus = original.None + Succeeded JobStatus = original.Succeeded + WaitingForAction JobStatus = original.WaitingForAction +) + +type RunLocation = original.RunLocation + +const ( + RunLocationAustraliaeast RunLocation = original.RunLocationAustraliaeast + RunLocationAustraliasoutheast RunLocation = original.RunLocationAustraliasoutheast + RunLocationBrazilsouth RunLocation = original.RunLocationBrazilsouth + RunLocationCanadacentral RunLocation = original.RunLocationCanadacentral + RunLocationCanadaeast RunLocation = original.RunLocationCanadaeast + RunLocationCentralindia RunLocation = original.RunLocationCentralindia + RunLocationCentralus RunLocation = original.RunLocationCentralus + RunLocationEastasia RunLocation = original.RunLocationEastasia + RunLocationEastus RunLocation = original.RunLocationEastus + RunLocationEastus2 RunLocation = original.RunLocationEastus2 + RunLocationJapaneast RunLocation = original.RunLocationJapaneast + RunLocationJapanwest RunLocation = original.RunLocationJapanwest + RunLocationKoreacentral RunLocation = original.RunLocationKoreacentral + RunLocationKoreasouth RunLocation = original.RunLocationKoreasouth + RunLocationNone RunLocation = original.RunLocationNone + RunLocationNorthcentralus RunLocation = original.RunLocationNorthcentralus + RunLocationNortheurope RunLocation = original.RunLocationNortheurope + RunLocationSouthcentralus RunLocation = original.RunLocationSouthcentralus + RunLocationSoutheastasia RunLocation = original.RunLocationSoutheastasia + RunLocationSouthindia RunLocation = original.RunLocationSouthindia + RunLocationUksouth RunLocation = original.RunLocationUksouth + RunLocationUkwest RunLocation = original.RunLocationUkwest + RunLocationWestcentralus RunLocation = original.RunLocationWestcentralus + RunLocationWesteurope RunLocation = original.RunLocationWesteurope + RunLocationWestindia RunLocation = original.RunLocationWestindia + RunLocationWestus RunLocation = original.RunLocationWestus + RunLocationWestus2 RunLocation = original.RunLocationWestus2 +) + +type State = original.State + +const ( + Disabled State = original.Disabled + Enabled State = original.Enabled + Supported State = original.Supported +) + +type SupportedAlgorithm = original.SupportedAlgorithm + +const ( + SupportedAlgorithmNone SupportedAlgorithm = original.SupportedAlgorithmNone + SupportedAlgorithmPlainText SupportedAlgorithm = original.SupportedAlgorithmPlainText + SupportedAlgorithmRSA15 SupportedAlgorithm = original.SupportedAlgorithmRSA15 + SupportedAlgorithmRSAOAEP SupportedAlgorithm = original.SupportedAlgorithmRSAOAEP +) + +type UserConfirmation = original.UserConfirmation + +const ( + NotRequired UserConfirmation = original.NotRequired + Required UserConfirmation = original.Required +) + +type AvailableProviderOperation = original.AvailableProviderOperation +type AvailableProviderOperationDisplay = original.AvailableProviderOperationDisplay +type AvailableProviderOperations = original.AvailableProviderOperations +type AvailableProviderOperationsIterator = original.AvailableProviderOperationsIterator +type AvailableProviderOperationsPage = original.AvailableProviderOperationsPage +type BaseClient = original.BaseClient +type CustomerSecret = original.CustomerSecret +type DataManager = original.DataManager +type DataManagerList = original.DataManagerList +type DataManagerUpdateParameter = original.DataManagerUpdateParameter +type DataManagersClient = original.DataManagersClient +type DataManagersCreateFuture = original.DataManagersCreateFuture +type DataManagersDeleteFuture = original.DataManagersDeleteFuture +type DataManagersUpdateFuture = original.DataManagersUpdateFuture +type DataService = original.DataService +type DataServiceList = original.DataServiceList +type DataServiceListIterator = original.DataServiceListIterator +type DataServiceListPage = original.DataServiceListPage +type DataServiceProperties = original.DataServiceProperties +type DataServicesClient = original.DataServicesClient +type DataStore = original.DataStore +type DataStoreFilter = original.DataStoreFilter +type DataStoreList = original.DataStoreList +type DataStoreListIterator = original.DataStoreListIterator +type DataStoreListPage = original.DataStoreListPage +type DataStoreProperties = original.DataStoreProperties +type DataStoreType = original.DataStoreType +type DataStoreTypeList = original.DataStoreTypeList +type DataStoreTypeListIterator = original.DataStoreTypeListIterator +type DataStoreTypeListPage = original.DataStoreTypeListPage +type DataStoreTypeProperties = original.DataStoreTypeProperties +type DataStoreTypesClient = original.DataStoreTypesClient +type DataStoresClient = original.DataStoresClient +type DataStoresCreateOrUpdateFuture = original.DataStoresCreateOrUpdateFuture +type DataStoresDeleteFuture = original.DataStoresDeleteFuture +type DmsBaseObject = original.DmsBaseObject +type Error = original.Error +type ErrorDetails = original.ErrorDetails +type Job = original.Job +type JobDefinition = original.JobDefinition +type JobDefinitionFilter = original.JobDefinitionFilter +type JobDefinitionList = original.JobDefinitionList +type JobDefinitionListIterator = original.JobDefinitionListIterator +type JobDefinitionListPage = original.JobDefinitionListPage +type JobDefinitionProperties = original.JobDefinitionProperties +type JobDefinitionsClient = original.JobDefinitionsClient +type JobDefinitionsCreateOrUpdateFuture = original.JobDefinitionsCreateOrUpdateFuture +type JobDefinitionsDeleteFuture = original.JobDefinitionsDeleteFuture +type JobDefinitionsRunFuture = original.JobDefinitionsRunFuture +type JobDetails = original.JobDetails +type JobFilter = original.JobFilter +type JobList = original.JobList +type JobListIterator = original.JobListIterator +type JobListPage = original.JobListPage +type JobProperties = original.JobProperties +type JobStages = original.JobStages +type JobsCancelFuture = original.JobsCancelFuture +type JobsClient = original.JobsClient +type JobsResumeFuture = original.JobsResumeFuture +type Key = original.Key +type OperationsClient = original.OperationsClient +type PublicKey = original.PublicKey +type PublicKeyList = original.PublicKeyList +type PublicKeyListIterator = original.PublicKeyListIterator +type PublicKeyListPage = original.PublicKeyListPage +type PublicKeyProperties = original.PublicKeyProperties +type PublicKeysClient = original.PublicKeysClient +type Resource = original.Resource +type RunParameters = original.RunParameters +type Schedule = original.Schedule +type Sku = original.Sku + +func New(subscriptionID string) BaseClient { + return original.New(subscriptionID) +} +func NewAvailableProviderOperationsIterator(page AvailableProviderOperationsPage) AvailableProviderOperationsIterator { + return original.NewAvailableProviderOperationsIterator(page) +} +func NewAvailableProviderOperationsPage(getNextPage func(context.Context, AvailableProviderOperations) (AvailableProviderOperations, error)) AvailableProviderOperationsPage { + return original.NewAvailableProviderOperationsPage(getNextPage) +} +func NewDataManagersClient(subscriptionID string) DataManagersClient { + return original.NewDataManagersClient(subscriptionID) +} +func NewDataManagersClientWithBaseURI(baseURI string, subscriptionID string) DataManagersClient { + return original.NewDataManagersClientWithBaseURI(baseURI, subscriptionID) +} +func NewDataServiceListIterator(page DataServiceListPage) DataServiceListIterator { + return original.NewDataServiceListIterator(page) +} +func NewDataServiceListPage(getNextPage func(context.Context, DataServiceList) (DataServiceList, error)) DataServiceListPage { + return original.NewDataServiceListPage(getNextPage) +} +func NewDataServicesClient(subscriptionID string) DataServicesClient { + return original.NewDataServicesClient(subscriptionID) +} +func NewDataServicesClientWithBaseURI(baseURI string, subscriptionID string) DataServicesClient { + return original.NewDataServicesClientWithBaseURI(baseURI, subscriptionID) +} +func NewDataStoreListIterator(page DataStoreListPage) DataStoreListIterator { + return original.NewDataStoreListIterator(page) +} +func NewDataStoreListPage(getNextPage func(context.Context, DataStoreList) (DataStoreList, error)) DataStoreListPage { + return original.NewDataStoreListPage(getNextPage) +} +func NewDataStoreTypeListIterator(page DataStoreTypeListPage) DataStoreTypeListIterator { + return original.NewDataStoreTypeListIterator(page) +} +func NewDataStoreTypeListPage(getNextPage func(context.Context, DataStoreTypeList) (DataStoreTypeList, error)) DataStoreTypeListPage { + return original.NewDataStoreTypeListPage(getNextPage) +} +func NewDataStoreTypesClient(subscriptionID string) DataStoreTypesClient { + return original.NewDataStoreTypesClient(subscriptionID) +} +func NewDataStoreTypesClientWithBaseURI(baseURI string, subscriptionID string) DataStoreTypesClient { + return original.NewDataStoreTypesClientWithBaseURI(baseURI, subscriptionID) +} +func NewDataStoresClient(subscriptionID string) DataStoresClient { + return original.NewDataStoresClient(subscriptionID) +} +func NewDataStoresClientWithBaseURI(baseURI string, subscriptionID string) DataStoresClient { + return original.NewDataStoresClientWithBaseURI(baseURI, subscriptionID) +} +func NewJobDefinitionListIterator(page JobDefinitionListPage) JobDefinitionListIterator { + return original.NewJobDefinitionListIterator(page) +} +func NewJobDefinitionListPage(getNextPage func(context.Context, JobDefinitionList) (JobDefinitionList, error)) JobDefinitionListPage { + return original.NewJobDefinitionListPage(getNextPage) +} +func NewJobDefinitionsClient(subscriptionID string) JobDefinitionsClient { + return original.NewJobDefinitionsClient(subscriptionID) +} +func NewJobDefinitionsClientWithBaseURI(baseURI string, subscriptionID string) JobDefinitionsClient { + return original.NewJobDefinitionsClientWithBaseURI(baseURI, subscriptionID) +} +func NewJobListIterator(page JobListPage) JobListIterator { + return original.NewJobListIterator(page) +} +func NewJobListPage(getNextPage func(context.Context, JobList) (JobList, error)) JobListPage { + return original.NewJobListPage(getNextPage) +} +func NewJobsClient(subscriptionID string) JobsClient { + return original.NewJobsClient(subscriptionID) +} +func NewJobsClientWithBaseURI(baseURI string, subscriptionID string) JobsClient { + return original.NewJobsClientWithBaseURI(baseURI, subscriptionID) +} +func NewOperationsClient(subscriptionID string) OperationsClient { + return original.NewOperationsClient(subscriptionID) +} +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return original.NewOperationsClientWithBaseURI(baseURI, subscriptionID) +} +func NewPublicKeyListIterator(page PublicKeyListPage) PublicKeyListIterator { + return original.NewPublicKeyListIterator(page) +} +func NewPublicKeyListPage(getNextPage func(context.Context, PublicKeyList) (PublicKeyList, error)) PublicKeyListPage { + return original.NewPublicKeyListPage(getNextPage) +} +func NewPublicKeysClient(subscriptionID string) PublicKeysClient { + return original.NewPublicKeysClient(subscriptionID) +} +func NewPublicKeysClientWithBaseURI(baseURI string, subscriptionID string) PublicKeysClient { + return original.NewPublicKeysClientWithBaseURI(baseURI, subscriptionID) +} +func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { + return original.NewWithBaseURI(baseURI, subscriptionID) +} +func PossibleIsJobCancellableValues() []IsJobCancellable { + return original.PossibleIsJobCancellableValues() +} +func PossibleJobStatusValues() []JobStatus { + return original.PossibleJobStatusValues() +} +func PossibleRunLocationValues() []RunLocation { + return original.PossibleRunLocationValues() +} +func PossibleStateValues() []State { + return original.PossibleStateValues() +} +func PossibleSupportedAlgorithmValues() []SupportedAlgorithm { + return original.PossibleSupportedAlgorithmValues() +} +func PossibleUserConfirmationValues() []UserConfirmation { + return original.PossibleUserConfirmationValues() +} +func UserAgent() string { + return original.UserAgent() + " profiles/latest" +} +func Version() string { + return original.Version() +} diff --git a/profiles/preview/hybriddatamanager/mgmt/hybriddata/hybriddataapi/models.go b/profiles/preview/hybriddatamanager/mgmt/hybriddata/hybriddataapi/models.go new file mode 100644 index 000000000000..bb1a12c17f72 --- /dev/null +++ b/profiles/preview/hybriddatamanager/mgmt/hybriddata/hybriddataapi/models.go @@ -0,0 +1,31 @@ +// +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 hybriddataapi + +import original "github.com/Azure/azure-sdk-for-go/services/hybriddatamanager/mgmt/2016-06-01/hybriddata/hybriddataapi" + +type DataManagersClientAPI = original.DataManagersClientAPI +type DataServicesClientAPI = original.DataServicesClientAPI +type DataStoreTypesClientAPI = original.DataStoreTypesClientAPI +type DataStoresClientAPI = original.DataStoresClientAPI +type JobDefinitionsClientAPI = original.JobDefinitionsClientAPI +type JobsClientAPI = original.JobsClientAPI +type OperationsClientAPI = original.OperationsClientAPI +type PublicKeysClientAPI = original.PublicKeysClientAPI diff --git a/profiles/preview/hybriddatamanager/mgmt/hybriddata/models.go b/profiles/preview/hybriddatamanager/mgmt/hybriddata/models.go new file mode 100644 index 000000000000..73da362ad2f0 --- /dev/null +++ b/profiles/preview/hybriddatamanager/mgmt/hybriddata/models.go @@ -0,0 +1,298 @@ +// +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 hybriddata + +import ( + "context" + + original "github.com/Azure/azure-sdk-for-go/services/hybriddatamanager/mgmt/2016-06-01/hybriddata" +) + +const ( + DefaultBaseURI = original.DefaultBaseURI +) + +type IsJobCancellable = original.IsJobCancellable + +const ( + Cancellable IsJobCancellable = original.Cancellable + NotCancellable IsJobCancellable = original.NotCancellable +) + +type JobStatus = original.JobStatus + +const ( + Cancelled JobStatus = original.Cancelled + Cancelling JobStatus = original.Cancelling + Failed JobStatus = original.Failed + InProgress JobStatus = original.InProgress + None JobStatus = original.None + Succeeded JobStatus = original.Succeeded + WaitingForAction JobStatus = original.WaitingForAction +) + +type RunLocation = original.RunLocation + +const ( + RunLocationAustraliaeast RunLocation = original.RunLocationAustraliaeast + RunLocationAustraliasoutheast RunLocation = original.RunLocationAustraliasoutheast + RunLocationBrazilsouth RunLocation = original.RunLocationBrazilsouth + RunLocationCanadacentral RunLocation = original.RunLocationCanadacentral + RunLocationCanadaeast RunLocation = original.RunLocationCanadaeast + RunLocationCentralindia RunLocation = original.RunLocationCentralindia + RunLocationCentralus RunLocation = original.RunLocationCentralus + RunLocationEastasia RunLocation = original.RunLocationEastasia + RunLocationEastus RunLocation = original.RunLocationEastus + RunLocationEastus2 RunLocation = original.RunLocationEastus2 + RunLocationJapaneast RunLocation = original.RunLocationJapaneast + RunLocationJapanwest RunLocation = original.RunLocationJapanwest + RunLocationKoreacentral RunLocation = original.RunLocationKoreacentral + RunLocationKoreasouth RunLocation = original.RunLocationKoreasouth + RunLocationNone RunLocation = original.RunLocationNone + RunLocationNorthcentralus RunLocation = original.RunLocationNorthcentralus + RunLocationNortheurope RunLocation = original.RunLocationNortheurope + RunLocationSouthcentralus RunLocation = original.RunLocationSouthcentralus + RunLocationSoutheastasia RunLocation = original.RunLocationSoutheastasia + RunLocationSouthindia RunLocation = original.RunLocationSouthindia + RunLocationUksouth RunLocation = original.RunLocationUksouth + RunLocationUkwest RunLocation = original.RunLocationUkwest + RunLocationWestcentralus RunLocation = original.RunLocationWestcentralus + RunLocationWesteurope RunLocation = original.RunLocationWesteurope + RunLocationWestindia RunLocation = original.RunLocationWestindia + RunLocationWestus RunLocation = original.RunLocationWestus + RunLocationWestus2 RunLocation = original.RunLocationWestus2 +) + +type State = original.State + +const ( + Disabled State = original.Disabled + Enabled State = original.Enabled + Supported State = original.Supported +) + +type SupportedAlgorithm = original.SupportedAlgorithm + +const ( + SupportedAlgorithmNone SupportedAlgorithm = original.SupportedAlgorithmNone + SupportedAlgorithmPlainText SupportedAlgorithm = original.SupportedAlgorithmPlainText + SupportedAlgorithmRSA15 SupportedAlgorithm = original.SupportedAlgorithmRSA15 + SupportedAlgorithmRSAOAEP SupportedAlgorithm = original.SupportedAlgorithmRSAOAEP +) + +type UserConfirmation = original.UserConfirmation + +const ( + NotRequired UserConfirmation = original.NotRequired + Required UserConfirmation = original.Required +) + +type AvailableProviderOperation = original.AvailableProviderOperation +type AvailableProviderOperationDisplay = original.AvailableProviderOperationDisplay +type AvailableProviderOperations = original.AvailableProviderOperations +type AvailableProviderOperationsIterator = original.AvailableProviderOperationsIterator +type AvailableProviderOperationsPage = original.AvailableProviderOperationsPage +type BaseClient = original.BaseClient +type CustomerSecret = original.CustomerSecret +type DataManager = original.DataManager +type DataManagerList = original.DataManagerList +type DataManagerUpdateParameter = original.DataManagerUpdateParameter +type DataManagersClient = original.DataManagersClient +type DataManagersCreateFuture = original.DataManagersCreateFuture +type DataManagersDeleteFuture = original.DataManagersDeleteFuture +type DataManagersUpdateFuture = original.DataManagersUpdateFuture +type DataService = original.DataService +type DataServiceList = original.DataServiceList +type DataServiceListIterator = original.DataServiceListIterator +type DataServiceListPage = original.DataServiceListPage +type DataServiceProperties = original.DataServiceProperties +type DataServicesClient = original.DataServicesClient +type DataStore = original.DataStore +type DataStoreFilter = original.DataStoreFilter +type DataStoreList = original.DataStoreList +type DataStoreListIterator = original.DataStoreListIterator +type DataStoreListPage = original.DataStoreListPage +type DataStoreProperties = original.DataStoreProperties +type DataStoreType = original.DataStoreType +type DataStoreTypeList = original.DataStoreTypeList +type DataStoreTypeListIterator = original.DataStoreTypeListIterator +type DataStoreTypeListPage = original.DataStoreTypeListPage +type DataStoreTypeProperties = original.DataStoreTypeProperties +type DataStoreTypesClient = original.DataStoreTypesClient +type DataStoresClient = original.DataStoresClient +type DataStoresCreateOrUpdateFuture = original.DataStoresCreateOrUpdateFuture +type DataStoresDeleteFuture = original.DataStoresDeleteFuture +type DmsBaseObject = original.DmsBaseObject +type Error = original.Error +type ErrorDetails = original.ErrorDetails +type Job = original.Job +type JobDefinition = original.JobDefinition +type JobDefinitionFilter = original.JobDefinitionFilter +type JobDefinitionList = original.JobDefinitionList +type JobDefinitionListIterator = original.JobDefinitionListIterator +type JobDefinitionListPage = original.JobDefinitionListPage +type JobDefinitionProperties = original.JobDefinitionProperties +type JobDefinitionsClient = original.JobDefinitionsClient +type JobDefinitionsCreateOrUpdateFuture = original.JobDefinitionsCreateOrUpdateFuture +type JobDefinitionsDeleteFuture = original.JobDefinitionsDeleteFuture +type JobDefinitionsRunFuture = original.JobDefinitionsRunFuture +type JobDetails = original.JobDetails +type JobFilter = original.JobFilter +type JobList = original.JobList +type JobListIterator = original.JobListIterator +type JobListPage = original.JobListPage +type JobProperties = original.JobProperties +type JobStages = original.JobStages +type JobsCancelFuture = original.JobsCancelFuture +type JobsClient = original.JobsClient +type JobsResumeFuture = original.JobsResumeFuture +type Key = original.Key +type OperationsClient = original.OperationsClient +type PublicKey = original.PublicKey +type PublicKeyList = original.PublicKeyList +type PublicKeyListIterator = original.PublicKeyListIterator +type PublicKeyListPage = original.PublicKeyListPage +type PublicKeyProperties = original.PublicKeyProperties +type PublicKeysClient = original.PublicKeysClient +type Resource = original.Resource +type RunParameters = original.RunParameters +type Schedule = original.Schedule +type Sku = original.Sku + +func New(subscriptionID string) BaseClient { + return original.New(subscriptionID) +} +func NewAvailableProviderOperationsIterator(page AvailableProviderOperationsPage) AvailableProviderOperationsIterator { + return original.NewAvailableProviderOperationsIterator(page) +} +func NewAvailableProviderOperationsPage(getNextPage func(context.Context, AvailableProviderOperations) (AvailableProviderOperations, error)) AvailableProviderOperationsPage { + return original.NewAvailableProviderOperationsPage(getNextPage) +} +func NewDataManagersClient(subscriptionID string) DataManagersClient { + return original.NewDataManagersClient(subscriptionID) +} +func NewDataManagersClientWithBaseURI(baseURI string, subscriptionID string) DataManagersClient { + return original.NewDataManagersClientWithBaseURI(baseURI, subscriptionID) +} +func NewDataServiceListIterator(page DataServiceListPage) DataServiceListIterator { + return original.NewDataServiceListIterator(page) +} +func NewDataServiceListPage(getNextPage func(context.Context, DataServiceList) (DataServiceList, error)) DataServiceListPage { + return original.NewDataServiceListPage(getNextPage) +} +func NewDataServicesClient(subscriptionID string) DataServicesClient { + return original.NewDataServicesClient(subscriptionID) +} +func NewDataServicesClientWithBaseURI(baseURI string, subscriptionID string) DataServicesClient { + return original.NewDataServicesClientWithBaseURI(baseURI, subscriptionID) +} +func NewDataStoreListIterator(page DataStoreListPage) DataStoreListIterator { + return original.NewDataStoreListIterator(page) +} +func NewDataStoreListPage(getNextPage func(context.Context, DataStoreList) (DataStoreList, error)) DataStoreListPage { + return original.NewDataStoreListPage(getNextPage) +} +func NewDataStoreTypeListIterator(page DataStoreTypeListPage) DataStoreTypeListIterator { + return original.NewDataStoreTypeListIterator(page) +} +func NewDataStoreTypeListPage(getNextPage func(context.Context, DataStoreTypeList) (DataStoreTypeList, error)) DataStoreTypeListPage { + return original.NewDataStoreTypeListPage(getNextPage) +} +func NewDataStoreTypesClient(subscriptionID string) DataStoreTypesClient { + return original.NewDataStoreTypesClient(subscriptionID) +} +func NewDataStoreTypesClientWithBaseURI(baseURI string, subscriptionID string) DataStoreTypesClient { + return original.NewDataStoreTypesClientWithBaseURI(baseURI, subscriptionID) +} +func NewDataStoresClient(subscriptionID string) DataStoresClient { + return original.NewDataStoresClient(subscriptionID) +} +func NewDataStoresClientWithBaseURI(baseURI string, subscriptionID string) DataStoresClient { + return original.NewDataStoresClientWithBaseURI(baseURI, subscriptionID) +} +func NewJobDefinitionListIterator(page JobDefinitionListPage) JobDefinitionListIterator { + return original.NewJobDefinitionListIterator(page) +} +func NewJobDefinitionListPage(getNextPage func(context.Context, JobDefinitionList) (JobDefinitionList, error)) JobDefinitionListPage { + return original.NewJobDefinitionListPage(getNextPage) +} +func NewJobDefinitionsClient(subscriptionID string) JobDefinitionsClient { + return original.NewJobDefinitionsClient(subscriptionID) +} +func NewJobDefinitionsClientWithBaseURI(baseURI string, subscriptionID string) JobDefinitionsClient { + return original.NewJobDefinitionsClientWithBaseURI(baseURI, subscriptionID) +} +func NewJobListIterator(page JobListPage) JobListIterator { + return original.NewJobListIterator(page) +} +func NewJobListPage(getNextPage func(context.Context, JobList) (JobList, error)) JobListPage { + return original.NewJobListPage(getNextPage) +} +func NewJobsClient(subscriptionID string) JobsClient { + return original.NewJobsClient(subscriptionID) +} +func NewJobsClientWithBaseURI(baseURI string, subscriptionID string) JobsClient { + return original.NewJobsClientWithBaseURI(baseURI, subscriptionID) +} +func NewOperationsClient(subscriptionID string) OperationsClient { + return original.NewOperationsClient(subscriptionID) +} +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return original.NewOperationsClientWithBaseURI(baseURI, subscriptionID) +} +func NewPublicKeyListIterator(page PublicKeyListPage) PublicKeyListIterator { + return original.NewPublicKeyListIterator(page) +} +func NewPublicKeyListPage(getNextPage func(context.Context, PublicKeyList) (PublicKeyList, error)) PublicKeyListPage { + return original.NewPublicKeyListPage(getNextPage) +} +func NewPublicKeysClient(subscriptionID string) PublicKeysClient { + return original.NewPublicKeysClient(subscriptionID) +} +func NewPublicKeysClientWithBaseURI(baseURI string, subscriptionID string) PublicKeysClient { + return original.NewPublicKeysClientWithBaseURI(baseURI, subscriptionID) +} +func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { + return original.NewWithBaseURI(baseURI, subscriptionID) +} +func PossibleIsJobCancellableValues() []IsJobCancellable { + return original.PossibleIsJobCancellableValues() +} +func PossibleJobStatusValues() []JobStatus { + return original.PossibleJobStatusValues() +} +func PossibleRunLocationValues() []RunLocation { + return original.PossibleRunLocationValues() +} +func PossibleStateValues() []State { + return original.PossibleStateValues() +} +func PossibleSupportedAlgorithmValues() []SupportedAlgorithm { + return original.PossibleSupportedAlgorithmValues() +} +func PossibleUserConfirmationValues() []UserConfirmation { + return original.PossibleUserConfirmationValues() +} +func UserAgent() string { + return original.UserAgent() + " profiles/preview" +} +func Version() string { + return original.Version() +} diff --git a/services/hybriddatamanager/mgmt/2016-06-01/hybriddata/client.go b/services/hybriddatamanager/mgmt/2016-06-01/hybriddata/client.go new file mode 100644 index 000000000000..4a246f8fb3d7 --- /dev/null +++ b/services/hybriddatamanager/mgmt/2016-06-01/hybriddata/client.go @@ -0,0 +1,51 @@ +// Package hybriddata implements the Azure ARM Hybriddata service API version 2016-06-01. +// +// +package hybriddata + +// 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 Hybriddata + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Hybriddata. +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/hybriddatamanager/mgmt/2016-06-01/hybriddata/datamanagers.go b/services/hybriddatamanager/mgmt/2016-06-01/hybriddata/datamanagers.go new file mode 100644 index 000000000000..43df35bc4f94 --- /dev/null +++ b/services/hybriddatamanager/mgmt/2016-06-01/hybriddata/datamanagers.go @@ -0,0 +1,546 @@ +package hybriddata + +// 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" +) + +// DataManagersClient is the client for the DataManagers methods of the Hybriddata service. +type DataManagersClient struct { + BaseClient +} + +// NewDataManagersClient creates an instance of the DataManagersClient client. +func NewDataManagersClient(subscriptionID string) DataManagersClient { + return NewDataManagersClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewDataManagersClientWithBaseURI creates an instance of the DataManagersClient client. +func NewDataManagersClientWithBaseURI(baseURI string, subscriptionID string) DataManagersClient { + return DataManagersClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create creates a new data manager resource with the specified parameters. Existing resources cannot be updated with +// this API +// and should instead be updated with the Update data manager resource API. +// Parameters: +// resourceGroupName - the Resource Group Name +// dataManagerName - the name of the DataManager Resource within the specified resource group. DataManager +// names must be between 3 and 24 characters in length and use any alphanumeric and underscore only +// dataManager - data manager resource details from request body. +func (client DataManagersClient) Create(ctx context.Context, resourceGroupName string, dataManagerName string, dataManager DataManager) (result DataManagersCreateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataManagersClient.Create") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: dataManagerName, + Constraints: []validation.Constraint{{Target: "dataManagerName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "dataManagerName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "dataManagerName", Name: validation.Pattern, Rule: `^[-\w\.]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("hybriddata.DataManagersClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, dataManagerName, dataManager) + if err != nil { + err = autorest.NewErrorWithError(err, "hybriddata.DataManagersClient", "Create", nil, "Failure preparing request") + return + } + + result, err = client.CreateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "hybriddata.DataManagersClient", "Create", result.Response(), "Failure sending request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client DataManagersClient) CreatePreparer(ctx context.Context, resourceGroupName string, dataManagerName string, dataManager DataManager) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "dataManagerName": autorest.Encode("path", dataManagerName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-06-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("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridData/dataManagers/{dataManagerName}", pathParameters), + autorest.WithJSON(dataManager), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client DataManagersClient) CreateSender(req *http.Request) (future DataManagersCreateFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client DataManagersClient) CreateResponder(resp *http.Response) (result DataManager, 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 a data manager resource in Microsoft Azure. +// Parameters: +// resourceGroupName - the Resource Group Name +// dataManagerName - the name of the DataManager Resource within the specified resource group. DataManager +// names must be between 3 and 24 characters in length and use any alphanumeric and underscore only +func (client DataManagersClient) Delete(ctx context.Context, resourceGroupName string, dataManagerName string) (result DataManagersDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataManagersClient.Delete") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: dataManagerName, + Constraints: []validation.Constraint{{Target: "dataManagerName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "dataManagerName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "dataManagerName", Name: validation.Pattern, Rule: `^[-\w\.]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("hybriddata.DataManagersClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, dataManagerName) + if err != nil { + err = autorest.NewErrorWithError(err, "hybriddata.DataManagersClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "hybriddata.DataManagersClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client DataManagersClient) DeletePreparer(ctx context.Context, resourceGroupName string, dataManagerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "dataManagerName": autorest.Encode("path", dataManagerName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridData/dataManagers/{dataManagerName}", 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 DataManagersClient) DeleteSender(req *http.Request) (future DataManagersDeleteFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client DataManagersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets information about the specified data manager resource. +// Parameters: +// resourceGroupName - the Resource Group Name +// dataManagerName - the name of the DataManager Resource within the specified resource group. DataManager +// names must be between 3 and 24 characters in length and use any alphanumeric and underscore only +func (client DataManagersClient) Get(ctx context.Context, resourceGroupName string, dataManagerName string) (result DataManager, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataManagersClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: dataManagerName, + Constraints: []validation.Constraint{{Target: "dataManagerName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "dataManagerName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "dataManagerName", Name: validation.Pattern, Rule: `^[-\w\.]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("hybriddata.DataManagersClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, dataManagerName) + if err != nil { + err = autorest.NewErrorWithError(err, "hybriddata.DataManagersClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "hybriddata.DataManagersClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hybriddata.DataManagersClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client DataManagersClient) GetPreparer(ctx context.Context, resourceGroupName string, dataManagerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "dataManagerName": autorest.Encode("path", dataManagerName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridData/dataManagers/{dataManagerName}", 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 DataManagersClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client DataManagersClient) GetResponder(resp *http.Response) (result DataManager, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists all the data manager resources available under the subscription. +func (client DataManagersClient) List(ctx context.Context) (result DataManagerList, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataManagersClient.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, "hybriddata.DataManagersClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "hybriddata.DataManagersClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hybriddata.DataManagersClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client DataManagersClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.HybridData/dataManagers", pathParameters), + 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 DataManagersClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client DataManagersClient) ListResponder(resp *http.Response) (result DataManagerList, 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 the data manager resources available under the given resource group. +// Parameters: +// resourceGroupName - the Resource Group Name +func (client DataManagersClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result DataManagerList, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataManagersClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "hybriddata.DataManagersClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "hybriddata.DataManagersClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hybriddata.DataManagersClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client DataManagersClient) 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 = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridData/dataManagers", 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 DataManagersClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client DataManagersClient) ListByResourceGroupResponder(resp *http.Response) (result DataManagerList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update updates the properties of an existing data manager resource. +// Parameters: +// resourceGroupName - the Resource Group Name +// dataManagerName - the name of the DataManager Resource within the specified resource group. DataManager +// names must be between 3 and 24 characters in length and use any alphanumeric and underscore only +// dataManagerUpdateParameter - data manager resource details from request body. +// ifMatch - defines the If-Match condition. The patch will be performed only if the ETag of the data manager +// resource on the server matches this value. +func (client DataManagersClient) Update(ctx context.Context, resourceGroupName string, dataManagerName string, dataManagerUpdateParameter DataManagerUpdateParameter, ifMatch string) (result DataManagersUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataManagersClient.Update") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: dataManagerName, + Constraints: []validation.Constraint{{Target: "dataManagerName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "dataManagerName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "dataManagerName", Name: validation.Pattern, Rule: `^[-\w\.]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("hybriddata.DataManagersClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, dataManagerName, dataManagerUpdateParameter, ifMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "hybriddata.DataManagersClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "hybriddata.DataManagersClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client DataManagersClient) UpdatePreparer(ctx context.Context, resourceGroupName string, dataManagerName string, dataManagerUpdateParameter DataManagerUpdateParameter, ifMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "dataManagerName": autorest.Encode("path", dataManagerName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-06-01" + 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.HybridData/dataManagers/{dataManagerName}", pathParameters), + autorest.WithJSON(dataManagerUpdateParameter), + autorest.WithQueryParameters(queryParameters)) + if len(ifMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + } + 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 DataManagersClient) UpdateSender(req *http.Request) (future DataManagersUpdateFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client DataManagersClient) UpdateResponder(resp *http.Response) (result DataManager, 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 +} diff --git a/services/hybriddatamanager/mgmt/2016-06-01/hybriddata/dataservices.go b/services/hybriddatamanager/mgmt/2016-06-01/hybriddata/dataservices.go new file mode 100644 index 000000000000..a755abbbd1c6 --- /dev/null +++ b/services/hybriddatamanager/mgmt/2016-06-01/hybriddata/dataservices.go @@ -0,0 +1,254 @@ +package hybriddata + +// 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" +) + +// DataServicesClient is the client for the DataServices methods of the Hybriddata service. +type DataServicesClient struct { + BaseClient +} + +// NewDataServicesClient creates an instance of the DataServicesClient client. +func NewDataServicesClient(subscriptionID string) DataServicesClient { + return NewDataServicesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewDataServicesClientWithBaseURI creates an instance of the DataServicesClient client. +func NewDataServicesClientWithBaseURI(baseURI string, subscriptionID string) DataServicesClient { + return DataServicesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get gets the data service that match the data service name given. +// Parameters: +// dataServiceName - the name of the data service that is being queried. +// resourceGroupName - the Resource Group Name +// dataManagerName - the name of the DataManager Resource within the specified resource group. DataManager +// names must be between 3 and 24 characters in length and use any alphanumeric and underscore only +func (client DataServicesClient) Get(ctx context.Context, dataServiceName string, resourceGroupName string, dataManagerName string) (result DataService, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataServicesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: dataManagerName, + Constraints: []validation.Constraint{{Target: "dataManagerName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "dataManagerName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "dataManagerName", Name: validation.Pattern, Rule: `^[-\w\.]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("hybriddata.DataServicesClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, dataServiceName, resourceGroupName, dataManagerName) + if err != nil { + err = autorest.NewErrorWithError(err, "hybriddata.DataServicesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "hybriddata.DataServicesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hybriddata.DataServicesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client DataServicesClient) GetPreparer(ctx context.Context, dataServiceName string, resourceGroupName string, dataManagerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "dataManagerName": autorest.Encode("path", dataManagerName), + "dataServiceName": autorest.Encode("path", dataServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridData/dataManagers/{dataManagerName}/dataServices/{dataServiceName}", 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 DataServicesClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client DataServicesClient) GetResponder(resp *http.Response) (result DataService, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByDataManager this method gets all the data services. +// Parameters: +// resourceGroupName - the Resource Group Name +// dataManagerName - the name of the DataManager Resource within the specified resource group. DataManager +// names must be between 3 and 24 characters in length and use any alphanumeric and underscore only +func (client DataServicesClient) ListByDataManager(ctx context.Context, resourceGroupName string, dataManagerName string) (result DataServiceListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataServicesClient.ListByDataManager") + defer func() { + sc := -1 + if result.dsl.Response.Response != nil { + sc = result.dsl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: dataManagerName, + Constraints: []validation.Constraint{{Target: "dataManagerName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "dataManagerName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "dataManagerName", Name: validation.Pattern, Rule: `^[-\w\.]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("hybriddata.DataServicesClient", "ListByDataManager", err.Error()) + } + + result.fn = client.listByDataManagerNextResults + req, err := client.ListByDataManagerPreparer(ctx, resourceGroupName, dataManagerName) + if err != nil { + err = autorest.NewErrorWithError(err, "hybriddata.DataServicesClient", "ListByDataManager", nil, "Failure preparing request") + return + } + + resp, err := client.ListByDataManagerSender(req) + if err != nil { + result.dsl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "hybriddata.DataServicesClient", "ListByDataManager", resp, "Failure sending request") + return + } + + result.dsl, err = client.ListByDataManagerResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hybriddata.DataServicesClient", "ListByDataManager", resp, "Failure responding to request") + } + + return +} + +// ListByDataManagerPreparer prepares the ListByDataManager request. +func (client DataServicesClient) ListByDataManagerPreparer(ctx context.Context, resourceGroupName string, dataManagerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "dataManagerName": autorest.Encode("path", dataManagerName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridData/dataManagers/{dataManagerName}/dataServices", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByDataManagerSender sends the ListByDataManager request. The method will close the +// http.Response Body if it receives an error. +func (client DataServicesClient) ListByDataManagerSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListByDataManagerResponder handles the response to the ListByDataManager request. The method always +// closes the http.Response Body. +func (client DataServicesClient) ListByDataManagerResponder(resp *http.Response) (result DataServiceList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByDataManagerNextResults retrieves the next set of results, if any. +func (client DataServicesClient) listByDataManagerNextResults(ctx context.Context, lastResults DataServiceList) (result DataServiceList, err error) { + req, err := lastResults.dataServiceListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "hybriddata.DataServicesClient", "listByDataManagerNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByDataManagerSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "hybriddata.DataServicesClient", "listByDataManagerNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByDataManagerResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hybriddata.DataServicesClient", "listByDataManagerNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByDataManagerComplete enumerates all values, automatically crossing page boundaries as required. +func (client DataServicesClient) ListByDataManagerComplete(ctx context.Context, resourceGroupName string, dataManagerName string) (result DataServiceListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataServicesClient.ListByDataManager") + 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.ListByDataManager(ctx, resourceGroupName, dataManagerName) + return +} diff --git a/services/hybriddatamanager/mgmt/2016-06-01/hybriddata/datastores.go b/services/hybriddatamanager/mgmt/2016-06-01/hybriddata/datastores.go new file mode 100644 index 000000000000..14f6af9dbd18 --- /dev/null +++ b/services/hybriddatamanager/mgmt/2016-06-01/hybriddata/datastores.go @@ -0,0 +1,439 @@ +package hybriddata + +// 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" +) + +// DataStoresClient is the client for the DataStores methods of the Hybriddata service. +type DataStoresClient struct { + BaseClient +} + +// NewDataStoresClient creates an instance of the DataStoresClient client. +func NewDataStoresClient(subscriptionID string) DataStoresClient { + return NewDataStoresClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewDataStoresClientWithBaseURI creates an instance of the DataStoresClient client. +func NewDataStoresClientWithBaseURI(baseURI string, subscriptionID string) DataStoresClient { + return DataStoresClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates the data store/repository in the data manager. +// Parameters: +// dataStoreName - the data store/repository name to be created or updated. +// dataStore - the data store/repository object to be created or updated. +// resourceGroupName - the Resource Group Name +// dataManagerName - the name of the DataManager Resource within the specified resource group. DataManager +// names must be between 3 and 24 characters in length and use any alphanumeric and underscore only +func (client DataStoresClient) CreateOrUpdate(ctx context.Context, dataStoreName string, dataStore DataStore, resourceGroupName string, dataManagerName string) (result DataStoresCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataStoresClient.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: dataStore, + Constraints: []validation.Constraint{{Target: "dataStore.DataStoreProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "dataStore.DataStoreProperties.DataStoreTypeID", Name: validation.Null, Rule: true, Chain: nil}}}}}, + {TargetValue: dataManagerName, + Constraints: []validation.Constraint{{Target: "dataManagerName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "dataManagerName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "dataManagerName", Name: validation.Pattern, Rule: `^[-\w\.]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("hybriddata.DataStoresClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, dataStoreName, dataStore, resourceGroupName, dataManagerName) + if err != nil { + err = autorest.NewErrorWithError(err, "hybriddata.DataStoresClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "hybriddata.DataStoresClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client DataStoresClient) CreateOrUpdatePreparer(ctx context.Context, dataStoreName string, dataStore DataStore, resourceGroupName string, dataManagerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "dataManagerName": autorest.Encode("path", dataManagerName), + "dataStoreName": autorest.Encode("path", dataStoreName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-06-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("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridData/dataManagers/{dataManagerName}/dataStores/{dataStoreName}", pathParameters), + autorest.WithJSON(dataStore), + 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 DataStoresClient) CreateOrUpdateSender(req *http.Request) (future DataStoresCreateOrUpdateFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + 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 DataStoresClient) CreateOrUpdateResponder(resp *http.Response) (result DataStore, 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 this method deletes the given data store/repository. +// Parameters: +// dataStoreName - the data store/repository name to be deleted. +// resourceGroupName - the Resource Group Name +// dataManagerName - the name of the DataManager Resource within the specified resource group. DataManager +// names must be between 3 and 24 characters in length and use any alphanumeric and underscore only +func (client DataStoresClient) Delete(ctx context.Context, dataStoreName string, resourceGroupName string, dataManagerName string) (result DataStoresDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataStoresClient.Delete") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: dataManagerName, + Constraints: []validation.Constraint{{Target: "dataManagerName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "dataManagerName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "dataManagerName", Name: validation.Pattern, Rule: `^[-\w\.]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("hybriddata.DataStoresClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, dataStoreName, resourceGroupName, dataManagerName) + if err != nil { + err = autorest.NewErrorWithError(err, "hybriddata.DataStoresClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "hybriddata.DataStoresClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client DataStoresClient) DeletePreparer(ctx context.Context, dataStoreName string, resourceGroupName string, dataManagerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "dataManagerName": autorest.Encode("path", dataManagerName), + "dataStoreName": autorest.Encode("path", dataStoreName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridData/dataManagers/{dataManagerName}/dataStores/{dataStoreName}", 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 DataStoresClient) DeleteSender(req *http.Request) (future DataStoresDeleteFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client DataStoresClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get this method gets the data store/repository by name. +// Parameters: +// dataStoreName - the data store/repository name queried. +// resourceGroupName - the Resource Group Name +// dataManagerName - the name of the DataManager Resource within the specified resource group. DataManager +// names must be between 3 and 24 characters in length and use any alphanumeric and underscore only +func (client DataStoresClient) Get(ctx context.Context, dataStoreName string, resourceGroupName string, dataManagerName string) (result DataStore, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataStoresClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: dataManagerName, + Constraints: []validation.Constraint{{Target: "dataManagerName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "dataManagerName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "dataManagerName", Name: validation.Pattern, Rule: `^[-\w\.]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("hybriddata.DataStoresClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, dataStoreName, resourceGroupName, dataManagerName) + if err != nil { + err = autorest.NewErrorWithError(err, "hybriddata.DataStoresClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "hybriddata.DataStoresClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hybriddata.DataStoresClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client DataStoresClient) GetPreparer(ctx context.Context, dataStoreName string, resourceGroupName string, dataManagerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "dataManagerName": autorest.Encode("path", dataManagerName), + "dataStoreName": autorest.Encode("path", dataStoreName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridData/dataManagers/{dataManagerName}/dataStores/{dataStoreName}", 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 DataStoresClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client DataStoresClient) GetResponder(resp *http.Response) (result DataStore, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByDataManager gets all the data stores/repositories in the given resource. +// Parameters: +// resourceGroupName - the Resource Group Name +// dataManagerName - the name of the DataManager Resource within the specified resource group. DataManager +// names must be between 3 and 24 characters in length and use any alphanumeric and underscore only +// filter - oData Filter options +func (client DataStoresClient) ListByDataManager(ctx context.Context, resourceGroupName string, dataManagerName string, filter string) (result DataStoreListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataStoresClient.ListByDataManager") + defer func() { + sc := -1 + if result.dsl.Response.Response != nil { + sc = result.dsl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: dataManagerName, + Constraints: []validation.Constraint{{Target: "dataManagerName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "dataManagerName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "dataManagerName", Name: validation.Pattern, Rule: `^[-\w\.]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("hybriddata.DataStoresClient", "ListByDataManager", err.Error()) + } + + result.fn = client.listByDataManagerNextResults + req, err := client.ListByDataManagerPreparer(ctx, resourceGroupName, dataManagerName, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "hybriddata.DataStoresClient", "ListByDataManager", nil, "Failure preparing request") + return + } + + resp, err := client.ListByDataManagerSender(req) + if err != nil { + result.dsl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "hybriddata.DataStoresClient", "ListByDataManager", resp, "Failure sending request") + return + } + + result.dsl, err = client.ListByDataManagerResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hybriddata.DataStoresClient", "ListByDataManager", resp, "Failure responding to request") + } + + return +} + +// ListByDataManagerPreparer prepares the ListByDataManager request. +func (client DataStoresClient) ListByDataManagerPreparer(ctx context.Context, resourceGroupName string, dataManagerName string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "dataManagerName": autorest.Encode("path", dataManagerName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridData/dataManagers/{dataManagerName}/dataStores", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByDataManagerSender sends the ListByDataManager request. The method will close the +// http.Response Body if it receives an error. +func (client DataStoresClient) ListByDataManagerSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListByDataManagerResponder handles the response to the ListByDataManager request. The method always +// closes the http.Response Body. +func (client DataStoresClient) ListByDataManagerResponder(resp *http.Response) (result DataStoreList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByDataManagerNextResults retrieves the next set of results, if any. +func (client DataStoresClient) listByDataManagerNextResults(ctx context.Context, lastResults DataStoreList) (result DataStoreList, err error) { + req, err := lastResults.dataStoreListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "hybriddata.DataStoresClient", "listByDataManagerNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByDataManagerSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "hybriddata.DataStoresClient", "listByDataManagerNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByDataManagerResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hybriddata.DataStoresClient", "listByDataManagerNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByDataManagerComplete enumerates all values, automatically crossing page boundaries as required. +func (client DataStoresClient) ListByDataManagerComplete(ctx context.Context, resourceGroupName string, dataManagerName string, filter string) (result DataStoreListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataStoresClient.ListByDataManager") + 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.ListByDataManager(ctx, resourceGroupName, dataManagerName, filter) + return +} diff --git a/services/hybriddatamanager/mgmt/2016-06-01/hybriddata/datastoretypes.go b/services/hybriddatamanager/mgmt/2016-06-01/hybriddata/datastoretypes.go new file mode 100644 index 000000000000..21123caf5ecc --- /dev/null +++ b/services/hybriddatamanager/mgmt/2016-06-01/hybriddata/datastoretypes.go @@ -0,0 +1,254 @@ +package hybriddata + +// 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" +) + +// DataStoreTypesClient is the client for the DataStoreTypes methods of the Hybriddata service. +type DataStoreTypesClient struct { + BaseClient +} + +// NewDataStoreTypesClient creates an instance of the DataStoreTypesClient client. +func NewDataStoreTypesClient(subscriptionID string) DataStoreTypesClient { + return NewDataStoreTypesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewDataStoreTypesClientWithBaseURI creates an instance of the DataStoreTypesClient client. +func NewDataStoreTypesClientWithBaseURI(baseURI string, subscriptionID string) DataStoreTypesClient { + return DataStoreTypesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get gets the data store/repository type given its name. +// Parameters: +// dataStoreTypeName - the data store/repository type name for which details are needed. +// resourceGroupName - the Resource Group Name +// dataManagerName - the name of the DataManager Resource within the specified resource group. DataManager +// names must be between 3 and 24 characters in length and use any alphanumeric and underscore only +func (client DataStoreTypesClient) Get(ctx context.Context, dataStoreTypeName string, resourceGroupName string, dataManagerName string) (result DataStoreType, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataStoreTypesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: dataManagerName, + Constraints: []validation.Constraint{{Target: "dataManagerName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "dataManagerName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "dataManagerName", Name: validation.Pattern, Rule: `^[-\w\.]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("hybriddata.DataStoreTypesClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, dataStoreTypeName, resourceGroupName, dataManagerName) + if err != nil { + err = autorest.NewErrorWithError(err, "hybriddata.DataStoreTypesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "hybriddata.DataStoreTypesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hybriddata.DataStoreTypesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client DataStoreTypesClient) GetPreparer(ctx context.Context, dataStoreTypeName string, resourceGroupName string, dataManagerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "dataManagerName": autorest.Encode("path", dataManagerName), + "dataStoreTypeName": autorest.Encode("path", dataStoreTypeName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridData/dataManagers/{dataManagerName}/dataStoreTypes/{dataStoreTypeName}", 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 DataStoreTypesClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client DataStoreTypesClient) GetResponder(resp *http.Response) (result DataStoreType, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByDataManager gets all the data store/repository types that the resource supports. +// Parameters: +// resourceGroupName - the Resource Group Name +// dataManagerName - the name of the DataManager Resource within the specified resource group. DataManager +// names must be between 3 and 24 characters in length and use any alphanumeric and underscore only +func (client DataStoreTypesClient) ListByDataManager(ctx context.Context, resourceGroupName string, dataManagerName string) (result DataStoreTypeListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataStoreTypesClient.ListByDataManager") + defer func() { + sc := -1 + if result.dstl.Response.Response != nil { + sc = result.dstl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: dataManagerName, + Constraints: []validation.Constraint{{Target: "dataManagerName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "dataManagerName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "dataManagerName", Name: validation.Pattern, Rule: `^[-\w\.]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("hybriddata.DataStoreTypesClient", "ListByDataManager", err.Error()) + } + + result.fn = client.listByDataManagerNextResults + req, err := client.ListByDataManagerPreparer(ctx, resourceGroupName, dataManagerName) + if err != nil { + err = autorest.NewErrorWithError(err, "hybriddata.DataStoreTypesClient", "ListByDataManager", nil, "Failure preparing request") + return + } + + resp, err := client.ListByDataManagerSender(req) + if err != nil { + result.dstl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "hybriddata.DataStoreTypesClient", "ListByDataManager", resp, "Failure sending request") + return + } + + result.dstl, err = client.ListByDataManagerResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hybriddata.DataStoreTypesClient", "ListByDataManager", resp, "Failure responding to request") + } + + return +} + +// ListByDataManagerPreparer prepares the ListByDataManager request. +func (client DataStoreTypesClient) ListByDataManagerPreparer(ctx context.Context, resourceGroupName string, dataManagerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "dataManagerName": autorest.Encode("path", dataManagerName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridData/dataManagers/{dataManagerName}/dataStoreTypes", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByDataManagerSender sends the ListByDataManager request. The method will close the +// http.Response Body if it receives an error. +func (client DataStoreTypesClient) ListByDataManagerSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListByDataManagerResponder handles the response to the ListByDataManager request. The method always +// closes the http.Response Body. +func (client DataStoreTypesClient) ListByDataManagerResponder(resp *http.Response) (result DataStoreTypeList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByDataManagerNextResults retrieves the next set of results, if any. +func (client DataStoreTypesClient) listByDataManagerNextResults(ctx context.Context, lastResults DataStoreTypeList) (result DataStoreTypeList, err error) { + req, err := lastResults.dataStoreTypeListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "hybriddata.DataStoreTypesClient", "listByDataManagerNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByDataManagerSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "hybriddata.DataStoreTypesClient", "listByDataManagerNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByDataManagerResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hybriddata.DataStoreTypesClient", "listByDataManagerNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByDataManagerComplete enumerates all values, automatically crossing page boundaries as required. +func (client DataStoreTypesClient) ListByDataManagerComplete(ctx context.Context, resourceGroupName string, dataManagerName string) (result DataStoreTypeListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataStoreTypesClient.ListByDataManager") + 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.ListByDataManager(ctx, resourceGroupName, dataManagerName) + return +} diff --git a/services/hybriddatamanager/mgmt/2016-06-01/hybriddata/hybriddataapi/interfaces.go b/services/hybriddatamanager/mgmt/2016-06-01/hybriddata/hybriddataapi/interfaces.go new file mode 100644 index 000000000000..7e2d9274a251 --- /dev/null +++ b/services/hybriddatamanager/mgmt/2016-06-01/hybriddata/hybriddataapi/interfaces.go @@ -0,0 +1,100 @@ +package hybriddataapi + +// 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/hybriddatamanager/mgmt/2016-06-01/hybriddata" +) + +// OperationsClientAPI contains the set of methods on the OperationsClient type. +type OperationsClientAPI interface { + List(ctx context.Context) (result hybriddata.AvailableProviderOperationsPage, err error) +} + +var _ OperationsClientAPI = (*hybriddata.OperationsClient)(nil) + +// DataManagersClientAPI contains the set of methods on the DataManagersClient type. +type DataManagersClientAPI interface { + Create(ctx context.Context, resourceGroupName string, dataManagerName string, dataManager hybriddata.DataManager) (result hybriddata.DataManagersCreateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, dataManagerName string) (result hybriddata.DataManagersDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, dataManagerName string) (result hybriddata.DataManager, err error) + List(ctx context.Context) (result hybriddata.DataManagerList, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result hybriddata.DataManagerList, err error) + Update(ctx context.Context, resourceGroupName string, dataManagerName string, dataManagerUpdateParameter hybriddata.DataManagerUpdateParameter, ifMatch string) (result hybriddata.DataManagersUpdateFuture, err error) +} + +var _ DataManagersClientAPI = (*hybriddata.DataManagersClient)(nil) + +// DataServicesClientAPI contains the set of methods on the DataServicesClient type. +type DataServicesClientAPI interface { + Get(ctx context.Context, dataServiceName string, resourceGroupName string, dataManagerName string) (result hybriddata.DataService, err error) + ListByDataManager(ctx context.Context, resourceGroupName string, dataManagerName string) (result hybriddata.DataServiceListPage, err error) +} + +var _ DataServicesClientAPI = (*hybriddata.DataServicesClient)(nil) + +// JobDefinitionsClientAPI contains the set of methods on the JobDefinitionsClient type. +type JobDefinitionsClientAPI interface { + CreateOrUpdate(ctx context.Context, dataServiceName string, jobDefinitionName string, jobDefinition hybriddata.JobDefinition, resourceGroupName string, dataManagerName string) (result hybriddata.JobDefinitionsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, dataServiceName string, jobDefinitionName string, resourceGroupName string, dataManagerName string) (result hybriddata.JobDefinitionsDeleteFuture, err error) + Get(ctx context.Context, dataServiceName string, jobDefinitionName string, resourceGroupName string, dataManagerName string) (result hybriddata.JobDefinition, err error) + ListByDataManager(ctx context.Context, resourceGroupName string, dataManagerName string, filter string) (result hybriddata.JobDefinitionListPage, err error) + ListByDataService(ctx context.Context, dataServiceName string, resourceGroupName string, dataManagerName string, filter string) (result hybriddata.JobDefinitionListPage, err error) + Run(ctx context.Context, dataServiceName string, jobDefinitionName string, runParameters hybriddata.RunParameters, resourceGroupName string, dataManagerName string) (result hybriddata.JobDefinitionsRunFuture, err error) +} + +var _ JobDefinitionsClientAPI = (*hybriddata.JobDefinitionsClient)(nil) + +// JobsClientAPI contains the set of methods on the JobsClient type. +type JobsClientAPI interface { + Cancel(ctx context.Context, dataServiceName string, jobDefinitionName string, jobID string, resourceGroupName string, dataManagerName string) (result hybriddata.JobsCancelFuture, err error) + Get(ctx context.Context, dataServiceName string, jobDefinitionName string, jobID string, resourceGroupName string, dataManagerName string, expand string) (result hybriddata.Job, err error) + ListByDataManager(ctx context.Context, resourceGroupName string, dataManagerName string, filter string) (result hybriddata.JobListPage, err error) + ListByDataService(ctx context.Context, dataServiceName string, resourceGroupName string, dataManagerName string, filter string) (result hybriddata.JobListPage, err error) + ListByJobDefinition(ctx context.Context, dataServiceName string, jobDefinitionName string, resourceGroupName string, dataManagerName string, filter string) (result hybriddata.JobListPage, err error) + Resume(ctx context.Context, dataServiceName string, jobDefinitionName string, jobID string, resourceGroupName string, dataManagerName string) (result hybriddata.JobsResumeFuture, err error) +} + +var _ JobsClientAPI = (*hybriddata.JobsClient)(nil) + +// DataStoresClientAPI contains the set of methods on the DataStoresClient type. +type DataStoresClientAPI interface { + CreateOrUpdate(ctx context.Context, dataStoreName string, dataStore hybriddata.DataStore, resourceGroupName string, dataManagerName string) (result hybriddata.DataStoresCreateOrUpdateFuture, err error) + Delete(ctx context.Context, dataStoreName string, resourceGroupName string, dataManagerName string) (result hybriddata.DataStoresDeleteFuture, err error) + Get(ctx context.Context, dataStoreName string, resourceGroupName string, dataManagerName string) (result hybriddata.DataStore, err error) + ListByDataManager(ctx context.Context, resourceGroupName string, dataManagerName string, filter string) (result hybriddata.DataStoreListPage, err error) +} + +var _ DataStoresClientAPI = (*hybriddata.DataStoresClient)(nil) + +// DataStoreTypesClientAPI contains the set of methods on the DataStoreTypesClient type. +type DataStoreTypesClientAPI interface { + Get(ctx context.Context, dataStoreTypeName string, resourceGroupName string, dataManagerName string) (result hybriddata.DataStoreType, err error) + ListByDataManager(ctx context.Context, resourceGroupName string, dataManagerName string) (result hybriddata.DataStoreTypeListPage, err error) +} + +var _ DataStoreTypesClientAPI = (*hybriddata.DataStoreTypesClient)(nil) + +// PublicKeysClientAPI contains the set of methods on the PublicKeysClient type. +type PublicKeysClientAPI interface { + Get(ctx context.Context, publicKeyName string, resourceGroupName string, dataManagerName string) (result hybriddata.PublicKey, err error) + ListByDataManager(ctx context.Context, resourceGroupName string, dataManagerName string) (result hybriddata.PublicKeyListPage, err error) +} + +var _ PublicKeysClientAPI = (*hybriddata.PublicKeysClient)(nil) diff --git a/services/hybriddatamanager/mgmt/2016-06-01/hybriddata/jobdefinitions.go b/services/hybriddatamanager/mgmt/2016-06-01/hybriddata/jobdefinitions.go new file mode 100644 index 000000000000..3456256a37f0 --- /dev/null +++ b/services/hybriddatamanager/mgmt/2016-06-01/hybriddata/jobdefinitions.go @@ -0,0 +1,669 @@ +package hybriddata + +// 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" +) + +// JobDefinitionsClient is the client for the JobDefinitions methods of the Hybriddata service. +type JobDefinitionsClient struct { + BaseClient +} + +// NewJobDefinitionsClient creates an instance of the JobDefinitionsClient client. +func NewJobDefinitionsClient(subscriptionID string) JobDefinitionsClient { + return NewJobDefinitionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewJobDefinitionsClientWithBaseURI creates an instance of the JobDefinitionsClient client. +func NewJobDefinitionsClientWithBaseURI(baseURI string, subscriptionID string) JobDefinitionsClient { + return JobDefinitionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a job definition. +// Parameters: +// dataServiceName - the data service type of the job definition. +// jobDefinitionName - the job definition name to be created or updated. +// jobDefinition - job Definition object to be created or updated. +// resourceGroupName - the Resource Group Name +// dataManagerName - the name of the DataManager Resource within the specified resource group. DataManager +// names must be between 3 and 24 characters in length and use any alphanumeric and underscore only +func (client JobDefinitionsClient) CreateOrUpdate(ctx context.Context, dataServiceName string, jobDefinitionName string, jobDefinition JobDefinition, resourceGroupName string, dataManagerName string) (result JobDefinitionsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/JobDefinitionsClient.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: jobDefinition, + Constraints: []validation.Constraint{{Target: "jobDefinition.JobDefinitionProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "jobDefinition.JobDefinitionProperties.DataSourceID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "jobDefinition.JobDefinitionProperties.DataSinkID", Name: validation.Null, Rule: true, Chain: nil}, + }}}}, + {TargetValue: dataManagerName, + Constraints: []validation.Constraint{{Target: "dataManagerName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "dataManagerName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "dataManagerName", Name: validation.Pattern, Rule: `^[-\w\.]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("hybriddata.JobDefinitionsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, dataServiceName, jobDefinitionName, jobDefinition, resourceGroupName, dataManagerName) + if err != nil { + err = autorest.NewErrorWithError(err, "hybriddata.JobDefinitionsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "hybriddata.JobDefinitionsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client JobDefinitionsClient) CreateOrUpdatePreparer(ctx context.Context, dataServiceName string, jobDefinitionName string, jobDefinition JobDefinition, resourceGroupName string, dataManagerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "dataManagerName": autorest.Encode("path", dataManagerName), + "dataServiceName": autorest.Encode("path", dataServiceName), + "jobDefinitionName": autorest.Encode("path", jobDefinitionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-06-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("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridData/dataManagers/{dataManagerName}/dataServices/{dataServiceName}/jobDefinitions/{jobDefinitionName}", pathParameters), + autorest.WithJSON(jobDefinition), + 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 JobDefinitionsClient) CreateOrUpdateSender(req *http.Request) (future JobDefinitionsCreateOrUpdateFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + 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 JobDefinitionsClient) CreateOrUpdateResponder(resp *http.Response) (result JobDefinition, 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 this method deletes the given job definition. +// Parameters: +// dataServiceName - the data service type of the job definition. +// jobDefinitionName - the job definition name to be deleted. +// resourceGroupName - the Resource Group Name +// dataManagerName - the name of the DataManager Resource within the specified resource group. DataManager +// names must be between 3 and 24 characters in length and use any alphanumeric and underscore only +func (client JobDefinitionsClient) Delete(ctx context.Context, dataServiceName string, jobDefinitionName string, resourceGroupName string, dataManagerName string) (result JobDefinitionsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/JobDefinitionsClient.Delete") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: dataManagerName, + Constraints: []validation.Constraint{{Target: "dataManagerName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "dataManagerName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "dataManagerName", Name: validation.Pattern, Rule: `^[-\w\.]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("hybriddata.JobDefinitionsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, dataServiceName, jobDefinitionName, resourceGroupName, dataManagerName) + if err != nil { + err = autorest.NewErrorWithError(err, "hybriddata.JobDefinitionsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "hybriddata.JobDefinitionsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client JobDefinitionsClient) DeletePreparer(ctx context.Context, dataServiceName string, jobDefinitionName string, resourceGroupName string, dataManagerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "dataManagerName": autorest.Encode("path", dataManagerName), + "dataServiceName": autorest.Encode("path", dataServiceName), + "jobDefinitionName": autorest.Encode("path", jobDefinitionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridData/dataManagers/{dataManagerName}/dataServices/{dataServiceName}/jobDefinitions/{jobDefinitionName}", 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 JobDefinitionsClient) DeleteSender(req *http.Request) (future JobDefinitionsDeleteFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client JobDefinitionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get this method gets job definition object by name. +// Parameters: +// dataServiceName - the data service name of the job definition +// jobDefinitionName - the job definition name that is being queried. +// resourceGroupName - the Resource Group Name +// dataManagerName - the name of the DataManager Resource within the specified resource group. DataManager +// names must be between 3 and 24 characters in length and use any alphanumeric and underscore only +func (client JobDefinitionsClient) Get(ctx context.Context, dataServiceName string, jobDefinitionName string, resourceGroupName string, dataManagerName string) (result JobDefinition, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/JobDefinitionsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: dataManagerName, + Constraints: []validation.Constraint{{Target: "dataManagerName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "dataManagerName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "dataManagerName", Name: validation.Pattern, Rule: `^[-\w\.]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("hybriddata.JobDefinitionsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, dataServiceName, jobDefinitionName, resourceGroupName, dataManagerName) + if err != nil { + err = autorest.NewErrorWithError(err, "hybriddata.JobDefinitionsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "hybriddata.JobDefinitionsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hybriddata.JobDefinitionsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client JobDefinitionsClient) GetPreparer(ctx context.Context, dataServiceName string, jobDefinitionName string, resourceGroupName string, dataManagerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "dataManagerName": autorest.Encode("path", dataManagerName), + "dataServiceName": autorest.Encode("path", dataServiceName), + "jobDefinitionName": autorest.Encode("path", jobDefinitionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridData/dataManagers/{dataManagerName}/dataServices/{dataServiceName}/jobDefinitions/{jobDefinitionName}", 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 JobDefinitionsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client JobDefinitionsClient) GetResponder(resp *http.Response) (result JobDefinition, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByDataManager this method gets all the job definitions of the given data manager resource. +// Parameters: +// resourceGroupName - the Resource Group Name +// dataManagerName - the name of the DataManager Resource within the specified resource group. DataManager +// names must be between 3 and 24 characters in length and use any alphanumeric and underscore only +// filter - oData Filter options +func (client JobDefinitionsClient) ListByDataManager(ctx context.Context, resourceGroupName string, dataManagerName string, filter string) (result JobDefinitionListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/JobDefinitionsClient.ListByDataManager") + defer func() { + sc := -1 + if result.jdl.Response.Response != nil { + sc = result.jdl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: dataManagerName, + Constraints: []validation.Constraint{{Target: "dataManagerName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "dataManagerName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "dataManagerName", Name: validation.Pattern, Rule: `^[-\w\.]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("hybriddata.JobDefinitionsClient", "ListByDataManager", err.Error()) + } + + result.fn = client.listByDataManagerNextResults + req, err := client.ListByDataManagerPreparer(ctx, resourceGroupName, dataManagerName, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "hybriddata.JobDefinitionsClient", "ListByDataManager", nil, "Failure preparing request") + return + } + + resp, err := client.ListByDataManagerSender(req) + if err != nil { + result.jdl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "hybriddata.JobDefinitionsClient", "ListByDataManager", resp, "Failure sending request") + return + } + + result.jdl, err = client.ListByDataManagerResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hybriddata.JobDefinitionsClient", "ListByDataManager", resp, "Failure responding to request") + } + + return +} + +// ListByDataManagerPreparer prepares the ListByDataManager request. +func (client JobDefinitionsClient) ListByDataManagerPreparer(ctx context.Context, resourceGroupName string, dataManagerName string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "dataManagerName": autorest.Encode("path", dataManagerName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridData/dataManagers/{dataManagerName}/jobDefinitions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByDataManagerSender sends the ListByDataManager request. The method will close the +// http.Response Body if it receives an error. +func (client JobDefinitionsClient) ListByDataManagerSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListByDataManagerResponder handles the response to the ListByDataManager request. The method always +// closes the http.Response Body. +func (client JobDefinitionsClient) ListByDataManagerResponder(resp *http.Response) (result JobDefinitionList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByDataManagerNextResults retrieves the next set of results, if any. +func (client JobDefinitionsClient) listByDataManagerNextResults(ctx context.Context, lastResults JobDefinitionList) (result JobDefinitionList, err error) { + req, err := lastResults.jobDefinitionListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "hybriddata.JobDefinitionsClient", "listByDataManagerNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByDataManagerSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "hybriddata.JobDefinitionsClient", "listByDataManagerNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByDataManagerResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hybriddata.JobDefinitionsClient", "listByDataManagerNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByDataManagerComplete enumerates all values, automatically crossing page boundaries as required. +func (client JobDefinitionsClient) ListByDataManagerComplete(ctx context.Context, resourceGroupName string, dataManagerName string, filter string) (result JobDefinitionListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/JobDefinitionsClient.ListByDataManager") + 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.ListByDataManager(ctx, resourceGroupName, dataManagerName, filter) + return +} + +// ListByDataService this method gets all the job definitions of the given data service name. +// Parameters: +// dataServiceName - the data service type of interest. +// resourceGroupName - the Resource Group Name +// dataManagerName - the name of the DataManager Resource within the specified resource group. DataManager +// names must be between 3 and 24 characters in length and use any alphanumeric and underscore only +// filter - oData Filter options +func (client JobDefinitionsClient) ListByDataService(ctx context.Context, dataServiceName string, resourceGroupName string, dataManagerName string, filter string) (result JobDefinitionListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/JobDefinitionsClient.ListByDataService") + defer func() { + sc := -1 + if result.jdl.Response.Response != nil { + sc = result.jdl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: dataManagerName, + Constraints: []validation.Constraint{{Target: "dataManagerName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "dataManagerName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "dataManagerName", Name: validation.Pattern, Rule: `^[-\w\.]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("hybriddata.JobDefinitionsClient", "ListByDataService", err.Error()) + } + + result.fn = client.listByDataServiceNextResults + req, err := client.ListByDataServicePreparer(ctx, dataServiceName, resourceGroupName, dataManagerName, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "hybriddata.JobDefinitionsClient", "ListByDataService", nil, "Failure preparing request") + return + } + + resp, err := client.ListByDataServiceSender(req) + if err != nil { + result.jdl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "hybriddata.JobDefinitionsClient", "ListByDataService", resp, "Failure sending request") + return + } + + result.jdl, err = client.ListByDataServiceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hybriddata.JobDefinitionsClient", "ListByDataService", resp, "Failure responding to request") + } + + return +} + +// ListByDataServicePreparer prepares the ListByDataService request. +func (client JobDefinitionsClient) ListByDataServicePreparer(ctx context.Context, dataServiceName string, resourceGroupName string, dataManagerName string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "dataManagerName": autorest.Encode("path", dataManagerName), + "dataServiceName": autorest.Encode("path", dataServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridData/dataManagers/{dataManagerName}/dataServices/{dataServiceName}/jobDefinitions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByDataServiceSender sends the ListByDataService request. The method will close the +// http.Response Body if it receives an error. +func (client JobDefinitionsClient) ListByDataServiceSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListByDataServiceResponder handles the response to the ListByDataService request. The method always +// closes the http.Response Body. +func (client JobDefinitionsClient) ListByDataServiceResponder(resp *http.Response) (result JobDefinitionList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByDataServiceNextResults retrieves the next set of results, if any. +func (client JobDefinitionsClient) listByDataServiceNextResults(ctx context.Context, lastResults JobDefinitionList) (result JobDefinitionList, err error) { + req, err := lastResults.jobDefinitionListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "hybriddata.JobDefinitionsClient", "listByDataServiceNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByDataServiceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "hybriddata.JobDefinitionsClient", "listByDataServiceNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByDataServiceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hybriddata.JobDefinitionsClient", "listByDataServiceNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByDataServiceComplete enumerates all values, automatically crossing page boundaries as required. +func (client JobDefinitionsClient) ListByDataServiceComplete(ctx context.Context, dataServiceName string, resourceGroupName string, dataManagerName string, filter string) (result JobDefinitionListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/JobDefinitionsClient.ListByDataService") + 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.ListByDataService(ctx, dataServiceName, resourceGroupName, dataManagerName, filter) + return +} + +// Run this method runs a job instance of the given job definition. +// Parameters: +// dataServiceName - the data service type of the job definition. +// jobDefinitionName - name of the job definition. +// runParameters - run time parameters for the job definition. +// resourceGroupName - the Resource Group Name +// dataManagerName - the name of the DataManager Resource within the specified resource group. DataManager +// names must be between 3 and 24 characters in length and use any alphanumeric and underscore only +func (client JobDefinitionsClient) Run(ctx context.Context, dataServiceName string, jobDefinitionName string, runParameters RunParameters, resourceGroupName string, dataManagerName string) (result JobDefinitionsRunFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/JobDefinitionsClient.Run") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: dataManagerName, + Constraints: []validation.Constraint{{Target: "dataManagerName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "dataManagerName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "dataManagerName", Name: validation.Pattern, Rule: `^[-\w\.]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("hybriddata.JobDefinitionsClient", "Run", err.Error()) + } + + req, err := client.RunPreparer(ctx, dataServiceName, jobDefinitionName, runParameters, resourceGroupName, dataManagerName) + if err != nil { + err = autorest.NewErrorWithError(err, "hybriddata.JobDefinitionsClient", "Run", nil, "Failure preparing request") + return + } + + result, err = client.RunSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "hybriddata.JobDefinitionsClient", "Run", result.Response(), "Failure sending request") + return + } + + return +} + +// RunPreparer prepares the Run request. +func (client JobDefinitionsClient) RunPreparer(ctx context.Context, dataServiceName string, jobDefinitionName string, runParameters RunParameters, resourceGroupName string, dataManagerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "dataManagerName": autorest.Encode("path", dataManagerName), + "dataServiceName": autorest.Encode("path", dataServiceName), + "jobDefinitionName": autorest.Encode("path", jobDefinitionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridData/dataManagers/{dataManagerName}/dataServices/{dataServiceName}/jobDefinitions/{jobDefinitionName}/run", pathParameters), + autorest.WithJSON(runParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RunSender sends the Run request. The method will close the +// http.Response Body if it receives an error. +func (client JobDefinitionsClient) RunSender(req *http.Request) (future JobDefinitionsRunFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// RunResponder handles the response to the Run request. The method always +// closes the http.Response Body. +func (client JobDefinitionsClient) RunResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/services/hybriddatamanager/mgmt/2016-06-01/hybriddata/jobs.go b/services/hybriddatamanager/mgmt/2016-06-01/hybriddata/jobs.go new file mode 100644 index 000000000000..c09f11f4f3f3 --- /dev/null +++ b/services/hybriddatamanager/mgmt/2016-06-01/hybriddata/jobs.go @@ -0,0 +1,710 @@ +package hybriddata + +// 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" +) + +// JobsClient is the client for the Jobs methods of the Hybriddata service. +type JobsClient struct { + BaseClient +} + +// NewJobsClient creates an instance of the JobsClient client. +func NewJobsClient(subscriptionID string) JobsClient { + return NewJobsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewJobsClientWithBaseURI creates an instance of the JobsClient client. +func NewJobsClientWithBaseURI(baseURI string, subscriptionID string) JobsClient { + return JobsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Cancel cancels the given job. +// Parameters: +// dataServiceName - the name of the data service of the job definition. +// jobDefinitionName - the name of the job definition of the job. +// jobID - the job id of the job queried. +// resourceGroupName - the Resource Group Name +// dataManagerName - the name of the DataManager Resource within the specified resource group. DataManager +// names must be between 3 and 24 characters in length and use any alphanumeric and underscore only +func (client JobsClient) Cancel(ctx context.Context, dataServiceName string, jobDefinitionName string, jobID string, resourceGroupName string, dataManagerName string) (result JobsCancelFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/JobsClient.Cancel") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: dataManagerName, + Constraints: []validation.Constraint{{Target: "dataManagerName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "dataManagerName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "dataManagerName", Name: validation.Pattern, Rule: `^[-\w\.]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("hybriddata.JobsClient", "Cancel", err.Error()) + } + + req, err := client.CancelPreparer(ctx, dataServiceName, jobDefinitionName, jobID, resourceGroupName, dataManagerName) + if err != nil { + err = autorest.NewErrorWithError(err, "hybriddata.JobsClient", "Cancel", nil, "Failure preparing request") + return + } + + result, err = client.CancelSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "hybriddata.JobsClient", "Cancel", result.Response(), "Failure sending request") + return + } + + return +} + +// CancelPreparer prepares the Cancel request. +func (client JobsClient) CancelPreparer(ctx context.Context, dataServiceName string, jobDefinitionName string, jobID string, resourceGroupName string, dataManagerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "dataManagerName": autorest.Encode("path", dataManagerName), + "dataServiceName": autorest.Encode("path", dataServiceName), + "jobDefinitionName": autorest.Encode("path", jobDefinitionName), + "jobId": autorest.Encode("path", jobID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridData/dataManagers/{dataManagerName}/dataServices/{dataServiceName}/jobDefinitions/{jobDefinitionName}/jobs/{jobId}/cancel", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CancelSender sends the Cancel request. The method will close the +// http.Response Body if it receives an error. +func (client JobsClient) CancelSender(req *http.Request) (future JobsCancelFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// CancelResponder handles the response to the Cancel request. The method always +// closes the http.Response Body. +func (client JobsClient) CancelResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get this method gets a data manager job given the jobId. +// Parameters: +// dataServiceName - the name of the data service of the job definition. +// jobDefinitionName - the name of the job definition of the job. +// jobID - the job id of the job queried. +// resourceGroupName - the Resource Group Name +// dataManagerName - the name of the DataManager Resource within the specified resource group. DataManager +// names must be between 3 and 24 characters in length and use any alphanumeric and underscore only +// expand - $expand is supported on details parameter for job, which provides details on the job stages. +func (client JobsClient) Get(ctx context.Context, dataServiceName string, jobDefinitionName string, jobID string, resourceGroupName string, dataManagerName string, expand string) (result Job, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/JobsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: dataManagerName, + Constraints: []validation.Constraint{{Target: "dataManagerName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "dataManagerName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "dataManagerName", Name: validation.Pattern, Rule: `^[-\w\.]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("hybriddata.JobsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, dataServiceName, jobDefinitionName, jobID, resourceGroupName, dataManagerName, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "hybriddata.JobsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "hybriddata.JobsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hybriddata.JobsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client JobsClient) GetPreparer(ctx context.Context, dataServiceName string, jobDefinitionName string, jobID string, resourceGroupName string, dataManagerName string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "dataManagerName": autorest.Encode("path", dataManagerName), + "dataServiceName": autorest.Encode("path", dataServiceName), + "jobDefinitionName": autorest.Encode("path", jobDefinitionName), + "jobId": autorest.Encode("path", jobID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridData/dataManagers/{dataManagerName}/dataServices/{dataServiceName}/jobDefinitions/{jobDefinitionName}/jobs/{jobId}", 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 JobsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client JobsClient) GetResponder(resp *http.Response) (result Job, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByDataManager this method gets all the jobs at the data manager resource level. +// Parameters: +// resourceGroupName - the Resource Group Name +// dataManagerName - the name of the DataManager Resource within the specified resource group. DataManager +// names must be between 3 and 24 characters in length and use any alphanumeric and underscore only +// filter - oData Filter options +func (client JobsClient) ListByDataManager(ctx context.Context, resourceGroupName string, dataManagerName string, filter string) (result JobListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/JobsClient.ListByDataManager") + defer func() { + sc := -1 + if result.jl.Response.Response != nil { + sc = result.jl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: dataManagerName, + Constraints: []validation.Constraint{{Target: "dataManagerName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "dataManagerName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "dataManagerName", Name: validation.Pattern, Rule: `^[-\w\.]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("hybriddata.JobsClient", "ListByDataManager", err.Error()) + } + + result.fn = client.listByDataManagerNextResults + req, err := client.ListByDataManagerPreparer(ctx, resourceGroupName, dataManagerName, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "hybriddata.JobsClient", "ListByDataManager", nil, "Failure preparing request") + return + } + + resp, err := client.ListByDataManagerSender(req) + if err != nil { + result.jl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "hybriddata.JobsClient", "ListByDataManager", resp, "Failure sending request") + return + } + + result.jl, err = client.ListByDataManagerResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hybriddata.JobsClient", "ListByDataManager", resp, "Failure responding to request") + } + + return +} + +// ListByDataManagerPreparer prepares the ListByDataManager request. +func (client JobsClient) ListByDataManagerPreparer(ctx context.Context, resourceGroupName string, dataManagerName string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "dataManagerName": autorest.Encode("path", dataManagerName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridData/dataManagers/{dataManagerName}/jobs", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByDataManagerSender sends the ListByDataManager request. The method will close the +// http.Response Body if it receives an error. +func (client JobsClient) ListByDataManagerSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListByDataManagerResponder handles the response to the ListByDataManager request. The method always +// closes the http.Response Body. +func (client JobsClient) ListByDataManagerResponder(resp *http.Response) (result JobList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByDataManagerNextResults retrieves the next set of results, if any. +func (client JobsClient) listByDataManagerNextResults(ctx context.Context, lastResults JobList) (result JobList, err error) { + req, err := lastResults.jobListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "hybriddata.JobsClient", "listByDataManagerNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByDataManagerSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "hybriddata.JobsClient", "listByDataManagerNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByDataManagerResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hybriddata.JobsClient", "listByDataManagerNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByDataManagerComplete enumerates all values, automatically crossing page boundaries as required. +func (client JobsClient) ListByDataManagerComplete(ctx context.Context, resourceGroupName string, dataManagerName string, filter string) (result JobListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/JobsClient.ListByDataManager") + 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.ListByDataManager(ctx, resourceGroupName, dataManagerName, filter) + return +} + +// ListByDataService this method gets all the jobs of a data service type in a given resource. +// Parameters: +// dataServiceName - the name of the data service of interest. +// resourceGroupName - the Resource Group Name +// dataManagerName - the name of the DataManager Resource within the specified resource group. DataManager +// names must be between 3 and 24 characters in length and use any alphanumeric and underscore only +// filter - oData Filter options +func (client JobsClient) ListByDataService(ctx context.Context, dataServiceName string, resourceGroupName string, dataManagerName string, filter string) (result JobListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/JobsClient.ListByDataService") + defer func() { + sc := -1 + if result.jl.Response.Response != nil { + sc = result.jl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: dataManagerName, + Constraints: []validation.Constraint{{Target: "dataManagerName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "dataManagerName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "dataManagerName", Name: validation.Pattern, Rule: `^[-\w\.]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("hybriddata.JobsClient", "ListByDataService", err.Error()) + } + + result.fn = client.listByDataServiceNextResults + req, err := client.ListByDataServicePreparer(ctx, dataServiceName, resourceGroupName, dataManagerName, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "hybriddata.JobsClient", "ListByDataService", nil, "Failure preparing request") + return + } + + resp, err := client.ListByDataServiceSender(req) + if err != nil { + result.jl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "hybriddata.JobsClient", "ListByDataService", resp, "Failure sending request") + return + } + + result.jl, err = client.ListByDataServiceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hybriddata.JobsClient", "ListByDataService", resp, "Failure responding to request") + } + + return +} + +// ListByDataServicePreparer prepares the ListByDataService request. +func (client JobsClient) ListByDataServicePreparer(ctx context.Context, dataServiceName string, resourceGroupName string, dataManagerName string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "dataManagerName": autorest.Encode("path", dataManagerName), + "dataServiceName": autorest.Encode("path", dataServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridData/dataManagers/{dataManagerName}/dataServices/{dataServiceName}/jobs", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByDataServiceSender sends the ListByDataService request. The method will close the +// http.Response Body if it receives an error. +func (client JobsClient) ListByDataServiceSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListByDataServiceResponder handles the response to the ListByDataService request. The method always +// closes the http.Response Body. +func (client JobsClient) ListByDataServiceResponder(resp *http.Response) (result JobList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByDataServiceNextResults retrieves the next set of results, if any. +func (client JobsClient) listByDataServiceNextResults(ctx context.Context, lastResults JobList) (result JobList, err error) { + req, err := lastResults.jobListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "hybriddata.JobsClient", "listByDataServiceNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByDataServiceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "hybriddata.JobsClient", "listByDataServiceNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByDataServiceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hybriddata.JobsClient", "listByDataServiceNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByDataServiceComplete enumerates all values, automatically crossing page boundaries as required. +func (client JobsClient) ListByDataServiceComplete(ctx context.Context, dataServiceName string, resourceGroupName string, dataManagerName string, filter string) (result JobListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/JobsClient.ListByDataService") + 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.ListByDataService(ctx, dataServiceName, resourceGroupName, dataManagerName, filter) + return +} + +// ListByJobDefinition this method gets all the jobs of a given job definition. +// Parameters: +// dataServiceName - the name of the data service of the job definition. +// jobDefinitionName - the name of the job definition for which jobs are needed. +// resourceGroupName - the Resource Group Name +// dataManagerName - the name of the DataManager Resource within the specified resource group. DataManager +// names must be between 3 and 24 characters in length and use any alphanumeric and underscore only +// filter - oData Filter options +func (client JobsClient) ListByJobDefinition(ctx context.Context, dataServiceName string, jobDefinitionName string, resourceGroupName string, dataManagerName string, filter string) (result JobListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/JobsClient.ListByJobDefinition") + defer func() { + sc := -1 + if result.jl.Response.Response != nil { + sc = result.jl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: dataManagerName, + Constraints: []validation.Constraint{{Target: "dataManagerName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "dataManagerName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "dataManagerName", Name: validation.Pattern, Rule: `^[-\w\.]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("hybriddata.JobsClient", "ListByJobDefinition", err.Error()) + } + + result.fn = client.listByJobDefinitionNextResults + req, err := client.ListByJobDefinitionPreparer(ctx, dataServiceName, jobDefinitionName, resourceGroupName, dataManagerName, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "hybriddata.JobsClient", "ListByJobDefinition", nil, "Failure preparing request") + return + } + + resp, err := client.ListByJobDefinitionSender(req) + if err != nil { + result.jl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "hybriddata.JobsClient", "ListByJobDefinition", resp, "Failure sending request") + return + } + + result.jl, err = client.ListByJobDefinitionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hybriddata.JobsClient", "ListByJobDefinition", resp, "Failure responding to request") + } + + return +} + +// ListByJobDefinitionPreparer prepares the ListByJobDefinition request. +func (client JobsClient) ListByJobDefinitionPreparer(ctx context.Context, dataServiceName string, jobDefinitionName string, resourceGroupName string, dataManagerName string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "dataManagerName": autorest.Encode("path", dataManagerName), + "dataServiceName": autorest.Encode("path", dataServiceName), + "jobDefinitionName": autorest.Encode("path", jobDefinitionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridData/dataManagers/{dataManagerName}/dataServices/{dataServiceName}/jobDefinitions/{jobDefinitionName}/jobs", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByJobDefinitionSender sends the ListByJobDefinition request. The method will close the +// http.Response Body if it receives an error. +func (client JobsClient) ListByJobDefinitionSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListByJobDefinitionResponder handles the response to the ListByJobDefinition request. The method always +// closes the http.Response Body. +func (client JobsClient) ListByJobDefinitionResponder(resp *http.Response) (result JobList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByJobDefinitionNextResults retrieves the next set of results, if any. +func (client JobsClient) listByJobDefinitionNextResults(ctx context.Context, lastResults JobList) (result JobList, err error) { + req, err := lastResults.jobListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "hybriddata.JobsClient", "listByJobDefinitionNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByJobDefinitionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "hybriddata.JobsClient", "listByJobDefinitionNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByJobDefinitionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hybriddata.JobsClient", "listByJobDefinitionNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByJobDefinitionComplete enumerates all values, automatically crossing page boundaries as required. +func (client JobsClient) ListByJobDefinitionComplete(ctx context.Context, dataServiceName string, jobDefinitionName string, resourceGroupName string, dataManagerName string, filter string) (result JobListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/JobsClient.ListByJobDefinition") + 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.ListByJobDefinition(ctx, dataServiceName, jobDefinitionName, resourceGroupName, dataManagerName, filter) + return +} + +// Resume resumes the given job. +// Parameters: +// dataServiceName - the name of the data service of the job definition. +// jobDefinitionName - the name of the job definition of the job. +// jobID - the job id of the job queried. +// resourceGroupName - the Resource Group Name +// dataManagerName - the name of the DataManager Resource within the specified resource group. DataManager +// names must be between 3 and 24 characters in length and use any alphanumeric and underscore only +func (client JobsClient) Resume(ctx context.Context, dataServiceName string, jobDefinitionName string, jobID string, resourceGroupName string, dataManagerName string) (result JobsResumeFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/JobsClient.Resume") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: dataManagerName, + Constraints: []validation.Constraint{{Target: "dataManagerName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "dataManagerName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "dataManagerName", Name: validation.Pattern, Rule: `^[-\w\.]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("hybriddata.JobsClient", "Resume", err.Error()) + } + + req, err := client.ResumePreparer(ctx, dataServiceName, jobDefinitionName, jobID, resourceGroupName, dataManagerName) + if err != nil { + err = autorest.NewErrorWithError(err, "hybriddata.JobsClient", "Resume", nil, "Failure preparing request") + return + } + + result, err = client.ResumeSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "hybriddata.JobsClient", "Resume", result.Response(), "Failure sending request") + return + } + + return +} + +// ResumePreparer prepares the Resume request. +func (client JobsClient) ResumePreparer(ctx context.Context, dataServiceName string, jobDefinitionName string, jobID string, resourceGroupName string, dataManagerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "dataManagerName": autorest.Encode("path", dataManagerName), + "dataServiceName": autorest.Encode("path", dataServiceName), + "jobDefinitionName": autorest.Encode("path", jobDefinitionName), + "jobId": autorest.Encode("path", jobID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridData/dataManagers/{dataManagerName}/dataServices/{dataServiceName}/jobDefinitions/{jobDefinitionName}/jobs/{jobId}/resume", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ResumeSender sends the Resume request. The method will close the +// http.Response Body if it receives an error. +func (client JobsClient) ResumeSender(req *http.Request) (future JobsResumeFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// ResumeResponder handles the response to the Resume request. The method always +// closes the http.Response Body. +func (client JobsClient) ResumeResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/services/hybriddatamanager/mgmt/2016-06-01/hybriddata/models.go b/services/hybriddatamanager/mgmt/2016-06-01/hybriddata/models.go new file mode 100644 index 000000000000..f9ea544928cd --- /dev/null +++ b/services/hybriddatamanager/mgmt/2016-06-01/hybriddata/models.go @@ -0,0 +1,2385 @@ +package hybriddata + +// 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/date" + "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/hybriddatamanager/mgmt/2016-06-01/hybriddata" + +// IsJobCancellable enumerates the values for is job cancellable. +type IsJobCancellable string + +const ( + // Cancellable ... + Cancellable IsJobCancellable = "Cancellable" + // NotCancellable ... + NotCancellable IsJobCancellable = "NotCancellable" +) + +// PossibleIsJobCancellableValues returns an array of possible values for the IsJobCancellable const type. +func PossibleIsJobCancellableValues() []IsJobCancellable { + return []IsJobCancellable{Cancellable, NotCancellable} +} + +// JobStatus enumerates the values for job status. +type JobStatus string + +const ( + // Cancelled ... + Cancelled JobStatus = "Cancelled" + // Cancelling ... + Cancelling JobStatus = "Cancelling" + // Failed ... + Failed JobStatus = "Failed" + // InProgress ... + InProgress JobStatus = "InProgress" + // None ... + None JobStatus = "None" + // Succeeded ... + Succeeded JobStatus = "Succeeded" + // WaitingForAction ... + WaitingForAction JobStatus = "WaitingForAction" +) + +// PossibleJobStatusValues returns an array of possible values for the JobStatus const type. +func PossibleJobStatusValues() []JobStatus { + return []JobStatus{Cancelled, Cancelling, Failed, InProgress, None, Succeeded, WaitingForAction} +} + +// RunLocation enumerates the values for run location. +type RunLocation string + +const ( + // RunLocationAustraliaeast ... + RunLocationAustraliaeast RunLocation = "australiaeast" + // RunLocationAustraliasoutheast ... + RunLocationAustraliasoutheast RunLocation = "australiasoutheast" + // RunLocationBrazilsouth ... + RunLocationBrazilsouth RunLocation = "brazilsouth" + // RunLocationCanadacentral ... + RunLocationCanadacentral RunLocation = "canadacentral" + // RunLocationCanadaeast ... + RunLocationCanadaeast RunLocation = "canadaeast" + // RunLocationCentralindia ... + RunLocationCentralindia RunLocation = "centralindia" + // RunLocationCentralus ... + RunLocationCentralus RunLocation = "centralus" + // RunLocationEastasia ... + RunLocationEastasia RunLocation = "eastasia" + // RunLocationEastus ... + RunLocationEastus RunLocation = "eastus" + // RunLocationEastus2 ... + RunLocationEastus2 RunLocation = "eastus2" + // RunLocationJapaneast ... + RunLocationJapaneast RunLocation = "japaneast" + // RunLocationJapanwest ... + RunLocationJapanwest RunLocation = "japanwest" + // RunLocationKoreacentral ... + RunLocationKoreacentral RunLocation = "koreacentral" + // RunLocationKoreasouth ... + RunLocationKoreasouth RunLocation = "koreasouth" + // RunLocationNone ... + RunLocationNone RunLocation = "none" + // RunLocationNorthcentralus ... + RunLocationNorthcentralus RunLocation = "northcentralus" + // RunLocationNortheurope ... + RunLocationNortheurope RunLocation = "northeurope" + // RunLocationSouthcentralus ... + RunLocationSouthcentralus RunLocation = "southcentralus" + // RunLocationSoutheastasia ... + RunLocationSoutheastasia RunLocation = "southeastasia" + // RunLocationSouthindia ... + RunLocationSouthindia RunLocation = "southindia" + // RunLocationUksouth ... + RunLocationUksouth RunLocation = "uksouth" + // RunLocationUkwest ... + RunLocationUkwest RunLocation = "ukwest" + // RunLocationWestcentralus ... + RunLocationWestcentralus RunLocation = "westcentralus" + // RunLocationWesteurope ... + RunLocationWesteurope RunLocation = "westeurope" + // RunLocationWestindia ... + RunLocationWestindia RunLocation = "westindia" + // RunLocationWestus ... + RunLocationWestus RunLocation = "westus" + // RunLocationWestus2 ... + RunLocationWestus2 RunLocation = "westus2" +) + +// PossibleRunLocationValues returns an array of possible values for the RunLocation const type. +func PossibleRunLocationValues() []RunLocation { + return []RunLocation{RunLocationAustraliaeast, RunLocationAustraliasoutheast, RunLocationBrazilsouth, RunLocationCanadacentral, RunLocationCanadaeast, RunLocationCentralindia, RunLocationCentralus, RunLocationEastasia, RunLocationEastus, RunLocationEastus2, RunLocationJapaneast, RunLocationJapanwest, RunLocationKoreacentral, RunLocationKoreasouth, RunLocationNone, RunLocationNorthcentralus, RunLocationNortheurope, RunLocationSouthcentralus, RunLocationSoutheastasia, RunLocationSouthindia, RunLocationUksouth, RunLocationUkwest, RunLocationWestcentralus, RunLocationWesteurope, RunLocationWestindia, RunLocationWestus, RunLocationWestus2} +} + +// State enumerates the values for state. +type State string + +const ( + // Disabled ... + Disabled State = "Disabled" + // Enabled ... + Enabled State = "Enabled" + // Supported ... + Supported State = "Supported" +) + +// PossibleStateValues returns an array of possible values for the State const type. +func PossibleStateValues() []State { + return []State{Disabled, Enabled, Supported} +} + +// SupportedAlgorithm enumerates the values for supported algorithm. +type SupportedAlgorithm string + +const ( + // SupportedAlgorithmNone ... + SupportedAlgorithmNone SupportedAlgorithm = "None" + // SupportedAlgorithmPlainText ... + SupportedAlgorithmPlainText SupportedAlgorithm = "PlainText" + // SupportedAlgorithmRSA15 ... + SupportedAlgorithmRSA15 SupportedAlgorithm = "RSA1_5" + // SupportedAlgorithmRSAOAEP ... + SupportedAlgorithmRSAOAEP SupportedAlgorithm = "RSA_OAEP" +) + +// PossibleSupportedAlgorithmValues returns an array of possible values for the SupportedAlgorithm const type. +func PossibleSupportedAlgorithmValues() []SupportedAlgorithm { + return []SupportedAlgorithm{SupportedAlgorithmNone, SupportedAlgorithmPlainText, SupportedAlgorithmRSA15, SupportedAlgorithmRSAOAEP} +} + +// UserConfirmation enumerates the values for user confirmation. +type UserConfirmation string + +const ( + // NotRequired ... + NotRequired UserConfirmation = "NotRequired" + // Required ... + Required UserConfirmation = "Required" +) + +// PossibleUserConfirmationValues returns an array of possible values for the UserConfirmation const type. +func PossibleUserConfirmationValues() []UserConfirmation { + return []UserConfirmation{NotRequired, Required} +} + +// AvailableProviderOperation class represents provider operation +type AvailableProviderOperation struct { + // Name - Gets or Sets Name of the operations + Name *string `json:"name,omitempty"` + // Display - Gets or sets Display information + // Contains the localized display information for this particular operation/action + Display *AvailableProviderOperationDisplay `json:"display,omitempty"` + // Origin - Gets or sets 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 - Gets or sets Properties + // Reserved for future use + Properties interface{} `json:"properties,omitempty"` +} + +// AvailableProviderOperationDisplay 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 AvailableProviderOperationDisplay struct { + // Provider - Gets or sets 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. + Provider *string `json:"provider,omitempty"` + // Resource - Gets or sets Resource + // The localized friendly form of the resource type related to this action/operation – it should match the public documentation for the resource provider. + // It should use Title Casing – for examples, please refer to the “name” section. + Resource *string `json:"resource,omitempty"` + // Operation - Gets or sets 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 and include the entity/resource to which it applies. + Operation *string `json:"operation,omitempty"` + // Description - Gets or sets 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. + Description *string `json:"description,omitempty"` +} + +// AvailableProviderOperations class for set of operations used for discovery of available provider +// operations. +type AvailableProviderOperations struct { + autorest.Response `json:"-"` + // Value - List of operations. + Value *[]AvailableProviderOperation `json:"value,omitempty"` + // NextLink - Link for the next set of operations. + NextLink *string `json:"nextLink,omitempty"` +} + +// AvailableProviderOperationsIterator provides access to a complete listing of AvailableProviderOperation +// values. +type AvailableProviderOperationsIterator struct { + i int + page AvailableProviderOperationsPage +} + +// 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 *AvailableProviderOperationsIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AvailableProviderOperationsIterator.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 *AvailableProviderOperationsIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter AvailableProviderOperationsIterator) 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 AvailableProviderOperationsIterator) Response() AvailableProviderOperations { + 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 AvailableProviderOperationsIterator) Value() AvailableProviderOperation { + if !iter.page.NotDone() { + return AvailableProviderOperation{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the AvailableProviderOperationsIterator type. +func NewAvailableProviderOperationsIterator(page AvailableProviderOperationsPage) AvailableProviderOperationsIterator { + return AvailableProviderOperationsIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (apo AvailableProviderOperations) IsEmpty() bool { + return apo.Value == nil || len(*apo.Value) == 0 +} + +// availableProviderOperationsPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (apo AvailableProviderOperations) availableProviderOperationsPreparer(ctx context.Context) (*http.Request, error) { + if apo.NextLink == nil || len(to.String(apo.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(apo.NextLink))) +} + +// AvailableProviderOperationsPage contains a page of AvailableProviderOperation values. +type AvailableProviderOperationsPage struct { + fn func(context.Context, AvailableProviderOperations) (AvailableProviderOperations, error) + apo AvailableProviderOperations +} + +// 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 *AvailableProviderOperationsPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AvailableProviderOperationsPage.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.apo) + if err != nil { + return err + } + page.apo = 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 *AvailableProviderOperationsPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page AvailableProviderOperationsPage) NotDone() bool { + return !page.apo.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page AvailableProviderOperationsPage) Response() AvailableProviderOperations { + return page.apo +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page AvailableProviderOperationsPage) Values() []AvailableProviderOperation { + if page.apo.IsEmpty() { + return nil + } + return *page.apo.Value +} + +// Creates a new instance of the AvailableProviderOperationsPage type. +func NewAvailableProviderOperationsPage(getNextPage func(context.Context, AvailableProviderOperations) (AvailableProviderOperations, error)) AvailableProviderOperationsPage { + return AvailableProviderOperationsPage{fn: getNextPage} +} + +// CustomerSecret the pair of customer secret. +type CustomerSecret struct { + // KeyIdentifier - The identifier to the data service input object which this secret corresponds to. + KeyIdentifier *string `json:"keyIdentifier,omitempty"` + // KeyValue - It contains the encrypted customer secret. + KeyValue *string `json:"keyValue,omitempty"` + // Algorithm - The encryption algorithm used to encrypt data. Possible values include: 'SupportedAlgorithmNone', 'SupportedAlgorithmRSA15', 'SupportedAlgorithmRSAOAEP', 'SupportedAlgorithmPlainText' + Algorithm SupportedAlgorithm `json:"algorithm,omitempty"` +} + +// DataManager the DataManager resource. +type DataManager struct { + autorest.Response `json:"-"` + // Etag - Etag of the Resource. + Etag *string `json:"etag,omitempty"` + // ID - The Resource Id. + ID *string `json:"id,omitempty"` + // Name - The Resource Name. + Name *string `json:"name,omitempty"` + // Type - The Resource type. + Type *string `json:"type,omitempty"` + // Location - The location of the resource. This will be one of the supported and registered Azure Geo Regions (e.g. West US, East + // US, Southeast Asia, etc.). The geo region of a resource cannot be changed once it is created, but if an identical geo + // region is specified on update the request will succeed. + Location *string `json:"location,omitempty"` + // Tags - The list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource + // (across resource groups). + Tags map[string]*string `json:"tags"` + // Sku - The sku type. + Sku *Sku `json:"sku,omitempty"` +} + +// MarshalJSON is the custom marshaler for DataManager. +func (dm DataManager) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dm.Etag != nil { + objectMap["etag"] = dm.Etag + } + if dm.ID != nil { + objectMap["id"] = dm.ID + } + if dm.Name != nil { + objectMap["name"] = dm.Name + } + if dm.Type != nil { + objectMap["type"] = dm.Type + } + if dm.Location != nil { + objectMap["location"] = dm.Location + } + if dm.Tags != nil { + objectMap["tags"] = dm.Tags + } + if dm.Sku != nil { + objectMap["sku"] = dm.Sku + } + return json.Marshal(objectMap) +} + +// DataManagerList dataManager resources Collection. +type DataManagerList struct { + autorest.Response `json:"-"` + // Value - List of data manager resources. + Value *[]DataManager `json:"value,omitempty"` + // NextLink - Link for the next set of data stores. + NextLink *string `json:"nextLink,omitempty"` +} + +// DataManagersCreateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type DataManagersCreateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *DataManagersCreateFuture) Result(client DataManagersClient) (dm DataManager, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "hybriddata.DataManagersCreateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("hybriddata.DataManagersCreateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if dm.Response.Response, err = future.GetResult(sender); err == nil && dm.Response.Response.StatusCode != http.StatusNoContent { + dm, err = client.CreateResponder(dm.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "hybriddata.DataManagersCreateFuture", "Result", dm.Response.Response, "Failure responding to request") + } + } + return +} + +// DataManagersDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type DataManagersDeleteFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *DataManagersDeleteFuture) Result(client DataManagersClient) (ar autorest.Response, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "hybriddata.DataManagersDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("hybriddata.DataManagersDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// DataManagersUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type DataManagersUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *DataManagersUpdateFuture) Result(client DataManagersClient) (dm DataManager, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "hybriddata.DataManagersUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("hybriddata.DataManagersUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if dm.Response.Response, err = future.GetResult(sender); err == nil && dm.Response.Response.StatusCode != http.StatusNoContent { + dm, err = client.UpdateResponder(dm.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "hybriddata.DataManagersUpdateFuture", "Result", dm.Response.Response, "Failure responding to request") + } + } + return +} + +// DataManagerUpdateParameter the DataManagerUpdateParameter. +type DataManagerUpdateParameter struct { + // Sku - The sku type. + Sku *Sku `json:"sku,omitempty"` + // Tags - The list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource + // (across resource groups). + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for DataManagerUpdateParameter. +func (dmup DataManagerUpdateParameter) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dmup.Sku != nil { + objectMap["sku"] = dmup.Sku + } + if dmup.Tags != nil { + objectMap["tags"] = dmup.Tags + } + return json.Marshal(objectMap) +} + +// DataService data Service. +type DataService struct { + autorest.Response `json:"-"` + // DataServiceProperties - DataService properties. + *DataServiceProperties `json:"properties,omitempty"` + // Name - Name of the object. + Name *string `json:"name,omitempty"` + // ID - Id of the object. + ID *string `json:"id,omitempty"` + // Type - Type of the object. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for DataService. +func (ds DataService) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ds.DataServiceProperties != nil { + objectMap["properties"] = ds.DataServiceProperties + } + if ds.Name != nil { + objectMap["name"] = ds.Name + } + if ds.ID != nil { + objectMap["id"] = ds.ID + } + if ds.Type != nil { + objectMap["type"] = ds.Type + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for DataService struct. +func (ds *DataService) 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 dataServiceProperties DataServiceProperties + err = json.Unmarshal(*v, &dataServiceProperties) + if err != nil { + return err + } + ds.DataServiceProperties = &dataServiceProperties + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ds.Name = &name + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ds.ID = &ID + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ds.Type = &typeVar + } + } + } + + return nil +} + +// DataServiceList data Service Collection. +type DataServiceList struct { + autorest.Response `json:"-"` + // Value - List of data services. + Value *[]DataService `json:"value,omitempty"` + // NextLink - Link for the next set of data services. + NextLink *string `json:"nextLink,omitempty"` +} + +// DataServiceListIterator provides access to a complete listing of DataService values. +type DataServiceListIterator struct { + i int + page DataServiceListPage +} + +// 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 *DataServiceListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataServiceListIterator.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 *DataServiceListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter DataServiceListIterator) 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 DataServiceListIterator) Response() DataServiceList { + 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 DataServiceListIterator) Value() DataService { + if !iter.page.NotDone() { + return DataService{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the DataServiceListIterator type. +func NewDataServiceListIterator(page DataServiceListPage) DataServiceListIterator { + return DataServiceListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (dsl DataServiceList) IsEmpty() bool { + return dsl.Value == nil || len(*dsl.Value) == 0 +} + +// dataServiceListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (dsl DataServiceList) dataServiceListPreparer(ctx context.Context) (*http.Request, error) { + if dsl.NextLink == nil || len(to.String(dsl.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(dsl.NextLink))) +} + +// DataServiceListPage contains a page of DataService values. +type DataServiceListPage struct { + fn func(context.Context, DataServiceList) (DataServiceList, error) + dsl DataServiceList +} + +// 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 *DataServiceListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataServiceListPage.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.dsl) + if err != nil { + return err + } + page.dsl = 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 *DataServiceListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page DataServiceListPage) NotDone() bool { + return !page.dsl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page DataServiceListPage) Response() DataServiceList { + return page.dsl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page DataServiceListPage) Values() []DataService { + if page.dsl.IsEmpty() { + return nil + } + return *page.dsl.Value +} + +// Creates a new instance of the DataServiceListPage type. +func NewDataServiceListPage(getNextPage func(context.Context, DataServiceList) (DataServiceList, error)) DataServiceListPage { + return DataServiceListPage{fn: getNextPage} +} + +// DataServiceProperties data Service properties. +type DataServiceProperties struct { + // State - State of the data service. Possible values include: 'Disabled', 'Enabled', 'Supported' + State State `json:"state,omitempty"` + // SupportedDataSinkTypes - Supported data store types which can be used as a sink. + SupportedDataSinkTypes *[]string `json:"supportedDataSinkTypes,omitempty"` + // SupportedDataSourceTypes - Supported data store types which can be used as a source. + SupportedDataSourceTypes *[]string `json:"supportedDataSourceTypes,omitempty"` +} + +// DataStore data store. +type DataStore struct { + autorest.Response `json:"-"` + // DataStoreProperties - DataStore properties. + *DataStoreProperties `json:"properties,omitempty"` + // Name - Name of the object. + Name *string `json:"name,omitempty"` + // ID - Id of the object. + ID *string `json:"id,omitempty"` + // Type - Type of the object. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for DataStore. +func (ds DataStore) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ds.DataStoreProperties != nil { + objectMap["properties"] = ds.DataStoreProperties + } + if ds.Name != nil { + objectMap["name"] = ds.Name + } + if ds.ID != nil { + objectMap["id"] = ds.ID + } + if ds.Type != nil { + objectMap["type"] = ds.Type + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for DataStore struct. +func (ds *DataStore) 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 dataStoreProperties DataStoreProperties + err = json.Unmarshal(*v, &dataStoreProperties) + if err != nil { + return err + } + ds.DataStoreProperties = &dataStoreProperties + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ds.Name = &name + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ds.ID = &ID + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ds.Type = &typeVar + } + } + } + + return nil +} + +// DataStoreFilter contains the information about the filters for the DataStore. +type DataStoreFilter struct { + // DataStoreTypeID - The data store type id. + DataStoreTypeID *string `json:"dataStoreTypeId,omitempty"` +} + +// DataStoreList data Store Collection. +type DataStoreList struct { + autorest.Response `json:"-"` + // Value - List of data stores. + Value *[]DataStore `json:"value,omitempty"` + // NextLink - Link for the next set of data stores. + NextLink *string `json:"nextLink,omitempty"` +} + +// DataStoreListIterator provides access to a complete listing of DataStore values. +type DataStoreListIterator struct { + i int + page DataStoreListPage +} + +// 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 *DataStoreListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataStoreListIterator.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 *DataStoreListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter DataStoreListIterator) 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 DataStoreListIterator) Response() DataStoreList { + 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 DataStoreListIterator) Value() DataStore { + if !iter.page.NotDone() { + return DataStore{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the DataStoreListIterator type. +func NewDataStoreListIterator(page DataStoreListPage) DataStoreListIterator { + return DataStoreListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (dsl DataStoreList) IsEmpty() bool { + return dsl.Value == nil || len(*dsl.Value) == 0 +} + +// dataStoreListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (dsl DataStoreList) dataStoreListPreparer(ctx context.Context) (*http.Request, error) { + if dsl.NextLink == nil || len(to.String(dsl.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(dsl.NextLink))) +} + +// DataStoreListPage contains a page of DataStore values. +type DataStoreListPage struct { + fn func(context.Context, DataStoreList) (DataStoreList, error) + dsl DataStoreList +} + +// 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 *DataStoreListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataStoreListPage.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.dsl) + if err != nil { + return err + } + page.dsl = 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 *DataStoreListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page DataStoreListPage) NotDone() bool { + return !page.dsl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page DataStoreListPage) Response() DataStoreList { + return page.dsl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page DataStoreListPage) Values() []DataStore { + if page.dsl.IsEmpty() { + return nil + } + return *page.dsl.Value +} + +// Creates a new instance of the DataStoreListPage type. +func NewDataStoreListPage(getNextPage func(context.Context, DataStoreList) (DataStoreList, error)) DataStoreListPage { + return DataStoreListPage{fn: getNextPage} +} + +// DataStoreProperties data Store for sources and sinks +type DataStoreProperties struct { + // RepositoryID - Arm Id for the manager resource to which the data source is associated. This is optional. + RepositoryID *string `json:"repositoryId,omitempty"` + // State - State of the data source. Possible values include: 'Disabled', 'Enabled', 'Supported' + State State `json:"state,omitempty"` + // ExtendedProperties - A generic json used differently by each data source type. + ExtendedProperties interface{} `json:"extendedProperties,omitempty"` + // DataStoreTypeID - The arm id of the data store type. + DataStoreTypeID *string `json:"dataStoreTypeId,omitempty"` + // CustomerSecrets - List of customer secrets containing a key identifier and key value. The key identifier is a way for the specific data source to understand the key. Value contains customer secret encrypted by the encryptionKeys. + CustomerSecrets *[]CustomerSecret `json:"customerSecrets,omitempty"` +} + +// DataStoresCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type DataStoresCreateOrUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *DataStoresCreateOrUpdateFuture) Result(client DataStoresClient) (ds DataStore, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "hybriddata.DataStoresCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("hybriddata.DataStoresCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ds.Response.Response, err = future.GetResult(sender); err == nil && ds.Response.Response.StatusCode != http.StatusNoContent { + ds, err = client.CreateOrUpdateResponder(ds.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "hybriddata.DataStoresCreateOrUpdateFuture", "Result", ds.Response.Response, "Failure responding to request") + } + } + return +} + +// DataStoresDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type DataStoresDeleteFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *DataStoresDeleteFuture) Result(client DataStoresClient) (ar autorest.Response, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "hybriddata.DataStoresDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("hybriddata.DataStoresDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// DataStoreType data Store Type. +type DataStoreType struct { + autorest.Response `json:"-"` + // DataStoreTypeProperties - DataStoreType properties. + *DataStoreTypeProperties `json:"properties,omitempty"` + // Name - Name of the object. + Name *string `json:"name,omitempty"` + // ID - Id of the object. + ID *string `json:"id,omitempty"` + // Type - Type of the object. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for DataStoreType. +func (dst DataStoreType) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dst.DataStoreTypeProperties != nil { + objectMap["properties"] = dst.DataStoreTypeProperties + } + if dst.Name != nil { + objectMap["name"] = dst.Name + } + if dst.ID != nil { + objectMap["id"] = dst.ID + } + if dst.Type != nil { + objectMap["type"] = dst.Type + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for DataStoreType struct. +func (dst *DataStoreType) 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 dataStoreTypeProperties DataStoreTypeProperties + err = json.Unmarshal(*v, &dataStoreTypeProperties) + if err != nil { + return err + } + dst.DataStoreTypeProperties = &dataStoreTypeProperties + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + dst.Name = &name + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + dst.ID = &ID + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + dst.Type = &typeVar + } + } + } + + return nil +} + +// DataStoreTypeList data Store Type Collection. +type DataStoreTypeList struct { + autorest.Response `json:"-"` + // Value - List of DataStoreType. + Value *[]DataStoreType `json:"value,omitempty"` + // NextLink - Link for the next set of data store types. + NextLink *string `json:"nextLink,omitempty"` +} + +// DataStoreTypeListIterator provides access to a complete listing of DataStoreType values. +type DataStoreTypeListIterator struct { + i int + page DataStoreTypeListPage +} + +// 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 *DataStoreTypeListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataStoreTypeListIterator.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 *DataStoreTypeListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter DataStoreTypeListIterator) 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 DataStoreTypeListIterator) Response() DataStoreTypeList { + 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 DataStoreTypeListIterator) Value() DataStoreType { + if !iter.page.NotDone() { + return DataStoreType{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the DataStoreTypeListIterator type. +func NewDataStoreTypeListIterator(page DataStoreTypeListPage) DataStoreTypeListIterator { + return DataStoreTypeListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (dstl DataStoreTypeList) IsEmpty() bool { + return dstl.Value == nil || len(*dstl.Value) == 0 +} + +// dataStoreTypeListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (dstl DataStoreTypeList) dataStoreTypeListPreparer(ctx context.Context) (*http.Request, error) { + if dstl.NextLink == nil || len(to.String(dstl.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(dstl.NextLink))) +} + +// DataStoreTypeListPage contains a page of DataStoreType values. +type DataStoreTypeListPage struct { + fn func(context.Context, DataStoreTypeList) (DataStoreTypeList, error) + dstl DataStoreTypeList +} + +// 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 *DataStoreTypeListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataStoreTypeListPage.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.dstl) + if err != nil { + return err + } + page.dstl = 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 *DataStoreTypeListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page DataStoreTypeListPage) NotDone() bool { + return !page.dstl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page DataStoreTypeListPage) Response() DataStoreTypeList { + return page.dstl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page DataStoreTypeListPage) Values() []DataStoreType { + if page.dstl.IsEmpty() { + return nil + } + return *page.dstl.Value +} + +// Creates a new instance of the DataStoreTypeListPage type. +func NewDataStoreTypeListPage(getNextPage func(context.Context, DataStoreTypeList) (DataStoreTypeList, error)) DataStoreTypeListPage { + return DataStoreTypeListPage{fn: getNextPage} +} + +// DataStoreTypeProperties data Store Type properties. +type DataStoreTypeProperties struct { + // RepositoryType - Arm type for the manager resource to which the data source type is associated. This is optional. + RepositoryType *string `json:"repositoryType,omitempty"` + // State - State of the data store type. Possible values include: 'Disabled', 'Enabled', 'Supported' + State State `json:"state,omitempty"` + // SupportedDataServicesAsSink - Supported data services where it can be used as a sink. + SupportedDataServicesAsSink *[]string `json:"supportedDataServicesAsSink,omitempty"` + // SupportedDataServicesAsSource - Supported data services where it can be used as a source. + SupportedDataServicesAsSource *[]string `json:"supportedDataServicesAsSource,omitempty"` +} + +// DmsBaseObject base class for all objects under DataManager Service +type DmsBaseObject struct { + // Name - Name of the object. + Name *string `json:"name,omitempty"` + // ID - Id of the object. + ID *string `json:"id,omitempty"` + // Type - Type of the object. + Type *string `json:"type,omitempty"` +} + +// Error top level error for the job. +type Error struct { + // Code - Error code that can be used to programmatically identify the error. + Code *string `json:"code,omitempty"` + // Message - Describes the error in detail and provides debugging information. + Message *string `json:"message,omitempty"` +} + +// ErrorDetails error Details +type ErrorDetails struct { + // ErrorMessage - Error message. + ErrorMessage *string `json:"errorMessage,omitempty"` + // ErrorCode - Error code. + ErrorCode *int32 `json:"errorCode,omitempty"` + // RecommendedAction - Recommended action for the error. + RecommendedAction *string `json:"recommendedAction,omitempty"` + // ExceptionMessage - Contains the non localized exception message + ExceptionMessage *string `json:"exceptionMessage,omitempty"` +} + +// Job data service job. +type Job struct { + autorest.Response `json:"-"` + // Status - Status of the job. Possible values include: 'None', 'InProgress', 'Succeeded', 'WaitingForAction', 'Failed', 'Cancelled', 'Cancelling' + Status JobStatus `json:"status,omitempty"` + // StartTime - Time at which the job was started in UTC ISO 8601 format. + StartTime *date.Time `json:"startTime,omitempty"` + // EndTime - Time at which the job ended in UTC ISO 8601 format. + EndTime *date.Time `json:"endTime,omitempty"` + // JobProperties - Job properties. + *JobProperties `json:"properties,omitempty"` + // Error - Top level error for the job. + Error *Error `json:"error,omitempty"` + // Name - Name of the object. + Name *string `json:"name,omitempty"` + // ID - Id of the object. + ID *string `json:"id,omitempty"` + // Type - Type of the object. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for Job. +func (j Job) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if j.Status != "" { + objectMap["status"] = j.Status + } + if j.StartTime != nil { + objectMap["startTime"] = j.StartTime + } + if j.EndTime != nil { + objectMap["endTime"] = j.EndTime + } + if j.JobProperties != nil { + objectMap["properties"] = j.JobProperties + } + if j.Error != nil { + objectMap["error"] = j.Error + } + if j.Name != nil { + objectMap["name"] = j.Name + } + if j.ID != nil { + objectMap["id"] = j.ID + } + if j.Type != nil { + objectMap["type"] = j.Type + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Job struct. +func (j *Job) 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 "status": + if v != nil { + var status JobStatus + err = json.Unmarshal(*v, &status) + if err != nil { + return err + } + j.Status = status + } + case "startTime": + if v != nil { + var startTime date.Time + err = json.Unmarshal(*v, &startTime) + if err != nil { + return err + } + j.StartTime = &startTime + } + case "endTime": + if v != nil { + var endTime date.Time + err = json.Unmarshal(*v, &endTime) + if err != nil { + return err + } + j.EndTime = &endTime + } + case "properties": + if v != nil { + var jobProperties JobProperties + err = json.Unmarshal(*v, &jobProperties) + if err != nil { + return err + } + j.JobProperties = &jobProperties + } + case "error": + if v != nil { + var errorVar Error + err = json.Unmarshal(*v, &errorVar) + if err != nil { + return err + } + j.Error = &errorVar + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + j.Name = &name + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + j.ID = &ID + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + j.Type = &typeVar + } + } + } + + return nil +} + +// JobDefinition job Definition. +type JobDefinition struct { + autorest.Response `json:"-"` + // JobDefinitionProperties - JobDefinition properties. + *JobDefinitionProperties `json:"properties,omitempty"` + // Name - Name of the object. + Name *string `json:"name,omitempty"` + // ID - Id of the object. + ID *string `json:"id,omitempty"` + // Type - Type of the object. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for JobDefinition. +func (jd JobDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if jd.JobDefinitionProperties != nil { + objectMap["properties"] = jd.JobDefinitionProperties + } + if jd.Name != nil { + objectMap["name"] = jd.Name + } + if jd.ID != nil { + objectMap["id"] = jd.ID + } + if jd.Type != nil { + objectMap["type"] = jd.Type + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for JobDefinition struct. +func (jd *JobDefinition) 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 jobDefinitionProperties JobDefinitionProperties + err = json.Unmarshal(*v, &jobDefinitionProperties) + if err != nil { + return err + } + jd.JobDefinitionProperties = &jobDefinitionProperties + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + jd.Name = &name + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + jd.ID = &ID + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + jd.Type = &typeVar + } + } + } + + return nil +} + +// JobDefinitionFilter contains the supported job definition filters. +type JobDefinitionFilter struct { + // State - The state of the job definition. Possible values include: 'Disabled', 'Enabled', 'Supported' + State State `json:"state,omitempty"` + // DataSource - The data source associated with the job definition + DataSource *string `json:"dataSource,omitempty"` + // LastModified - The last modified date time of the data source. + LastModified *date.Time `json:"lastModified,omitempty"` +} + +// JobDefinitionList job Definition Collection. +type JobDefinitionList struct { + autorest.Response `json:"-"` + // Value - List of job definitions. + Value *[]JobDefinition `json:"value,omitempty"` + // NextLink - Link for the next set of job definitions. + NextLink *string `json:"nextLink,omitempty"` +} + +// JobDefinitionListIterator provides access to a complete listing of JobDefinition values. +type JobDefinitionListIterator struct { + i int + page JobDefinitionListPage +} + +// 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 *JobDefinitionListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/JobDefinitionListIterator.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 *JobDefinitionListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter JobDefinitionListIterator) 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 JobDefinitionListIterator) Response() JobDefinitionList { + 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 JobDefinitionListIterator) Value() JobDefinition { + if !iter.page.NotDone() { + return JobDefinition{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the JobDefinitionListIterator type. +func NewJobDefinitionListIterator(page JobDefinitionListPage) JobDefinitionListIterator { + return JobDefinitionListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (jdl JobDefinitionList) IsEmpty() bool { + return jdl.Value == nil || len(*jdl.Value) == 0 +} + +// jobDefinitionListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (jdl JobDefinitionList) jobDefinitionListPreparer(ctx context.Context) (*http.Request, error) { + if jdl.NextLink == nil || len(to.String(jdl.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(jdl.NextLink))) +} + +// JobDefinitionListPage contains a page of JobDefinition values. +type JobDefinitionListPage struct { + fn func(context.Context, JobDefinitionList) (JobDefinitionList, error) + jdl JobDefinitionList +} + +// 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 *JobDefinitionListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/JobDefinitionListPage.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.jdl) + if err != nil { + return err + } + page.jdl = 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 *JobDefinitionListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page JobDefinitionListPage) NotDone() bool { + return !page.jdl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page JobDefinitionListPage) Response() JobDefinitionList { + return page.jdl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page JobDefinitionListPage) Values() []JobDefinition { + if page.jdl.IsEmpty() { + return nil + } + return *page.jdl.Value +} + +// Creates a new instance of the JobDefinitionListPage type. +func NewJobDefinitionListPage(getNextPage func(context.Context, JobDefinitionList) (JobDefinitionList, error)) JobDefinitionListPage { + return JobDefinitionListPage{fn: getNextPage} +} + +// JobDefinitionProperties job Definition +type JobDefinitionProperties struct { + // DataSourceID - Data Source Id associated to the job definition. + DataSourceID *string `json:"dataSourceId,omitempty"` + // DataSinkID - Data Sink Id associated to the job definition. + DataSinkID *string `json:"dataSinkId,omitempty"` + // Schedules - Schedule for running the job definition + Schedules *[]Schedule `json:"schedules,omitempty"` + // State - State of the job definition. Possible values include: 'Disabled', 'Enabled', 'Supported' + State State `json:"state,omitempty"` + // LastModifiedTime - Last modified time of the job definition. + LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` + // RunLocation - This is the preferred geo location for the job to run. Possible values include: 'RunLocationNone', 'RunLocationAustraliaeast', 'RunLocationAustraliasoutheast', 'RunLocationBrazilsouth', 'RunLocationCanadacentral', 'RunLocationCanadaeast', 'RunLocationCentralindia', 'RunLocationCentralus', 'RunLocationEastasia', 'RunLocationEastus', 'RunLocationEastus2', 'RunLocationJapaneast', 'RunLocationJapanwest', 'RunLocationKoreacentral', 'RunLocationKoreasouth', 'RunLocationSoutheastasia', 'RunLocationSouthcentralus', 'RunLocationSouthindia', 'RunLocationNorthcentralus', 'RunLocationNortheurope', 'RunLocationUksouth', 'RunLocationUkwest', 'RunLocationWestcentralus', 'RunLocationWesteurope', 'RunLocationWestindia', 'RunLocationWestus', 'RunLocationWestus2' + RunLocation RunLocation `json:"runLocation,omitempty"` + // UserConfirmation - Enum to detect if user confirmation is required. If not passed will default to NotRequired. Possible values include: 'NotRequired', 'Required' + UserConfirmation UserConfirmation `json:"userConfirmation,omitempty"` + // DataServiceInput - A generic json used differently by each data service type. + DataServiceInput interface{} `json:"dataServiceInput,omitempty"` + // CustomerSecrets - List of customer secrets containing a key identifier and key value. The key identifier is a way for the specific data source to understand the key. Value contains customer secret encrypted by the encryptionKeys. + CustomerSecrets *[]CustomerSecret `json:"customerSecrets,omitempty"` +} + +// JobDefinitionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type JobDefinitionsCreateOrUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *JobDefinitionsCreateOrUpdateFuture) Result(client JobDefinitionsClient) (jd JobDefinition, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "hybriddata.JobDefinitionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("hybriddata.JobDefinitionsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if jd.Response.Response, err = future.GetResult(sender); err == nil && jd.Response.Response.StatusCode != http.StatusNoContent { + jd, err = client.CreateOrUpdateResponder(jd.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "hybriddata.JobDefinitionsCreateOrUpdateFuture", "Result", jd.Response.Response, "Failure responding to request") + } + } + return +} + +// JobDefinitionsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type JobDefinitionsDeleteFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *JobDefinitionsDeleteFuture) Result(client JobDefinitionsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "hybriddata.JobDefinitionsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("hybriddata.JobDefinitionsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// JobDefinitionsRunFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type JobDefinitionsRunFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *JobDefinitionsRunFuture) Result(client JobDefinitionsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "hybriddata.JobDefinitionsRunFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("hybriddata.JobDefinitionsRunFuture") + return + } + ar.Response = future.Response() + return +} + +// JobDetails job details. +type JobDetails struct { + // JobStages - List of stages that ran in the job + JobStages *[]JobStages `json:"jobStages,omitempty"` + // JobDefinition - JobDefinition at the time of the run + JobDefinition *JobDefinition `json:"jobDefinition,omitempty"` + // ErrorDetails - Error details for failure. This is optional. + ErrorDetails *[]ErrorDetails `json:"errorDetails,omitempty"` + // ItemDetailsLink - Item Details Link to download files or see details + ItemDetailsLink *string `json:"itemDetailsLink,omitempty"` +} + +// JobFilter contains the information about the filters for the job. +type JobFilter struct { + // Status - The status of the job. Possible values include: 'None', 'InProgress', 'Succeeded', 'WaitingForAction', 'Failed', 'Cancelled', 'Cancelling' + Status JobStatus `json:"status,omitempty"` + // StartTime - The start time of the job. + StartTime *date.Time `json:"startTime,omitempty"` +} + +// JobList job Collection. +type JobList struct { + autorest.Response `json:"-"` + // Value - List of jobs. + Value *[]Job `json:"value,omitempty"` + // NextLink - Link for the next set of jobs. + NextLink *string `json:"nextLink,omitempty"` +} + +// JobListIterator provides access to a complete listing of Job values. +type JobListIterator struct { + i int + page JobListPage +} + +// 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 *JobListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/JobListIterator.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 *JobListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter JobListIterator) 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 JobListIterator) Response() JobList { + 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 JobListIterator) Value() Job { + if !iter.page.NotDone() { + return Job{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the JobListIterator type. +func NewJobListIterator(page JobListPage) JobListIterator { + return JobListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (jl JobList) IsEmpty() bool { + return jl.Value == nil || len(*jl.Value) == 0 +} + +// jobListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (jl JobList) jobListPreparer(ctx context.Context) (*http.Request, error) { + if jl.NextLink == nil || len(to.String(jl.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(jl.NextLink))) +} + +// JobListPage contains a page of Job values. +type JobListPage struct { + fn func(context.Context, JobList) (JobList, error) + jl JobList +} + +// 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 *JobListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/JobListPage.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.jl) + if err != nil { + return err + } + page.jl = 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 *JobListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page JobListPage) NotDone() bool { + return !page.jl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page JobListPage) Response() JobList { + return page.jl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page JobListPage) Values() []Job { + if page.jl.IsEmpty() { + return nil + } + return *page.jl.Value +} + +// Creates a new instance of the JobListPage type. +func NewJobListPage(getNextPage func(context.Context, JobList) (JobList, error)) JobListPage { + return JobListPage{fn: getNextPage} +} + +// JobProperties job Properties +type JobProperties struct { + // IsCancellable - Describes whether the job is cancellable. Possible values include: 'NotCancellable', 'Cancellable' + IsCancellable IsJobCancellable `json:"isCancellable,omitempty"` + // BytesProcessed - Number of bytes processed by the job as of now. + BytesProcessed *int64 `json:"bytesProcessed,omitempty"` + // ItemsProcessed - Number of items processed by the job as of now + ItemsProcessed *int64 `json:"itemsProcessed,omitempty"` + // TotalBytesToProcess - Number of bytes to be processed by the job in total. + TotalBytesToProcess *int64 `json:"totalBytesToProcess,omitempty"` + // TotalItemsToProcess - Number of items to be processed by the job in total + TotalItemsToProcess *int64 `json:"totalItemsToProcess,omitempty"` + // Details - Details of a job run. This field will only be sent for expand details filter. + Details *JobDetails `json:"details,omitempty"` + // DataSourceName - Name of the data source on which the job was triggered. + DataSourceName *string `json:"dataSourceName,omitempty"` + // DataSinkName - Name of the data sink on which the job was triggered. + DataSinkName *string `json:"dataSinkName,omitempty"` +} + +// JobsCancelFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type JobsCancelFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *JobsCancelFuture) Result(client JobsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "hybriddata.JobsCancelFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("hybriddata.JobsCancelFuture") + return + } + ar.Response = future.Response() + return +} + +// JobsResumeFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type JobsResumeFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *JobsResumeFuture) Result(client JobsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "hybriddata.JobsResumeFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("hybriddata.JobsResumeFuture") + return + } + ar.Response = future.Response() + return +} + +// JobStages job stages. +type JobStages struct { + // StageName - Name of the job stage. + StageName *string `json:"stageName,omitempty"` + // StageStatus - Status of the job stage. Possible values include: 'None', 'InProgress', 'Succeeded', 'WaitingForAction', 'Failed', 'Cancelled', 'Cancelling' + StageStatus JobStatus `json:"stageStatus,omitempty"` + // JobStageDetails - Job Stage Details + JobStageDetails interface{} `json:"jobStageDetails,omitempty"` + // ErrorDetails - Error details for the stage. This is optional + ErrorDetails *[]ErrorDetails `json:"errorDetails,omitempty"` +} + +// Key encryption Key. +type Key struct { + // KeyModulus - Modulus of the encryption key. + KeyModulus *string `json:"keyModulus,omitempty"` + // KeyExponent - Exponent of the encryption key. + KeyExponent *string `json:"keyExponent,omitempty"` + // EncryptionChunkSizeInBytes - The maximum byte size that can be encrypted by the key. For a key size larger than the size, break into chunks and encrypt each chunk, append each encrypted chunk with : to mark the end of the chunk. + EncryptionChunkSizeInBytes *int32 `json:"encryptionChunkSizeInBytes,omitempty"` +} + +// PublicKey public key +type PublicKey struct { + autorest.Response `json:"-"` + // PublicKeyProperties - Public key property. + *PublicKeyProperties `json:"properties,omitempty"` + // Name - Name of the object. + Name *string `json:"name,omitempty"` + // ID - Id of the object. + ID *string `json:"id,omitempty"` + // Type - Type of the object. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for PublicKey. +func (pk PublicKey) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pk.PublicKeyProperties != nil { + objectMap["properties"] = pk.PublicKeyProperties + } + if pk.Name != nil { + objectMap["name"] = pk.Name + } + if pk.ID != nil { + objectMap["id"] = pk.ID + } + if pk.Type != nil { + objectMap["type"] = pk.Type + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PublicKey struct. +func (pk *PublicKey) 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 publicKeyProperties PublicKeyProperties + err = json.Unmarshal(*v, &publicKeyProperties) + if err != nil { + return err + } + pk.PublicKeyProperties = &publicKeyProperties + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + pk.Name = &name + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + pk.ID = &ID + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + pk.Type = &typeVar + } + } + } + + return nil +} + +// PublicKeyList publicKey Collection +type PublicKeyList struct { + autorest.Response `json:"-"` + // Value - List of public keys. + Value *[]PublicKey `json:"value,omitempty"` + // NextLink - Link for the next set of public keys. + NextLink *string `json:"nextLink,omitempty"` +} + +// PublicKeyListIterator provides access to a complete listing of PublicKey values. +type PublicKeyListIterator struct { + i int + page PublicKeyListPage +} + +// 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 *PublicKeyListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PublicKeyListIterator.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 *PublicKeyListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter PublicKeyListIterator) 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 PublicKeyListIterator) Response() PublicKeyList { + 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 PublicKeyListIterator) Value() PublicKey { + if !iter.page.NotDone() { + return PublicKey{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the PublicKeyListIterator type. +func NewPublicKeyListIterator(page PublicKeyListPage) PublicKeyListIterator { + return PublicKeyListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (pkl PublicKeyList) IsEmpty() bool { + return pkl.Value == nil || len(*pkl.Value) == 0 +} + +// publicKeyListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (pkl PublicKeyList) publicKeyListPreparer(ctx context.Context) (*http.Request, error) { + if pkl.NextLink == nil || len(to.String(pkl.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(pkl.NextLink))) +} + +// PublicKeyListPage contains a page of PublicKey values. +type PublicKeyListPage struct { + fn func(context.Context, PublicKeyList) (PublicKeyList, error) + pkl PublicKeyList +} + +// 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 *PublicKeyListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PublicKeyListPage.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.pkl) + if err != nil { + return err + } + page.pkl = 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 *PublicKeyListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page PublicKeyListPage) NotDone() bool { + return !page.pkl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page PublicKeyListPage) Response() PublicKeyList { + return page.pkl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page PublicKeyListPage) Values() []PublicKey { + if page.pkl.IsEmpty() { + return nil + } + return *page.pkl.Value +} + +// Creates a new instance of the PublicKeyListPage type. +func NewPublicKeyListPage(getNextPage func(context.Context, PublicKeyList) (PublicKeyList, error)) PublicKeyListPage { + return PublicKeyListPage{fn: getNextPage} +} + +// PublicKeyProperties publicKey Properties +type PublicKeyProperties struct { + // DataServiceLevel1Key - Level one public key for encryption + DataServiceLevel1Key *Key `json:"dataServiceLevel1Key,omitempty"` + // DataServiceLevel2Key - Level two public key for encryption + DataServiceLevel2Key *Key `json:"dataServiceLevel2Key,omitempty"` +} + +// Resource model of the Resource. +type Resource struct { + // ID - The Resource Id. + ID *string `json:"id,omitempty"` + // Name - The Resource Name. + Name *string `json:"name,omitempty"` + // Type - The Resource type. + Type *string `json:"type,omitempty"` + // Location - The location of the resource. This will be one of the supported and registered Azure Geo Regions (e.g. West US, East + // US, Southeast Asia, etc.). The geo region of a resource cannot be changed once it is created, but if an identical geo + // region is specified on update the request will succeed. + Location *string `json:"location,omitempty"` + // Tags - The list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource + // (across resource groups). + Tags map[string]*string `json:"tags"` + // Sku - The sku type. + Sku *Sku `json:"sku,omitempty"` +} + +// MarshalJSON is the custom marshaler for Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if r.ID != nil { + objectMap["id"] = r.ID + } + if r.Name != nil { + objectMap["name"] = r.Name + } + if r.Type != nil { + objectMap["type"] = r.Type + } + if r.Location != nil { + objectMap["location"] = r.Location + } + if r.Tags != nil { + objectMap["tags"] = r.Tags + } + if r.Sku != nil { + objectMap["sku"] = r.Sku + } + return json.Marshal(objectMap) +} + +// RunParameters run parameters for a job. +type RunParameters struct { + // UserConfirmation - Enum to detect if user confirmation is required. If not passed will default to NotRequired. Possible values include: 'NotRequired', 'Required' + UserConfirmation UserConfirmation `json:"userConfirmation,omitempty"` + // DataServiceInput - A generic json used differently by each data service type. + DataServiceInput interface{} `json:"dataServiceInput,omitempty"` + // CustomerSecrets - List of customer secrets containing a key identifier and key value. The key identifier is a way for the specific data source to understand the key. Value contains customer secret encrypted by the encryptionKeys. + CustomerSecrets *[]CustomerSecret `json:"customerSecrets,omitempty"` +} + +// Schedule schedule for the job run. +type Schedule struct { + // Name - Name of the schedule. + Name *string `json:"name,omitempty"` + // PolicyList - A list of repetition intervals in ISO 8601 format. + PolicyList *[]string `json:"policyList,omitempty"` +} + +// Sku the sku type. +type Sku struct { + // Name - The sku name. Required for data manager creation, optional for update. + Name *string `json:"name,omitempty"` + // Tier - The sku tier. This is based on the SKU name. + Tier *string `json:"tier,omitempty"` +} diff --git a/services/hybriddatamanager/mgmt/2016-06-01/hybriddata/operations.go b/services/hybriddatamanager/mgmt/2016-06-01/hybriddata/operations.go new file mode 100644 index 000000000000..29a50b5198c0 --- /dev/null +++ b/services/hybriddatamanager/mgmt/2016-06-01/hybriddata/operations.go @@ -0,0 +1,147 @@ +package hybriddata + +// 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 client for the Operations methods of the Hybriddata service. +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 sends the list request. +func (client OperationsClient) List(ctx context.Context) (result AvailableProviderOperationsPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.apo.Response.Response != nil { + sc = result.apo.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "hybriddata.OperationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.apo.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "hybriddata.OperationsClient", "List", resp, "Failure sending request") + return + } + + result.apo, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hybriddata.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 = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.HybridData/operations"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client OperationsClient) ListResponder(resp *http.Response) (result AvailableProviderOperations, 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 AvailableProviderOperations) (result AvailableProviderOperations, err error) { + req, err := lastResults.availableProviderOperationsPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "hybriddata.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, "hybriddata.OperationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hybriddata.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 AvailableProviderOperationsIterator, 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/hybriddatamanager/mgmt/2016-06-01/hybriddata/publickeys.go b/services/hybriddatamanager/mgmt/2016-06-01/hybriddata/publickeys.go new file mode 100644 index 000000000000..0403bca0c3e6 --- /dev/null +++ b/services/hybriddatamanager/mgmt/2016-06-01/hybriddata/publickeys.go @@ -0,0 +1,254 @@ +package hybriddata + +// 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" +) + +// PublicKeysClient is the client for the PublicKeys methods of the Hybriddata service. +type PublicKeysClient struct { + BaseClient +} + +// NewPublicKeysClient creates an instance of the PublicKeysClient client. +func NewPublicKeysClient(subscriptionID string) PublicKeysClient { + return NewPublicKeysClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewPublicKeysClientWithBaseURI creates an instance of the PublicKeysClient client. +func NewPublicKeysClientWithBaseURI(baseURI string, subscriptionID string) PublicKeysClient { + return PublicKeysClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get this method gets the public keys. +// Parameters: +// publicKeyName - name of the public key. +// resourceGroupName - the Resource Group Name +// dataManagerName - the name of the DataManager Resource within the specified resource group. DataManager +// names must be between 3 and 24 characters in length and use any alphanumeric and underscore only +func (client PublicKeysClient) Get(ctx context.Context, publicKeyName string, resourceGroupName string, dataManagerName string) (result PublicKey, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PublicKeysClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: dataManagerName, + Constraints: []validation.Constraint{{Target: "dataManagerName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "dataManagerName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "dataManagerName", Name: validation.Pattern, Rule: `^[-\w\.]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("hybriddata.PublicKeysClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, publicKeyName, resourceGroupName, dataManagerName) + if err != nil { + err = autorest.NewErrorWithError(err, "hybriddata.PublicKeysClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "hybriddata.PublicKeysClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hybriddata.PublicKeysClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client PublicKeysClient) GetPreparer(ctx context.Context, publicKeyName string, resourceGroupName string, dataManagerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "dataManagerName": autorest.Encode("path", dataManagerName), + "publicKeyName": autorest.Encode("path", publicKeyName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridData/dataManagers/{dataManagerName}/publicKeys/{publicKeyName}", 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 PublicKeysClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client PublicKeysClient) GetResponder(resp *http.Response) (result PublicKey, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByDataManager this method gets the list view of public keys, however it will only have one element. +// Parameters: +// resourceGroupName - the Resource Group Name +// dataManagerName - the name of the DataManager Resource within the specified resource group. DataManager +// names must be between 3 and 24 characters in length and use any alphanumeric and underscore only +func (client PublicKeysClient) ListByDataManager(ctx context.Context, resourceGroupName string, dataManagerName string) (result PublicKeyListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PublicKeysClient.ListByDataManager") + defer func() { + sc := -1 + if result.pkl.Response.Response != nil { + sc = result.pkl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: dataManagerName, + Constraints: []validation.Constraint{{Target: "dataManagerName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "dataManagerName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "dataManagerName", Name: validation.Pattern, Rule: `^[-\w\.]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("hybriddata.PublicKeysClient", "ListByDataManager", err.Error()) + } + + result.fn = client.listByDataManagerNextResults + req, err := client.ListByDataManagerPreparer(ctx, resourceGroupName, dataManagerName) + if err != nil { + err = autorest.NewErrorWithError(err, "hybriddata.PublicKeysClient", "ListByDataManager", nil, "Failure preparing request") + return + } + + resp, err := client.ListByDataManagerSender(req) + if err != nil { + result.pkl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "hybriddata.PublicKeysClient", "ListByDataManager", resp, "Failure sending request") + return + } + + result.pkl, err = client.ListByDataManagerResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hybriddata.PublicKeysClient", "ListByDataManager", resp, "Failure responding to request") + } + + return +} + +// ListByDataManagerPreparer prepares the ListByDataManager request. +func (client PublicKeysClient) ListByDataManagerPreparer(ctx context.Context, resourceGroupName string, dataManagerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "dataManagerName": autorest.Encode("path", dataManagerName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridData/dataManagers/{dataManagerName}/publicKeys", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByDataManagerSender sends the ListByDataManager request. The method will close the +// http.Response Body if it receives an error. +func (client PublicKeysClient) ListByDataManagerSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListByDataManagerResponder handles the response to the ListByDataManager request. The method always +// closes the http.Response Body. +func (client PublicKeysClient) ListByDataManagerResponder(resp *http.Response) (result PublicKeyList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByDataManagerNextResults retrieves the next set of results, if any. +func (client PublicKeysClient) listByDataManagerNextResults(ctx context.Context, lastResults PublicKeyList) (result PublicKeyList, err error) { + req, err := lastResults.publicKeyListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "hybriddata.PublicKeysClient", "listByDataManagerNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByDataManagerSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "hybriddata.PublicKeysClient", "listByDataManagerNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByDataManagerResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "hybriddata.PublicKeysClient", "listByDataManagerNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByDataManagerComplete enumerates all values, automatically crossing page boundaries as required. +func (client PublicKeysClient) ListByDataManagerComplete(ctx context.Context, resourceGroupName string, dataManagerName string) (result PublicKeyListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PublicKeysClient.ListByDataManager") + 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.ListByDataManager(ctx, resourceGroupName, dataManagerName) + return +} diff --git a/services/hybriddatamanager/mgmt/2016-06-01/hybriddata/version.go b/services/hybriddatamanager/mgmt/2016-06-01/hybriddata/version.go new file mode 100644 index 000000000000..039ae35755c8 --- /dev/null +++ b/services/hybriddatamanager/mgmt/2016-06-01/hybriddata/version.go @@ -0,0 +1,30 @@ +package hybriddata + +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 + " hybriddata/2016-06-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +}