From 868d42e54fab681c7ca72d60ff914e0136388897 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Mon, 28 Mar 2022 05:16:07 +0000 Subject: [PATCH] CodeGen from PR 17070 in Azure/azure-rest-api-specs [Hub Generated] Review request for Microsoft.Confluent to add version stable/2021-12-01 (#17070) * Adds base for updating Microsoft.Confluent from version preview/2021-09-01-preview to version 2021-12-01 * Updates readme * Updates API version in new specs and examples * Fixing spellcheck and updating readme files (#17071) * Update confluent.json (#18254) Fixing linting errors * Update confluent.json for LintDiff fixes (#18261) --- .../mgmt/2020-03-01/confluent/CHANGELOG.md | 9 +- .../mgmt/2020-03-01/confluent/_meta.json | 2 +- .../confluent/marketplaceagreements.go | 16 +- .../mgmt/2020-03-01/confluent/models.go | 67 +- .../mgmt/2021-12-01/confluent/CHANGELOG.md | 2 + .../mgmt/2021-12-01/confluent/_meta.json | 11 + .../mgmt/2021-12-01/confluent/client.go | 41 + .../confluent/confluentapi/interfaces.go | 50 + .../mgmt/2021-12-01/confluent/enums.go | 86 ++ .../confluent/marketplaceagreements.go | 227 +++++ .../mgmt/2021-12-01/confluent/models.go | 953 ++++++++++++++++++ .../mgmt/2021-12-01/confluent/organization.go | 615 +++++++++++ .../confluent/organizationoperations.go | 141 +++ .../mgmt/2021-12-01/confluent/validations.go | 142 +++ .../mgmt/2021-12-01/confluent/version.go | 19 + .../2020-03-01-preview/confluent/CHANGELOG.md | 24 +- .../2020-03-01-preview/confluent/_meta.json | 2 +- .../confluent/marketplaceagreements.go | 18 +- .../2020-03-01-preview/confluent/models.go | 119 ++- .../2021-03-01-preview/confluent/CHANGELOG.md | 7 +- .../2021-03-01-preview/confluent/_meta.json | 2 +- .../2021-03-01-preview/confluent/models.go | 23 +- .../2021-09-01-preview/confluent/CHANGELOG.md | 7 +- .../2021-09-01-preview/confluent/_meta.json | 2 +- .../2021-09-01-preview/confluent/models.go | 23 +- 25 files changed, 2568 insertions(+), 40 deletions(-) create mode 100644 services/confluent/mgmt/2021-12-01/confluent/CHANGELOG.md create mode 100644 services/confluent/mgmt/2021-12-01/confluent/_meta.json create mode 100644 services/confluent/mgmt/2021-12-01/confluent/client.go create mode 100644 services/confluent/mgmt/2021-12-01/confluent/confluentapi/interfaces.go create mode 100644 services/confluent/mgmt/2021-12-01/confluent/enums.go create mode 100644 services/confluent/mgmt/2021-12-01/confluent/marketplaceagreements.go create mode 100644 services/confluent/mgmt/2021-12-01/confluent/models.go create mode 100644 services/confluent/mgmt/2021-12-01/confluent/organization.go create mode 100644 services/confluent/mgmt/2021-12-01/confluent/organizationoperations.go create mode 100644 services/confluent/mgmt/2021-12-01/confluent/validations.go create mode 100644 services/confluent/mgmt/2021-12-01/confluent/version.go diff --git a/services/confluent/mgmt/2020-03-01/confluent/CHANGELOG.md b/services/confluent/mgmt/2020-03-01/confluent/CHANGELOG.md index 52911e4cc5e4..30c381c9bf25 100644 --- a/services/confluent/mgmt/2020-03-01/confluent/CHANGELOG.md +++ b/services/confluent/mgmt/2020-03-01/confluent/CHANGELOG.md @@ -1,2 +1,9 @@ -# Change History +# Unreleased +## Additive Changes + +### New Funcs + +1. OfferDetail.MarshalJSON() ([]byte, error) +1. OperationListResult.MarshalJSON() ([]byte, error) +1. OrganizationResourcePropertiesOfferDetail.MarshalJSON() ([]byte, error) diff --git a/services/confluent/mgmt/2020-03-01/confluent/_meta.json b/services/confluent/mgmt/2020-03-01/confluent/_meta.json index 224896778b47..eb37e7a867b8 100644 --- a/services/confluent/mgmt/2020-03-01/confluent/_meta.json +++ b/services/confluent/mgmt/2020-03-01/confluent/_meta.json @@ -1,5 +1,5 @@ { - "commit": "d4bad535d456ee82c7fd17d1ec2b8802a0b83205", + "commit": "49312ea7188eb199e29f91a80bd65b35033945c5", "readme": "/_/azure-rest-api-specs/specification/confluent/resource-manager/readme.md", "tag": "package-2020-03-01", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/confluent/mgmt/2020-03-01/confluent/marketplaceagreements.go b/services/confluent/mgmt/2020-03-01/confluent/marketplaceagreements.go index fc3a87a8ab13..b65e603e8ac1 100644 --- a/services/confluent/mgmt/2020-03-01/confluent/marketplaceagreements.go +++ b/services/confluent/mgmt/2020-03-01/confluent/marketplaceagreements.go @@ -73,6 +73,11 @@ func (client MarketplaceAgreementsClient) CreatePreparer(ctx context.Context, bo "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2020-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + body.ID = nil body.Name = nil body.Type = nil @@ -80,7 +85,8 @@ func (client MarketplaceAgreementsClient) CreatePreparer(ctx context.Context, bo autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPut(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Confluent/agreements/default", pathParameters)) + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Confluent/agreements/default", pathParameters), + autorest.WithQueryParameters(queryParameters)) if body != nil { preparer = autorest.DecoratePreparer(preparer, autorest.WithJSON(body)) @@ -151,10 +157,16 @@ func (client MarketplaceAgreementsClient) ListPreparer(ctx context.Context) (*ht "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2020-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Confluent/agreements", pathParameters)) + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Confluent/agreements", pathParameters), + autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } diff --git a/services/confluent/mgmt/2020-03-01/confluent/models.go b/services/confluent/mgmt/2020-03-01/confluent/models.go index c86d2cf3d3f8..4b50b7069f70 100644 --- a/services/confluent/mgmt/2020-03-01/confluent/models.go +++ b/services/confluent/mgmt/2020-03-01/confluent/models.go @@ -302,10 +302,31 @@ type OfferDetail struct { PlanName *string `json:"planName,omitempty"` // TermUnit - Offer Plan Term unit TermUnit *string `json:"termUnit,omitempty"` - // Status - SaaS Offer Status. Possible values include: 'SaaSOfferStatusStarted', 'SaaSOfferStatusPendingFulfillmentStart', 'SaaSOfferStatusInProgress', 'SaaSOfferStatusSubscribed', 'SaaSOfferStatusSuspended', 'SaaSOfferStatusReinstated', 'SaaSOfferStatusSucceeded', 'SaaSOfferStatusFailed', 'SaaSOfferStatusUnsubscribed', 'SaaSOfferStatusUpdating' + // Status - READ-ONLY; SaaS Offer Status. Possible values include: 'SaaSOfferStatusStarted', 'SaaSOfferStatusPendingFulfillmentStart', 'SaaSOfferStatusInProgress', 'SaaSOfferStatusSubscribed', 'SaaSOfferStatusSuspended', 'SaaSOfferStatusReinstated', 'SaaSOfferStatusSucceeded', 'SaaSOfferStatusFailed', 'SaaSOfferStatusUnsubscribed', 'SaaSOfferStatusUpdating' Status SaaSOfferStatus `json:"status,omitempty"` } +// MarshalJSON is the custom marshaler for OfferDetail. +func (od OfferDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if od.PublisherID != nil { + objectMap["publisherId"] = od.PublisherID + } + if od.ID != nil { + objectMap["id"] = od.ID + } + if od.PlanID != nil { + objectMap["planId"] = od.PlanID + } + if od.PlanName != nil { + objectMap["planName"] = od.PlanName + } + if od.TermUnit != nil { + objectMap["termUnit"] = od.TermUnit + } + return json.Marshal(objectMap) +} + // OperationDisplay the object that represents the operation. type OperationDisplay struct { // Provider - Service provider: Microsoft.Confluent @@ -323,10 +344,19 @@ type OperationListResult struct { autorest.Response `json:"-"` // Value - List of Confluent operations supported by the Microsoft.Confluent provider. Value *[]OperationResult `json:"value,omitempty"` - // NextLink - URL to get the next set of operation list results if there are any. + // NextLink - READ-ONLY; URL to get the next set of operation list results if there are any. NextLink *string `json:"nextLink,omitempty"` } +// MarshalJSON is the custom marshaler for OperationListResult. +func (olr OperationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if olr.Value != nil { + objectMap["value"] = olr.Value + } + return json.Marshal(objectMap) +} + // OperationListResultIterator provides access to a complete listing of OperationResult values. type OperationListResultIterator struct { i int @@ -832,7 +862,7 @@ func NewOrganizationResourceListResultPage(cur OrganizationResourceListResult, g type OrganizationResourceProperties struct { // CreatedTime - READ-ONLY; The creation time of the resource. CreatedTime *date.Time `json:"createdTime,omitempty"` - // ProvisioningState - Provision states for confluent RP. Possible values include: 'Accepted', 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled', 'Deleted', 'NotSpecified' + // ProvisioningState - READ-ONLY; Provision states for confluent RP. Possible values include: 'Accepted', 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled', 'Deleted', 'NotSpecified' ProvisioningState ProvisionState `json:"provisioningState,omitempty"` // OrganizationID - READ-ONLY; Id of the Confluent organization. OrganizationID *string `json:"organizationId,omitempty"` @@ -847,9 +877,6 @@ type OrganizationResourceProperties struct { // MarshalJSON is the custom marshaler for OrganizationResourceProperties. func (orp OrganizationResourceProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if orp.ProvisioningState != "" { - objectMap["provisioningState"] = orp.ProvisioningState - } if orp.OfferDetail != nil { objectMap["offerDetail"] = orp.OfferDetail } @@ -863,7 +890,7 @@ func (orp OrganizationResourceProperties) MarshalJSON() ([]byte, error) { type OrganizationResourcePropertiesModel struct { // CreatedTime - READ-ONLY; The creation time of the resource. CreatedTime *date.Time `json:"createdTime,omitempty"` - // ProvisioningState - Provision states for confluent RP. Possible values include: 'Accepted', 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled', 'Deleted', 'NotSpecified' + // ProvisioningState - READ-ONLY; Provision states for confluent RP. Possible values include: 'Accepted', 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled', 'Deleted', 'NotSpecified' ProvisioningState ProvisionState `json:"provisioningState,omitempty"` // OrganizationID - READ-ONLY; Id of the Confluent organization. OrganizationID *string `json:"organizationId,omitempty"` @@ -878,9 +905,6 @@ type OrganizationResourcePropertiesModel struct { // MarshalJSON is the custom marshaler for OrganizationResourcePropertiesModel. func (orpm OrganizationResourcePropertiesModel) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if orpm.ProvisioningState != "" { - objectMap["provisioningState"] = orpm.ProvisioningState - } if orpm.OfferDetail != nil { objectMap["offerDetail"] = orpm.OfferDetail } @@ -902,10 +926,31 @@ type OrganizationResourcePropertiesOfferDetail struct { PlanName *string `json:"planName,omitempty"` // TermUnit - Offer Plan Term unit TermUnit *string `json:"termUnit,omitempty"` - // Status - SaaS Offer Status. Possible values include: 'SaaSOfferStatusStarted', 'SaaSOfferStatusPendingFulfillmentStart', 'SaaSOfferStatusInProgress', 'SaaSOfferStatusSubscribed', 'SaaSOfferStatusSuspended', 'SaaSOfferStatusReinstated', 'SaaSOfferStatusSucceeded', 'SaaSOfferStatusFailed', 'SaaSOfferStatusUnsubscribed', 'SaaSOfferStatusUpdating' + // Status - READ-ONLY; SaaS Offer Status. Possible values include: 'SaaSOfferStatusStarted', 'SaaSOfferStatusPendingFulfillmentStart', 'SaaSOfferStatusInProgress', 'SaaSOfferStatusSubscribed', 'SaaSOfferStatusSuspended', 'SaaSOfferStatusReinstated', 'SaaSOfferStatusSucceeded', 'SaaSOfferStatusFailed', 'SaaSOfferStatusUnsubscribed', 'SaaSOfferStatusUpdating' Status SaaSOfferStatus `json:"status,omitempty"` } +// MarshalJSON is the custom marshaler for OrganizationResourcePropertiesOfferDetail. +func (orpD OrganizationResourcePropertiesOfferDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if orpD.PublisherID != nil { + objectMap["publisherId"] = orpD.PublisherID + } + if orpD.ID != nil { + objectMap["id"] = orpD.ID + } + if orpD.PlanID != nil { + objectMap["planId"] = orpD.PlanID + } + if orpD.PlanName != nil { + objectMap["planName"] = orpD.PlanName + } + if orpD.TermUnit != nil { + objectMap["termUnit"] = orpD.TermUnit + } + return json.Marshal(objectMap) +} + // OrganizationResourcePropertiesUserDetail subscriber detail type OrganizationResourcePropertiesUserDetail struct { // FirstName - First name diff --git a/services/confluent/mgmt/2021-12-01/confluent/CHANGELOG.md b/services/confluent/mgmt/2021-12-01/confluent/CHANGELOG.md new file mode 100644 index 000000000000..a1ecf841edb0 --- /dev/null +++ b/services/confluent/mgmt/2021-12-01/confluent/CHANGELOG.md @@ -0,0 +1,2 @@ +# Unreleased + diff --git a/services/confluent/mgmt/2021-12-01/confluent/_meta.json b/services/confluent/mgmt/2021-12-01/confluent/_meta.json new file mode 100644 index 000000000000..866dfcf43ffb --- /dev/null +++ b/services/confluent/mgmt/2021-12-01/confluent/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "49312ea7188eb199e29f91a80bd65b35033945c5", + "readme": "/_/azure-rest-api-specs/specification/confluent/resource-manager/readme.md", + "tag": "package-2021-12-01", + "use": "@microsoft.azure/autorest.go@2.1.187", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2021-12-01 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/confluent/resource-manager/readme.md", + "additional_properties": { + "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" + } +} \ No newline at end of file diff --git a/services/confluent/mgmt/2021-12-01/confluent/client.go b/services/confluent/mgmt/2021-12-01/confluent/client.go new file mode 100644 index 000000000000..eef042d35f8b --- /dev/null +++ b/services/confluent/mgmt/2021-12-01/confluent/client.go @@ -0,0 +1,41 @@ +// Package confluent implements the Azure ARM Confluent service API version 2021-12-01. +// +// +package confluent + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// 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 Confluent + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Confluent. +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 using a custom endpoint. Use this when interacting with +// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { + return BaseClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/services/confluent/mgmt/2021-12-01/confluent/confluentapi/interfaces.go b/services/confluent/mgmt/2021-12-01/confluent/confluentapi/interfaces.go new file mode 100644 index 000000000000..b96f069bbfea --- /dev/null +++ b/services/confluent/mgmt/2021-12-01/confluent/confluentapi/interfaces.go @@ -0,0 +1,50 @@ +package confluentapi + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// 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/confluent/mgmt/2021-12-01/confluent" +) + +// MarketplaceAgreementsClientAPI contains the set of methods on the MarketplaceAgreementsClient type. +type MarketplaceAgreementsClientAPI interface { + Create(ctx context.Context, body *confluent.AgreementResource) (result confluent.AgreementResource, err error) + List(ctx context.Context) (result confluent.AgreementResourceListResponsePage, err error) + ListComplete(ctx context.Context) (result confluent.AgreementResourceListResponseIterator, err error) +} + +var _ MarketplaceAgreementsClientAPI = (*confluent.MarketplaceAgreementsClient)(nil) + +// OrganizationOperationsClientAPI contains the set of methods on the OrganizationOperationsClient type. +type OrganizationOperationsClientAPI interface { + List(ctx context.Context) (result confluent.OperationListResultPage, err error) + ListComplete(ctx context.Context) (result confluent.OperationListResultIterator, err error) +} + +var _ OrganizationOperationsClientAPI = (*confluent.OrganizationOperationsClient)(nil) + +// OrganizationClientAPI contains the set of methods on the OrganizationClient type. +type OrganizationClientAPI interface { + Create(ctx context.Context, resourceGroupName string, organizationName string, body *confluent.OrganizationResource) (result confluent.OrganizationCreateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, organizationName string) (result confluent.OrganizationDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, organizationName string) (result confluent.OrganizationResource, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result confluent.OrganizationResourceListResultPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result confluent.OrganizationResourceListResultIterator, err error) + ListBySubscription(ctx context.Context) (result confluent.OrganizationResourceListResultPage, err error) + ListBySubscriptionComplete(ctx context.Context) (result confluent.OrganizationResourceListResultIterator, err error) + Update(ctx context.Context, resourceGroupName string, organizationName string, body *confluent.OrganizationResourceUpdate) (result confluent.OrganizationResource, err error) +} + +var _ OrganizationClientAPI = (*confluent.OrganizationClient)(nil) + +// ValidationsClientAPI contains the set of methods on the ValidationsClient type. +type ValidationsClientAPI interface { + ValidateOrganization(ctx context.Context, resourceGroupName string, organizationName string, body confluent.OrganizationResource) (result confluent.OrganizationResource, err error) +} + +var _ ValidationsClientAPI = (*confluent.ValidationsClient)(nil) diff --git a/services/confluent/mgmt/2021-12-01/confluent/enums.go b/services/confluent/mgmt/2021-12-01/confluent/enums.go new file mode 100644 index 000000000000..e1d500b1276f --- /dev/null +++ b/services/confluent/mgmt/2021-12-01/confluent/enums.go @@ -0,0 +1,86 @@ +package confluent + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// CreatedByType enumerates the values for created by type. +type CreatedByType string + +const ( + // Application ... + Application CreatedByType = "Application" + // Key ... + Key CreatedByType = "Key" + // ManagedIdentity ... + ManagedIdentity CreatedByType = "ManagedIdentity" + // User ... + User CreatedByType = "User" +) + +// PossibleCreatedByTypeValues returns an array of possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{Application, Key, ManagedIdentity, User} +} + +// ProvisionState enumerates the values for provision state. +type ProvisionState string + +const ( + // Accepted ... + Accepted ProvisionState = "Accepted" + // Canceled ... + Canceled ProvisionState = "Canceled" + // Creating ... + Creating ProvisionState = "Creating" + // Deleted ... + Deleted ProvisionState = "Deleted" + // Deleting ... + Deleting ProvisionState = "Deleting" + // Failed ... + Failed ProvisionState = "Failed" + // NotSpecified ... + NotSpecified ProvisionState = "NotSpecified" + // Succeeded ... + Succeeded ProvisionState = "Succeeded" + // Updating ... + Updating ProvisionState = "Updating" +) + +// PossibleProvisionStateValues returns an array of possible values for the ProvisionState const type. +func PossibleProvisionStateValues() []ProvisionState { + return []ProvisionState{Accepted, Canceled, Creating, Deleted, Deleting, Failed, NotSpecified, Succeeded, Updating} +} + +// SaaSOfferStatus enumerates the values for saa s offer status. +type SaaSOfferStatus string + +const ( + // SaaSOfferStatusFailed ... + SaaSOfferStatusFailed SaaSOfferStatus = "Failed" + // SaaSOfferStatusInProgress ... + SaaSOfferStatusInProgress SaaSOfferStatus = "InProgress" + // SaaSOfferStatusPendingFulfillmentStart ... + SaaSOfferStatusPendingFulfillmentStart SaaSOfferStatus = "PendingFulfillmentStart" + // SaaSOfferStatusReinstated ... + SaaSOfferStatusReinstated SaaSOfferStatus = "Reinstated" + // SaaSOfferStatusStarted ... + SaaSOfferStatusStarted SaaSOfferStatus = "Started" + // SaaSOfferStatusSubscribed ... + SaaSOfferStatusSubscribed SaaSOfferStatus = "Subscribed" + // SaaSOfferStatusSucceeded ... + SaaSOfferStatusSucceeded SaaSOfferStatus = "Succeeded" + // SaaSOfferStatusSuspended ... + SaaSOfferStatusSuspended SaaSOfferStatus = "Suspended" + // SaaSOfferStatusUnsubscribed ... + SaaSOfferStatusUnsubscribed SaaSOfferStatus = "Unsubscribed" + // SaaSOfferStatusUpdating ... + SaaSOfferStatusUpdating SaaSOfferStatus = "Updating" +) + +// PossibleSaaSOfferStatusValues returns an array of possible values for the SaaSOfferStatus const type. +func PossibleSaaSOfferStatusValues() []SaaSOfferStatus { + return []SaaSOfferStatus{SaaSOfferStatusFailed, SaaSOfferStatusInProgress, SaaSOfferStatusPendingFulfillmentStart, SaaSOfferStatusReinstated, SaaSOfferStatusStarted, SaaSOfferStatusSubscribed, SaaSOfferStatusSucceeded, SaaSOfferStatusSuspended, SaaSOfferStatusUnsubscribed, SaaSOfferStatusUpdating} +} diff --git a/services/confluent/mgmt/2021-12-01/confluent/marketplaceagreements.go b/services/confluent/mgmt/2021-12-01/confluent/marketplaceagreements.go new file mode 100644 index 000000000000..180ffc12865e --- /dev/null +++ b/services/confluent/mgmt/2021-12-01/confluent/marketplaceagreements.go @@ -0,0 +1,227 @@ +package confluent + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// 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" +) + +// MarketplaceAgreementsClient is the client for the MarketplaceAgreements methods of the Confluent service. +type MarketplaceAgreementsClient struct { + BaseClient +} + +// NewMarketplaceAgreementsClient creates an instance of the MarketplaceAgreementsClient client. +func NewMarketplaceAgreementsClient(subscriptionID string) MarketplaceAgreementsClient { + return NewMarketplaceAgreementsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewMarketplaceAgreementsClientWithBaseURI creates an instance of the MarketplaceAgreementsClient client using a +// custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, +// Azure stack). +func NewMarketplaceAgreementsClientWithBaseURI(baseURI string, subscriptionID string) MarketplaceAgreementsClient { + return MarketplaceAgreementsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create sends the create request. +// Parameters: +// body - confluent Marketplace Agreement resource +func (client MarketplaceAgreementsClient) Create(ctx context.Context, body *AgreementResource) (result AgreementResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MarketplaceAgreementsClient.Create") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreatePreparer(ctx, body) + if err != nil { + err = autorest.NewErrorWithError(err, "confluent.MarketplaceAgreementsClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "confluent.MarketplaceAgreementsClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "confluent.MarketplaceAgreementsClient", "Create", resp, "Failure responding to request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client MarketplaceAgreementsClient) CreatePreparer(ctx context.Context, body *AgreementResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + body.ID = nil + body.Name = nil + body.Type = nil + body.SystemData = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Confluent/agreements/default", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if body != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(body)) + } + 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 MarketplaceAgreementsClient) CreateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client MarketplaceAgreementsClient) CreateResponder(resp *http.Response) (result AgreementResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List sends the list request. +func (client MarketplaceAgreementsClient) List(ctx context.Context) (result AgreementResourceListResponsePage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MarketplaceAgreementsClient.List") + defer func() { + sc := -1 + if result.arlr.Response.Response != nil { + sc = result.arlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "confluent.MarketplaceAgreementsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.arlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "confluent.MarketplaceAgreementsClient", "List", resp, "Failure sending request") + return + } + + result.arlr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "confluent.MarketplaceAgreementsClient", "List", resp, "Failure responding to request") + return + } + if result.arlr.hasNextLink() && result.arlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client MarketplaceAgreementsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Confluent/agreements", 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 MarketplaceAgreementsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client MarketplaceAgreementsClient) ListResponder(resp *http.Response) (result AgreementResourceListResponse, err error) { + err = autorest.Respond( + resp, + 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 MarketplaceAgreementsClient) listNextResults(ctx context.Context, lastResults AgreementResourceListResponse) (result AgreementResourceListResponse, err error) { + req, err := lastResults.agreementResourceListResponsePreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "confluent.MarketplaceAgreementsClient", "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, "confluent.MarketplaceAgreementsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "confluent.MarketplaceAgreementsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client MarketplaceAgreementsClient) ListComplete(ctx context.Context) (result AgreementResourceListResponseIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MarketplaceAgreementsClient.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/confluent/mgmt/2021-12-01/confluent/models.go b/services/confluent/mgmt/2021-12-01/confluent/models.go new file mode 100644 index 000000000000..c8c6a23dfdd4 --- /dev/null +++ b/services/confluent/mgmt/2021-12-01/confluent/models.go @@ -0,0 +1,953 @@ +package confluent + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// 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/confluent/mgmt/2021-12-01/confluent" + +// AgreementProperties terms properties for Marketplace and Confluent. +type AgreementProperties struct { + // Publisher - Publisher identifier string. + Publisher *string `json:"publisher,omitempty"` + // Product - Product identifier string. + Product *string `json:"product,omitempty"` + // Plan - Plan identifier string. + Plan *string `json:"plan,omitempty"` + // LicenseTextLink - Link to HTML with Microsoft and Publisher terms. + LicenseTextLink *string `json:"licenseTextLink,omitempty"` + // PrivacyPolicyLink - Link to the privacy policy of the publisher. + PrivacyPolicyLink *string `json:"privacyPolicyLink,omitempty"` + // RetrieveDatetime - Date and time in UTC of when the terms were accepted. This is empty if Accepted is false. + RetrieveDatetime *date.Time `json:"retrieveDatetime,omitempty"` + // Signature - Terms signature. + Signature *string `json:"signature,omitempty"` + // Accepted - If any version of the terms have been accepted, otherwise false. + Accepted *bool `json:"accepted,omitempty"` +} + +// AgreementResource agreement Terms definition +type AgreementResource struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; The ARM id of the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the agreement. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the agreement. + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource + SystemData *SystemData `json:"systemData,omitempty"` + // AgreementProperties - Represents the properties of the resource. + *AgreementProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for AgreementResource. +func (ar AgreementResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ar.AgreementProperties != nil { + objectMap["properties"] = ar.AgreementProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AgreementResource struct. +func (ar *AgreementResource) 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 "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ar.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ar.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ar.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + ar.SystemData = &systemData + } + case "properties": + if v != nil { + var agreementProperties AgreementProperties + err = json.Unmarshal(*v, &agreementProperties) + if err != nil { + return err + } + ar.AgreementProperties = &agreementProperties + } + } + } + + return nil +} + +// AgreementResourceListResponse response of a list operation. +type AgreementResourceListResponse struct { + autorest.Response `json:"-"` + // Value - Results of a list operation. + Value *[]AgreementResource `json:"value,omitempty"` + // NextLink - Link to the next set of results, if any. + NextLink *string `json:"nextLink,omitempty"` +} + +// AgreementResourceListResponseIterator provides access to a complete listing of AgreementResource values. +type AgreementResourceListResponseIterator struct { + i int + page AgreementResourceListResponsePage +} + +// 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 *AgreementResourceListResponseIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AgreementResourceListResponseIterator.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 *AgreementResourceListResponseIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter AgreementResourceListResponseIterator) 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 AgreementResourceListResponseIterator) Response() AgreementResourceListResponse { + 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 AgreementResourceListResponseIterator) Value() AgreementResource { + if !iter.page.NotDone() { + return AgreementResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the AgreementResourceListResponseIterator type. +func NewAgreementResourceListResponseIterator(page AgreementResourceListResponsePage) AgreementResourceListResponseIterator { + return AgreementResourceListResponseIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (arlr AgreementResourceListResponse) IsEmpty() bool { + return arlr.Value == nil || len(*arlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (arlr AgreementResourceListResponse) hasNextLink() bool { + return arlr.NextLink != nil && len(*arlr.NextLink) != 0 +} + +// agreementResourceListResponsePreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (arlr AgreementResourceListResponse) agreementResourceListResponsePreparer(ctx context.Context) (*http.Request, error) { + if !arlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(arlr.NextLink))) +} + +// AgreementResourceListResponsePage contains a page of AgreementResource values. +type AgreementResourceListResponsePage struct { + fn func(context.Context, AgreementResourceListResponse) (AgreementResourceListResponse, error) + arlr AgreementResourceListResponse +} + +// 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 *AgreementResourceListResponsePage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AgreementResourceListResponsePage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.arlr) + if err != nil { + return err + } + page.arlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + 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 *AgreementResourceListResponsePage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page AgreementResourceListResponsePage) NotDone() bool { + return !page.arlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page AgreementResourceListResponsePage) Response() AgreementResourceListResponse { + return page.arlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page AgreementResourceListResponsePage) Values() []AgreementResource { + if page.arlr.IsEmpty() { + return nil + } + return *page.arlr.Value +} + +// Creates a new instance of the AgreementResourceListResponsePage type. +func NewAgreementResourceListResponsePage(cur AgreementResourceListResponse, getNextPage func(context.Context, AgreementResourceListResponse) (AgreementResourceListResponse, error)) AgreementResourceListResponsePage { + return AgreementResourceListResponsePage{ + fn: getNextPage, + arlr: cur, + } +} + +// ErrorResponseBody response body of Error +type ErrorResponseBody struct { + // Code - READ-ONLY; Error code + Code *string `json:"code,omitempty"` + // Message - READ-ONLY; Error message + Message *string `json:"message,omitempty"` + // Target - READ-ONLY; Error target + Target *string `json:"target,omitempty"` + // Details - READ-ONLY; Error detail + Details *[]ErrorResponseBody `json:"details,omitempty"` +} + +// MarshalJSON is the custom marshaler for ErrorResponseBody. +func (erb ErrorResponseBody) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// OfferDetail confluent Offer detail +type OfferDetail struct { + // PublisherID - Publisher Id + PublisherID *string `json:"publisherId,omitempty"` + // ID - Offer Id + ID *string `json:"id,omitempty"` + // PlanID - Offer Plan Id + PlanID *string `json:"planId,omitempty"` + // PlanName - Offer Plan Name + PlanName *string `json:"planName,omitempty"` + // TermUnit - Offer Plan Term unit + TermUnit *string `json:"termUnit,omitempty"` + // Status - READ-ONLY; SaaS Offer Status. Possible values include: 'SaaSOfferStatusStarted', 'SaaSOfferStatusPendingFulfillmentStart', 'SaaSOfferStatusInProgress', 'SaaSOfferStatusSubscribed', 'SaaSOfferStatusSuspended', 'SaaSOfferStatusReinstated', 'SaaSOfferStatusSucceeded', 'SaaSOfferStatusFailed', 'SaaSOfferStatusUnsubscribed', 'SaaSOfferStatusUpdating' + Status SaaSOfferStatus `json:"status,omitempty"` +} + +// MarshalJSON is the custom marshaler for OfferDetail. +func (od OfferDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if od.PublisherID != nil { + objectMap["publisherId"] = od.PublisherID + } + if od.ID != nil { + objectMap["id"] = od.ID + } + if od.PlanID != nil { + objectMap["planId"] = od.PlanID + } + if od.PlanName != nil { + objectMap["planName"] = od.PlanName + } + if od.TermUnit != nil { + objectMap["termUnit"] = od.TermUnit + } + return json.Marshal(objectMap) +} + +// OperationDisplay the object that represents the operation. +type OperationDisplay struct { + // Provider - Service provider: Microsoft.Confluent + Provider *string `json:"provider,omitempty"` + // Resource - Type on which the operation is performed, e.g., 'clusters'. + Resource *string `json:"resource,omitempty"` + // Operation - Operation type, e.g., read, write, delete, etc. + Operation *string `json:"operation,omitempty"` + // Description - Description of the operation, e.g., 'Write confluent'. + Description *string `json:"description,omitempty"` +} + +// OperationListResult result of GET request to list Confluent operations. +type OperationListResult struct { + autorest.Response `json:"-"` + // Value - List of Confluent operations supported by the Microsoft.Confluent provider. + Value *[]OperationResult `json:"value,omitempty"` + // NextLink - URL to get the next set of operation list results if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// OperationListResultIterator provides access to a complete listing of OperationResult values. +type OperationListResultIterator struct { + i int + page OperationListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *OperationListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter OperationListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter OperationListResultIterator) Response() OperationListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter OperationListResultIterator) Value() OperationResult { + if !iter.page.NotDone() { + return OperationResult{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the OperationListResultIterator type. +func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { + return OperationListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (olr OperationListResult) IsEmpty() bool { + return olr.Value == nil || len(*olr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (olr OperationListResult) hasNextLink() bool { + return olr.NextLink != nil && len(*olr.NextLink) != 0 +} + +// operationListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) { + if !olr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(olr.NextLink))) +} + +// OperationListResultPage contains a page of OperationResult values. +type OperationListResultPage struct { + fn func(context.Context, OperationListResult) (OperationListResult, error) + olr OperationListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.olr) + if err != nil { + return err + } + page.olr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *OperationListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page OperationListResultPage) NotDone() bool { + return !page.olr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page OperationListResultPage) Response() OperationListResult { + return page.olr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page OperationListResultPage) Values() []OperationResult { + if page.olr.IsEmpty() { + return nil + } + return *page.olr.Value +} + +// Creates a new instance of the OperationListResultPage type. +func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { + return OperationListResultPage{ + fn: getNextPage, + olr: cur, + } +} + +// OperationResult an Confluent REST API operation. +type OperationResult struct { + // Name - Operation name: {provider}/{resource}/{operation} + Name *string `json:"name,omitempty"` + // Display - The object that represents the operation. + Display *OperationDisplay `json:"display,omitempty"` + // IsDataAction - Indicates whether the operation is a data action + IsDataAction *bool `json:"isDataAction,omitempty"` +} + +// OrganizationCreateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type OrganizationCreateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(OrganizationClient) (OrganizationResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *OrganizationCreateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for OrganizationCreateFuture.Result. +func (future *OrganizationCreateFuture) result(client OrganizationClient) (or OrganizationResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "confluent.OrganizationCreateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + or.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("confluent.OrganizationCreateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if or.Response.Response, err = future.GetResult(sender); err == nil && or.Response.Response.StatusCode != http.StatusNoContent { + or, err = client.CreateResponder(or.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "confluent.OrganizationCreateFuture", "Result", or.Response.Response, "Failure responding to request") + } + } + return +} + +// OrganizationDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type OrganizationDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(OrganizationClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *OrganizationDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for OrganizationDeleteFuture.Result. +func (future *OrganizationDeleteFuture) result(client OrganizationClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "confluent.OrganizationDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("confluent.OrganizationDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// OrganizationResource organization resource. +type OrganizationResource struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; The ARM id of the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource + SystemData *SystemData `json:"systemData,omitempty"` + // OrganizationResourceProperties - Organization resource properties + *OrganizationResourceProperties `json:"properties,omitempty"` + // Tags - Organization resource tags + Tags map[string]*string `json:"tags"` + // Location - Location of Organization resource + Location *string `json:"location,omitempty"` +} + +// MarshalJSON is the custom marshaler for OrganizationResource. +func (or OrganizationResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if or.OrganizationResourceProperties != nil { + objectMap["properties"] = or.OrganizationResourceProperties + } + if or.Tags != nil { + objectMap["tags"] = or.Tags + } + if or.Location != nil { + objectMap["location"] = or.Location + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for OrganizationResource struct. +func (or *OrganizationResource) 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 "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + or.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + or.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + or.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + or.SystemData = &systemData + } + case "properties": + if v != nil { + var organizationResourceProperties OrganizationResourceProperties + err = json.Unmarshal(*v, &organizationResourceProperties) + if err != nil { + return err + } + or.OrganizationResourceProperties = &organizationResourceProperties + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + or.Tags = tags + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + or.Location = &location + } + } + } + + return nil +} + +// OrganizationResourceListResult the response of a list operation. +type OrganizationResourceListResult struct { + autorest.Response `json:"-"` + // Value - Result of a list operation. + Value *[]OrganizationResource `json:"value,omitempty"` + // NextLink - Link to the next set of results, if any. + NextLink *string `json:"nextLink,omitempty"` +} + +// OrganizationResourceListResultIterator provides access to a complete listing of OrganizationResource +// values. +type OrganizationResourceListResultIterator struct { + i int + page OrganizationResourceListResultPage +} + +// 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 *OrganizationResourceListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OrganizationResourceListResultIterator.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 *OrganizationResourceListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter OrganizationResourceListResultIterator) 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 OrganizationResourceListResultIterator) Response() OrganizationResourceListResult { + 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 OrganizationResourceListResultIterator) Value() OrganizationResource { + if !iter.page.NotDone() { + return OrganizationResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the OrganizationResourceListResultIterator type. +func NewOrganizationResourceListResultIterator(page OrganizationResourceListResultPage) OrganizationResourceListResultIterator { + return OrganizationResourceListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (orlr OrganizationResourceListResult) IsEmpty() bool { + return orlr.Value == nil || len(*orlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (orlr OrganizationResourceListResult) hasNextLink() bool { + return orlr.NextLink != nil && len(*orlr.NextLink) != 0 +} + +// organizationResourceListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (orlr OrganizationResourceListResult) organizationResourceListResultPreparer(ctx context.Context) (*http.Request, error) { + if !orlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(orlr.NextLink))) +} + +// OrganizationResourceListResultPage contains a page of OrganizationResource values. +type OrganizationResourceListResultPage struct { + fn func(context.Context, OrganizationResourceListResult) (OrganizationResourceListResult, error) + orlr OrganizationResourceListResult +} + +// 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 *OrganizationResourceListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OrganizationResourceListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.orlr) + if err != nil { + return err + } + page.orlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + 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 *OrganizationResourceListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page OrganizationResourceListResultPage) NotDone() bool { + return !page.orlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page OrganizationResourceListResultPage) Response() OrganizationResourceListResult { + return page.orlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page OrganizationResourceListResultPage) Values() []OrganizationResource { + if page.orlr.IsEmpty() { + return nil + } + return *page.orlr.Value +} + +// Creates a new instance of the OrganizationResourceListResultPage type. +func NewOrganizationResourceListResultPage(cur OrganizationResourceListResult, getNextPage func(context.Context, OrganizationResourceListResult) (OrganizationResourceListResult, error)) OrganizationResourceListResultPage { + return OrganizationResourceListResultPage{ + fn: getNextPage, + orlr: cur, + } +} + +// OrganizationResourceProperties organization resource property +type OrganizationResourceProperties struct { + // CreatedTime - READ-ONLY; The creation time of the resource. + CreatedTime *date.Time `json:"createdTime,omitempty"` + // ProvisioningState - READ-ONLY; Provision states for confluent RP. Possible values include: 'Accepted', 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled', 'Deleted', 'NotSpecified' + ProvisioningState ProvisionState `json:"provisioningState,omitempty"` + // OrganizationID - READ-ONLY; Id of the Confluent organization. + OrganizationID *string `json:"organizationId,omitempty"` + // SsoURL - READ-ONLY; SSO url for the Confluent organization. + SsoURL *string `json:"ssoUrl,omitempty"` + // OfferDetail - Confluent offer detail + OfferDetail *OfferDetail `json:"offerDetail,omitempty"` + // UserDetail - Subscriber detail + UserDetail *UserDetail `json:"userDetail,omitempty"` +} + +// MarshalJSON is the custom marshaler for OrganizationResourceProperties. +func (orp OrganizationResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if orp.OfferDetail != nil { + objectMap["offerDetail"] = orp.OfferDetail + } + if orp.UserDetail != nil { + objectMap["userDetail"] = orp.UserDetail + } + return json.Marshal(objectMap) +} + +// OrganizationResourceUpdate organization Resource update +type OrganizationResourceUpdate struct { + // Tags - ARM resource tags + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for OrganizationResourceUpdate. +func (oru OrganizationResourceUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if oru.Tags != nil { + objectMap["tags"] = oru.Tags + } + return json.Marshal(objectMap) +} + +// ResourceProviderDefaultErrorResponse default error response for resource provider +type ResourceProviderDefaultErrorResponse struct { + // Error - READ-ONLY; Response body of Error + Error *ErrorResponseBody `json:"error,omitempty"` +} + +// MarshalJSON is the custom marshaler for ResourceProviderDefaultErrorResponse. +func (rpder ResourceProviderDefaultErrorResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// SystemData metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // CreatedBy - The identity that created the resource. + CreatedBy *string `json:"createdBy,omitempty"` + // CreatedByType - The type of identity that created the resource. Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' + CreatedByType CreatedByType `json:"createdByType,omitempty"` + // CreatedAt - The timestamp of resource creation (UTC). + CreatedAt *date.Time `json:"createdAt,omitempty"` + // LastModifiedBy - The identity that last modified the resource. + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + // LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' + LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"` + // LastModifiedAt - The timestamp of resource last modification (UTC) + LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` +} + +// UserDetail subscriber detail +type UserDetail struct { + // FirstName - First name + FirstName *string `json:"firstName,omitempty"` + // LastName - Last name + LastName *string `json:"lastName,omitempty"` + // EmailAddress - Email address + EmailAddress *string `json:"emailAddress,omitempty"` +} diff --git a/services/confluent/mgmt/2021-12-01/confluent/organization.go b/services/confluent/mgmt/2021-12-01/confluent/organization.go new file mode 100644 index 000000000000..5e44b4e131ce --- /dev/null +++ b/services/confluent/mgmt/2021-12-01/confluent/organization.go @@ -0,0 +1,615 @@ +package confluent + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// 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" +) + +// OrganizationClient is the client for the Organization methods of the Confluent service. +type OrganizationClient struct { + BaseClient +} + +// NewOrganizationClient creates an instance of the OrganizationClient client. +func NewOrganizationClient(subscriptionID string) OrganizationClient { + return NewOrganizationClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOrganizationClientWithBaseURI creates an instance of the OrganizationClient client using a custom endpoint. Use +// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewOrganizationClientWithBaseURI(baseURI string, subscriptionID string) OrganizationClient { + return OrganizationClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create sends the create request. +// Parameters: +// resourceGroupName - resource group name +// organizationName - organization resource name +// body - organization resource model +func (client OrganizationClient) Create(ctx context.Context, resourceGroupName string, organizationName string, body *OrganizationResource) (result OrganizationCreateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OrganizationClient.Create") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: body, + Constraints: []validation.Constraint{{Target: "body", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.OrganizationResourceProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "body.OrganizationResourceProperties.OfferDetail", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "body.OrganizationResourceProperties.OfferDetail.PublisherID", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "body.OrganizationResourceProperties.OfferDetail.PublisherID", Name: validation.MaxLength, Rule: 50, Chain: nil}}}, + {Target: "body.OrganizationResourceProperties.OfferDetail.ID", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "body.OrganizationResourceProperties.OfferDetail.ID", Name: validation.MaxLength, Rule: 50, Chain: nil}}}, + {Target: "body.OrganizationResourceProperties.OfferDetail.PlanID", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "body.OrganizationResourceProperties.OfferDetail.PlanID", Name: validation.MaxLength, Rule: 50, Chain: nil}}}, + {Target: "body.OrganizationResourceProperties.OfferDetail.PlanName", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "body.OrganizationResourceProperties.OfferDetail.PlanName", Name: validation.MaxLength, Rule: 50, Chain: nil}}}, + {Target: "body.OrganizationResourceProperties.OfferDetail.TermUnit", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "body.OrganizationResourceProperties.OfferDetail.TermUnit", Name: validation.MaxLength, Rule: 25, Chain: nil}}}, + }}, + {Target: "body.OrganizationResourceProperties.UserDetail", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "body.OrganizationResourceProperties.UserDetail.FirstName", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.OrganizationResourceProperties.UserDetail.FirstName", Name: validation.MaxLength, Rule: 50, Chain: nil}}}, + {Target: "body.OrganizationResourceProperties.UserDetail.LastName", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.OrganizationResourceProperties.UserDetail.LastName", Name: validation.MaxLength, Rule: 50, Chain: nil}}}, + {Target: "body.OrganizationResourceProperties.UserDetail.EmailAddress", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "body.OrganizationResourceProperties.UserDetail.EmailAddress", Name: validation.Pattern, Rule: `^\S+@\S+\.\S+$`, Chain: nil}}}, + }}, + }}, + }}}}}); err != nil { + return result, validation.NewError("confluent.OrganizationClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, organizationName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "confluent.OrganizationClient", "Create", nil, "Failure preparing request") + return + } + + result, err = client.CreateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "confluent.OrganizationClient", "Create", result.Response(), "Failure sending request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client OrganizationClient) CreatePreparer(ctx context.Context, resourceGroupName string, organizationName string, body *OrganizationResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "organizationName": autorest.Encode("path", organizationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + body.ID = nil + body.Name = nil + body.Type = nil + body.SystemData = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations/{organizationName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if body != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(body)) + } + 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 OrganizationClient) CreateSender(req *http.Request) (future OrganizationCreateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client OrganizationClient) CreateResponder(resp *http.Response) (result OrganizationResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete sends the delete request. +// Parameters: +// resourceGroupName - resource group name +// organizationName - organization resource name +func (client OrganizationClient) Delete(ctx context.Context, resourceGroupName string, organizationName string) (result OrganizationDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OrganizationClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, organizationName) + if err != nil { + err = autorest.NewErrorWithError(err, "confluent.OrganizationClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "confluent.OrganizationClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client OrganizationClient) DeletePreparer(ctx context.Context, resourceGroupName string, organizationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "organizationName": autorest.Encode("path", organizationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-12-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.Confluent/organizations/{organizationName}", 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 OrganizationClient) DeleteSender(req *http.Request) (future OrganizationDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client OrganizationClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get sends the get request. +// Parameters: +// resourceGroupName - resource group name +// organizationName - organization resource name +func (client OrganizationClient) Get(ctx context.Context, resourceGroupName string, organizationName string) (result OrganizationResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OrganizationClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, organizationName) + if err != nil { + err = autorest.NewErrorWithError(err, "confluent.OrganizationClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "confluent.OrganizationClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "confluent.OrganizationClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client OrganizationClient) GetPreparer(ctx context.Context, resourceGroupName string, organizationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "organizationName": autorest.Encode("path", organizationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-12-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.Confluent/organizations/{organizationName}", 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 OrganizationClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client OrganizationClient) GetResponder(resp *http.Response) (result OrganizationResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroup sends the list by resource group request. +// Parameters: +// resourceGroupName - resource group name +func (client OrganizationClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result OrganizationResourceListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OrganizationClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.orlr.Response.Response != nil { + sc = result.orlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "confluent.OrganizationClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.orlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "confluent.OrganizationClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.orlr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "confluent.OrganizationClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.orlr.hasNextLink() && result.orlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client OrganizationClient) 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 = "2021-12-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.Confluent/organizations", 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 OrganizationClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client OrganizationClient) ListByResourceGroupResponder(resp *http.Response) (result OrganizationResourceListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client OrganizationClient) listByResourceGroupNextResults(ctx context.Context, lastResults OrganizationResourceListResult) (result OrganizationResourceListResult, err error) { + req, err := lastResults.organizationResourceListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "confluent.OrganizationClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "confluent.OrganizationClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "confluent.OrganizationClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client OrganizationClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result OrganizationResourceListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OrganizationClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) + return +} + +// ListBySubscription sends the list by subscription request. +func (client OrganizationClient) ListBySubscription(ctx context.Context) (result OrganizationResourceListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OrganizationClient.ListBySubscription") + defer func() { + sc := -1 + if result.orlr.Response.Response != nil { + sc = result.orlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listBySubscriptionNextResults + req, err := client.ListBySubscriptionPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "confluent.OrganizationClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.orlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "confluent.OrganizationClient", "ListBySubscription", resp, "Failure sending request") + return + } + + result.orlr, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "confluent.OrganizationClient", "ListBySubscription", resp, "Failure responding to request") + return + } + if result.orlr.hasNextLink() && result.orlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListBySubscriptionPreparer prepares the ListBySubscription request. +func (client OrganizationClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Confluent/organizations", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListBySubscriptionSender sends the ListBySubscription request. The method will close the +// http.Response Body if it receives an error. +func (client OrganizationClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (client OrganizationClient) ListBySubscriptionResponder(resp *http.Response) (result OrganizationResourceListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listBySubscriptionNextResults retrieves the next set of results, if any. +func (client OrganizationClient) listBySubscriptionNextResults(ctx context.Context, lastResults OrganizationResourceListResult) (result OrganizationResourceListResult, err error) { + req, err := lastResults.organizationResourceListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "confluent.OrganizationClient", "listBySubscriptionNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "confluent.OrganizationClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") + } + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "confluent.OrganizationClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. +func (client OrganizationClient) ListBySubscriptionComplete(ctx context.Context) (result OrganizationResourceListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OrganizationClient.ListBySubscription") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListBySubscription(ctx) + return +} + +// Update sends the update request. +// Parameters: +// resourceGroupName - resource group name +// organizationName - organization resource name +// body - updated Organization resource +func (client OrganizationClient) Update(ctx context.Context, resourceGroupName string, organizationName string, body *OrganizationResourceUpdate) (result OrganizationResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OrganizationClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, organizationName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "confluent.OrganizationClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "confluent.OrganizationClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "confluent.OrganizationClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client OrganizationClient) UpdatePreparer(ctx context.Context, resourceGroupName string, organizationName string, body *OrganizationResourceUpdate) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "organizationName": autorest.Encode("path", organizationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-12-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.Confluent/organizations/{organizationName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if body != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(body)) + } + 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 OrganizationClient) UpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client OrganizationClient) UpdateResponder(resp *http.Response) (result OrganizationResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/confluent/mgmt/2021-12-01/confluent/organizationoperations.go b/services/confluent/mgmt/2021-12-01/confluent/organizationoperations.go new file mode 100644 index 000000000000..d1d4206f9a70 --- /dev/null +++ b/services/confluent/mgmt/2021-12-01/confluent/organizationoperations.go @@ -0,0 +1,141 @@ +package confluent + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// 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" +) + +// OrganizationOperationsClient is the client for the OrganizationOperations methods of the Confluent service. +type OrganizationOperationsClient struct { + BaseClient +} + +// NewOrganizationOperationsClient creates an instance of the OrganizationOperationsClient client. +func NewOrganizationOperationsClient(subscriptionID string) OrganizationOperationsClient { + return NewOrganizationOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOrganizationOperationsClientWithBaseURI creates an instance of the OrganizationOperationsClient client using a +// custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, +// Azure stack). +func NewOrganizationOperationsClientWithBaseURI(baseURI string, subscriptionID string) OrganizationOperationsClient { + return OrganizationOperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List sends the list request. +func (client OrganizationOperationsClient) List(ctx context.Context) (result OperationListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OrganizationOperationsClient.List") + defer func() { + sc := -1 + if result.olr.Response.Response != nil { + sc = result.olr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "confluent.OrganizationOperationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.olr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "confluent.OrganizationOperationsClient", "List", resp, "Failure sending request") + return + } + + result.olr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "confluent.OrganizationOperationsClient", "List", resp, "Failure responding to request") + return + } + if result.olr.hasNextLink() && result.olr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client OrganizationOperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2021-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.Confluent/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 OrganizationOperationsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(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 OrganizationOperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { + err = autorest.Respond( + resp, + 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 OrganizationOperationsClient) listNextResults(ctx context.Context, lastResults OperationListResult) (result OperationListResult, err error) { + req, err := lastResults.operationListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "confluent.OrganizationOperationsClient", "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, "confluent.OrganizationOperationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "confluent.OrganizationOperationsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client OrganizationOperationsClient) ListComplete(ctx context.Context) (result OperationListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OrganizationOperationsClient.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/confluent/mgmt/2021-12-01/confluent/validations.go b/services/confluent/mgmt/2021-12-01/confluent/validations.go new file mode 100644 index 000000000000..2ba756f3182d --- /dev/null +++ b/services/confluent/mgmt/2021-12-01/confluent/validations.go @@ -0,0 +1,142 @@ +package confluent + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// 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" +) + +// ValidationsClient is the client for the Validations methods of the Confluent service. +type ValidationsClient struct { + BaseClient +} + +// NewValidationsClient creates an instance of the ValidationsClient client. +func NewValidationsClient(subscriptionID string) ValidationsClient { + return NewValidationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewValidationsClientWithBaseURI creates an instance of the ValidationsClient client using a custom endpoint. Use +// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewValidationsClientWithBaseURI(baseURI string, subscriptionID string) ValidationsClient { + return ValidationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// ValidateOrganization sends the validate organization request. +// Parameters: +// resourceGroupName - resource group name +// organizationName - organization resource name +// body - organization resource model +func (client ValidationsClient) ValidateOrganization(ctx context.Context, resourceGroupName string, organizationName string, body OrganizationResource) (result OrganizationResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ValidationsClient.ValidateOrganization") + 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: body, + Constraints: []validation.Constraint{{Target: "body.OrganizationResourceProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "body.OrganizationResourceProperties.OfferDetail", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "body.OrganizationResourceProperties.OfferDetail.PublisherID", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "body.OrganizationResourceProperties.OfferDetail.PublisherID", Name: validation.MaxLength, Rule: 50, Chain: nil}}}, + {Target: "body.OrganizationResourceProperties.OfferDetail.ID", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "body.OrganizationResourceProperties.OfferDetail.ID", Name: validation.MaxLength, Rule: 50, Chain: nil}}}, + {Target: "body.OrganizationResourceProperties.OfferDetail.PlanID", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "body.OrganizationResourceProperties.OfferDetail.PlanID", Name: validation.MaxLength, Rule: 50, Chain: nil}}}, + {Target: "body.OrganizationResourceProperties.OfferDetail.PlanName", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "body.OrganizationResourceProperties.OfferDetail.PlanName", Name: validation.MaxLength, Rule: 50, Chain: nil}}}, + {Target: "body.OrganizationResourceProperties.OfferDetail.TermUnit", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "body.OrganizationResourceProperties.OfferDetail.TermUnit", Name: validation.MaxLength, Rule: 25, Chain: nil}}}, + }}, + {Target: "body.OrganizationResourceProperties.UserDetail", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "body.OrganizationResourceProperties.UserDetail.FirstName", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.OrganizationResourceProperties.UserDetail.FirstName", Name: validation.MaxLength, Rule: 50, Chain: nil}}}, + {Target: "body.OrganizationResourceProperties.UserDetail.LastName", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.OrganizationResourceProperties.UserDetail.LastName", Name: validation.MaxLength, Rule: 50, Chain: nil}}}, + {Target: "body.OrganizationResourceProperties.UserDetail.EmailAddress", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "body.OrganizationResourceProperties.UserDetail.EmailAddress", Name: validation.Pattern, Rule: `^\S+@\S+\.\S+$`, Chain: nil}}}, + }}, + }}}}}); err != nil { + return result, validation.NewError("confluent.ValidationsClient", "ValidateOrganization", err.Error()) + } + + req, err := client.ValidateOrganizationPreparer(ctx, resourceGroupName, organizationName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "confluent.ValidationsClient", "ValidateOrganization", nil, "Failure preparing request") + return + } + + resp, err := client.ValidateOrganizationSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "confluent.ValidationsClient", "ValidateOrganization", resp, "Failure sending request") + return + } + + result, err = client.ValidateOrganizationResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "confluent.ValidationsClient", "ValidateOrganization", resp, "Failure responding to request") + return + } + + return +} + +// ValidateOrganizationPreparer prepares the ValidateOrganization request. +func (client ValidationsClient) ValidateOrganizationPreparer(ctx context.Context, resourceGroupName string, organizationName string, body OrganizationResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "organizationName": autorest.Encode("path", organizationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + body.ID = nil + body.Name = nil + body.Type = nil + body.SystemData = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/validations/{organizationName}/orgvalidate", pathParameters), + autorest.WithJSON(body), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ValidateOrganizationSender sends the ValidateOrganization request. The method will close the +// http.Response Body if it receives an error. +func (client ValidationsClient) ValidateOrganizationSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ValidateOrganizationResponder handles the response to the ValidateOrganization request. The method always +// closes the http.Response Body. +func (client ValidationsClient) ValidateOrganizationResponder(resp *http.Response) (result OrganizationResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/confluent/mgmt/2021-12-01/confluent/version.go b/services/confluent/mgmt/2021-12-01/confluent/version.go new file mode 100644 index 000000000000..3421325ce740 --- /dev/null +++ b/services/confluent/mgmt/2021-12-01/confluent/version.go @@ -0,0 +1,19 @@ +package confluent + +import "github.com/Azure/azure-sdk-for-go/version" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// 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() + " confluent/2021-12-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +} diff --git a/services/preview/confluent/mgmt/2020-03-01-preview/confluent/CHANGELOG.md b/services/preview/confluent/mgmt/2020-03-01-preview/confluent/CHANGELOG.md index 52911e4cc5e4..2ca2c80e7869 100644 --- a/services/preview/confluent/mgmt/2020-03-01-preview/confluent/CHANGELOG.md +++ b/services/preview/confluent/mgmt/2020-03-01-preview/confluent/CHANGELOG.md @@ -1,2 +1,24 @@ -# Change History +# Unreleased +## Breaking Changes + +### Struct Changes + +#### Removed Struct Fields + +1. AgreementResource.Properties + +## Additive Changes + +### New Funcs + +1. *AgreementResource.UnmarshalJSON([]byte) error +1. OfferDetail.MarshalJSON() ([]byte, error) +1. OrganizationResourcePropertiesOfferDetail.MarshalJSON() ([]byte, error) + +### Struct Changes + +#### New Struct Fields + +1. AgreementResource.*AgreementProperties +1. OperationResult.IsDataAction diff --git a/services/preview/confluent/mgmt/2020-03-01-preview/confluent/_meta.json b/services/preview/confluent/mgmt/2020-03-01-preview/confluent/_meta.json index de527ab81ddb..0c45523c5fd1 100644 --- a/services/preview/confluent/mgmt/2020-03-01-preview/confluent/_meta.json +++ b/services/preview/confluent/mgmt/2020-03-01-preview/confluent/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "49312ea7188eb199e29f91a80bd65b35033945c5", "readme": "/_/azure-rest-api-specs/specification/confluent/resource-manager/readme.md", "tag": "package-2020-03-01-preview", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/preview/confluent/mgmt/2020-03-01-preview/confluent/marketplaceagreements.go b/services/preview/confluent/mgmt/2020-03-01-preview/confluent/marketplaceagreements.go index a28da103173b..6e2e50d21902 100644 --- a/services/preview/confluent/mgmt/2020-03-01-preview/confluent/marketplaceagreements.go +++ b/services/preview/confluent/mgmt/2020-03-01-preview/confluent/marketplaceagreements.go @@ -32,6 +32,8 @@ func NewMarketplaceAgreementsClientWithBaseURI(baseURI string, subscriptionID st } // Create sends the create request. +// Parameters: +// body - confluent Marketplace Agreement resource func (client MarketplaceAgreementsClient) Create(ctx context.Context, body *AgreementResource) (result AgreementResource, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/MarketplaceAgreementsClient.Create") @@ -71,6 +73,11 @@ func (client MarketplaceAgreementsClient) CreatePreparer(ctx context.Context, bo "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2020-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + body.ID = nil body.Name = nil body.Type = nil @@ -78,7 +85,8 @@ func (client MarketplaceAgreementsClient) CreatePreparer(ctx context.Context, bo autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPut(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Confluent/agreements/default", pathParameters)) + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Confluent/agreements/default", pathParameters), + autorest.WithQueryParameters(queryParameters)) if body != nil { preparer = autorest.DecoratePreparer(preparer, autorest.WithJSON(body)) @@ -149,10 +157,16 @@ func (client MarketplaceAgreementsClient) ListPreparer(ctx context.Context) (*ht "subscriptionId": autorest.Encode("path", client.SubscriptionID), } + const APIVersion = "2020-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Confluent/agreements", pathParameters)) + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Confluent/agreements", pathParameters), + autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } diff --git a/services/preview/confluent/mgmt/2020-03-01-preview/confluent/models.go b/services/preview/confluent/mgmt/2020-03-01-preview/confluent/models.go index 51b8dd037932..0e85783183dc 100644 --- a/services/preview/confluent/mgmt/2020-03-01-preview/confluent/models.go +++ b/services/preview/confluent/mgmt/2020-03-01-preview/confluent/models.go @@ -49,20 +49,71 @@ type AgreementResource struct { Name *string `json:"name,omitempty"` // Type - READ-ONLY; The type of the agreement. Type *string `json:"type,omitempty"` - // Properties - Represents the properties of the resource. - Properties *AgreementProperties `json:"properties,omitempty"` + // AgreementProperties - Represents the properties of the resource. + *AgreementProperties `json:"properties,omitempty"` } // MarshalJSON is the custom marshaler for AgreementResource. func (ar AgreementResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if ar.Properties != nil { - objectMap["properties"] = ar.Properties + if ar.AgreementProperties != nil { + objectMap["properties"] = ar.AgreementProperties } return json.Marshal(objectMap) } -// AgreementResourceListResponse response of a agreements operation. +// UnmarshalJSON is the custom unmarshaler for AgreementResource struct. +func (ar *AgreementResource) 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 "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ar.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ar.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ar.Type = &typeVar + } + case "properties": + if v != nil { + var agreementProperties AgreementProperties + err = json.Unmarshal(*v, &agreementProperties) + if err != nil { + return err + } + ar.AgreementProperties = &agreementProperties + } + } + } + + return nil +} + +// AgreementResourceListResponse response of a list operation. type AgreementResourceListResponse struct { autorest.Response `json:"-"` // Value - Results of a list operation. @@ -251,10 +302,31 @@ type OfferDetail struct { PlanName *string `json:"planName,omitempty"` // TermUnit - Offer Plan Term unit TermUnit *string `json:"termUnit,omitempty"` - // Status - SaaS Offer Status. Possible values include: 'SaaSOfferStatusStarted', 'SaaSOfferStatusPendingFulfillmentStart', 'SaaSOfferStatusInProgress', 'SaaSOfferStatusSubscribed', 'SaaSOfferStatusSuspended', 'SaaSOfferStatusReinstated', 'SaaSOfferStatusSucceeded', 'SaaSOfferStatusFailed', 'SaaSOfferStatusUnsubscribed', 'SaaSOfferStatusUpdating' + // Status - READ-ONLY; SaaS Offer Status. Possible values include: 'SaaSOfferStatusStarted', 'SaaSOfferStatusPendingFulfillmentStart', 'SaaSOfferStatusInProgress', 'SaaSOfferStatusSubscribed', 'SaaSOfferStatusSuspended', 'SaaSOfferStatusReinstated', 'SaaSOfferStatusSucceeded', 'SaaSOfferStatusFailed', 'SaaSOfferStatusUnsubscribed', 'SaaSOfferStatusUpdating' Status SaaSOfferStatus `json:"status,omitempty"` } +// MarshalJSON is the custom marshaler for OfferDetail. +func (od OfferDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if od.PublisherID != nil { + objectMap["publisherId"] = od.PublisherID + } + if od.ID != nil { + objectMap["id"] = od.ID + } + if od.PlanID != nil { + objectMap["planId"] = od.PlanID + } + if od.PlanName != nil { + objectMap["planName"] = od.PlanName + } + if od.TermUnit != nil { + objectMap["termUnit"] = od.TermUnit + } + return json.Marshal(objectMap) +} + // OperationDisplay the object that represents the operation. type OperationDisplay struct { // Provider - Service provider: Microsoft.Confluent @@ -432,6 +504,8 @@ type OperationResult struct { Name *string `json:"name,omitempty"` // Display - The object that represents the operation. Display *OperationDisplay `json:"display,omitempty"` + // IsDataAction - Indicates whether the operation is a data action + IsDataAction *bool `json:"isDataAction,omitempty"` } // OrganizationCreateFuture an abstraction for monitoring and retrieving the results of a long-running @@ -779,7 +853,7 @@ func NewOrganizationResourceListResultPage(cur OrganizationResourceListResult, g type OrganizationResourceProperties struct { // CreatedTime - READ-ONLY; The creation time of the resource. CreatedTime *date.Time `json:"createdTime,omitempty"` - // ProvisioningState - Provision states for confluent RP. Possible values include: 'Accepted', 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled', 'Deleted', 'NotSpecified' + // ProvisioningState - READ-ONLY; Provision states for confluent RP. Possible values include: 'Accepted', 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled', 'Deleted', 'NotSpecified' ProvisioningState ProvisionState `json:"provisioningState,omitempty"` // OrganizationID - READ-ONLY; Id of the Confluent organization. OrganizationID *string `json:"organizationId,omitempty"` @@ -794,9 +868,6 @@ type OrganizationResourceProperties struct { // MarshalJSON is the custom marshaler for OrganizationResourceProperties. func (orp OrganizationResourceProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if orp.ProvisioningState != "" { - objectMap["provisioningState"] = orp.ProvisioningState - } if orp.OfferDetail != nil { objectMap["offerDetail"] = orp.OfferDetail } @@ -810,7 +881,7 @@ func (orp OrganizationResourceProperties) MarshalJSON() ([]byte, error) { type OrganizationResourcePropertiesModel struct { // CreatedTime - READ-ONLY; The creation time of the resource. CreatedTime *date.Time `json:"createdTime,omitempty"` - // ProvisioningState - Provision states for confluent RP. Possible values include: 'Accepted', 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled', 'Deleted', 'NotSpecified' + // ProvisioningState - READ-ONLY; Provision states for confluent RP. Possible values include: 'Accepted', 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled', 'Deleted', 'NotSpecified' ProvisioningState ProvisionState `json:"provisioningState,omitempty"` // OrganizationID - READ-ONLY; Id of the Confluent organization. OrganizationID *string `json:"organizationId,omitempty"` @@ -825,9 +896,6 @@ type OrganizationResourcePropertiesModel struct { // MarshalJSON is the custom marshaler for OrganizationResourcePropertiesModel. func (orpm OrganizationResourcePropertiesModel) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if orpm.ProvisioningState != "" { - objectMap["provisioningState"] = orpm.ProvisioningState - } if orpm.OfferDetail != nil { objectMap["offerDetail"] = orpm.OfferDetail } @@ -849,10 +917,31 @@ type OrganizationResourcePropertiesOfferDetail struct { PlanName *string `json:"planName,omitempty"` // TermUnit - Offer Plan Term unit TermUnit *string `json:"termUnit,omitempty"` - // Status - SaaS Offer Status. Possible values include: 'SaaSOfferStatusStarted', 'SaaSOfferStatusPendingFulfillmentStart', 'SaaSOfferStatusInProgress', 'SaaSOfferStatusSubscribed', 'SaaSOfferStatusSuspended', 'SaaSOfferStatusReinstated', 'SaaSOfferStatusSucceeded', 'SaaSOfferStatusFailed', 'SaaSOfferStatusUnsubscribed', 'SaaSOfferStatusUpdating' + // Status - READ-ONLY; SaaS Offer Status. Possible values include: 'SaaSOfferStatusStarted', 'SaaSOfferStatusPendingFulfillmentStart', 'SaaSOfferStatusInProgress', 'SaaSOfferStatusSubscribed', 'SaaSOfferStatusSuspended', 'SaaSOfferStatusReinstated', 'SaaSOfferStatusSucceeded', 'SaaSOfferStatusFailed', 'SaaSOfferStatusUnsubscribed', 'SaaSOfferStatusUpdating' Status SaaSOfferStatus `json:"status,omitempty"` } +// MarshalJSON is the custom marshaler for OrganizationResourcePropertiesOfferDetail. +func (orpD OrganizationResourcePropertiesOfferDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if orpD.PublisherID != nil { + objectMap["publisherId"] = orpD.PublisherID + } + if orpD.ID != nil { + objectMap["id"] = orpD.ID + } + if orpD.PlanID != nil { + objectMap["planId"] = orpD.PlanID + } + if orpD.PlanName != nil { + objectMap["planName"] = orpD.PlanName + } + if orpD.TermUnit != nil { + objectMap["termUnit"] = orpD.TermUnit + } + return json.Marshal(objectMap) +} + // OrganizationResourcePropertiesUserDetail subscriber detail type OrganizationResourcePropertiesUserDetail struct { // FirstName - First name diff --git a/services/preview/confluent/mgmt/2021-03-01-preview/confluent/CHANGELOG.md b/services/preview/confluent/mgmt/2021-03-01-preview/confluent/CHANGELOG.md index 52911e4cc5e4..3b2ed138052f 100644 --- a/services/preview/confluent/mgmt/2021-03-01-preview/confluent/CHANGELOG.md +++ b/services/preview/confluent/mgmt/2021-03-01-preview/confluent/CHANGELOG.md @@ -1,2 +1,7 @@ -# Change History +# Unreleased +## Additive Changes + +### New Funcs + +1. OfferDetail.MarshalJSON() ([]byte, error) diff --git a/services/preview/confluent/mgmt/2021-03-01-preview/confluent/_meta.json b/services/preview/confluent/mgmt/2021-03-01-preview/confluent/_meta.json index 4809a17efdee..7a2dbe3902bf 100644 --- a/services/preview/confluent/mgmt/2021-03-01-preview/confluent/_meta.json +++ b/services/preview/confluent/mgmt/2021-03-01-preview/confluent/_meta.json @@ -1,5 +1,5 @@ { - "commit": "6300f518091891b00c993e538dc2d282c9b814de", + "commit": "49312ea7188eb199e29f91a80bd65b35033945c5", "readme": "/_/azure-rest-api-specs/specification/confluent/resource-manager/readme.md", "tag": "package-2021-03-01-preview", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/preview/confluent/mgmt/2021-03-01-preview/confluent/models.go b/services/preview/confluent/mgmt/2021-03-01-preview/confluent/models.go index 6e8da5bf5ea1..654fb24107c2 100644 --- a/services/preview/confluent/mgmt/2021-03-01-preview/confluent/models.go +++ b/services/preview/confluent/mgmt/2021-03-01-preview/confluent/models.go @@ -313,10 +313,31 @@ type OfferDetail struct { PlanName *string `json:"planName,omitempty"` // TermUnit - Offer Plan Term unit TermUnit *string `json:"termUnit,omitempty"` - // Status - SaaS Offer Status. Possible values include: 'SaaSOfferStatusStarted', 'SaaSOfferStatusPendingFulfillmentStart', 'SaaSOfferStatusInProgress', 'SaaSOfferStatusSubscribed', 'SaaSOfferStatusSuspended', 'SaaSOfferStatusReinstated', 'SaaSOfferStatusSucceeded', 'SaaSOfferStatusFailed', 'SaaSOfferStatusUnsubscribed', 'SaaSOfferStatusUpdating' + // Status - READ-ONLY; SaaS Offer Status. Possible values include: 'SaaSOfferStatusStarted', 'SaaSOfferStatusPendingFulfillmentStart', 'SaaSOfferStatusInProgress', 'SaaSOfferStatusSubscribed', 'SaaSOfferStatusSuspended', 'SaaSOfferStatusReinstated', 'SaaSOfferStatusSucceeded', 'SaaSOfferStatusFailed', 'SaaSOfferStatusUnsubscribed', 'SaaSOfferStatusUpdating' Status SaaSOfferStatus `json:"status,omitempty"` } +// MarshalJSON is the custom marshaler for OfferDetail. +func (od OfferDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if od.PublisherID != nil { + objectMap["publisherId"] = od.PublisherID + } + if od.ID != nil { + objectMap["id"] = od.ID + } + if od.PlanID != nil { + objectMap["planId"] = od.PlanID + } + if od.PlanName != nil { + objectMap["planName"] = od.PlanName + } + if od.TermUnit != nil { + objectMap["termUnit"] = od.TermUnit + } + return json.Marshal(objectMap) +} + // OperationDisplay the object that represents the operation. type OperationDisplay struct { // Provider - Service provider: Microsoft.Confluent diff --git a/services/preview/confluent/mgmt/2021-09-01-preview/confluent/CHANGELOG.md b/services/preview/confluent/mgmt/2021-09-01-preview/confluent/CHANGELOG.md index 52911e4cc5e4..3b2ed138052f 100644 --- a/services/preview/confluent/mgmt/2021-09-01-preview/confluent/CHANGELOG.md +++ b/services/preview/confluent/mgmt/2021-09-01-preview/confluent/CHANGELOG.md @@ -1,2 +1,7 @@ -# Change History +# Unreleased +## Additive Changes + +### New Funcs + +1. OfferDetail.MarshalJSON() ([]byte, error) diff --git a/services/preview/confluent/mgmt/2021-09-01-preview/confluent/_meta.json b/services/preview/confluent/mgmt/2021-09-01-preview/confluent/_meta.json index 6bb2b7e7d74c..91afbb260b18 100644 --- a/services/preview/confluent/mgmt/2021-09-01-preview/confluent/_meta.json +++ b/services/preview/confluent/mgmt/2021-09-01-preview/confluent/_meta.json @@ -1,5 +1,5 @@ { - "commit": "4946dbb5b2893a77ce52d08e2a855056e1acd361", + "commit": "49312ea7188eb199e29f91a80bd65b35033945c5", "readme": "/_/azure-rest-api-specs/specification/confluent/resource-manager/readme.md", "tag": "package-preview-2021-09", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/preview/confluent/mgmt/2021-09-01-preview/confluent/models.go b/services/preview/confluent/mgmt/2021-09-01-preview/confluent/models.go index 59f2a4795f8d..407c33604b05 100644 --- a/services/preview/confluent/mgmt/2021-09-01-preview/confluent/models.go +++ b/services/preview/confluent/mgmt/2021-09-01-preview/confluent/models.go @@ -313,10 +313,31 @@ type OfferDetail struct { PlanName *string `json:"planName,omitempty"` // TermUnit - Offer Plan Term unit TermUnit *string `json:"termUnit,omitempty"` - // Status - SaaS Offer Status. Possible values include: 'SaaSOfferStatusStarted', 'SaaSOfferStatusPendingFulfillmentStart', 'SaaSOfferStatusInProgress', 'SaaSOfferStatusSubscribed', 'SaaSOfferStatusSuspended', 'SaaSOfferStatusReinstated', 'SaaSOfferStatusSucceeded', 'SaaSOfferStatusFailed', 'SaaSOfferStatusUnsubscribed', 'SaaSOfferStatusUpdating' + // Status - READ-ONLY; SaaS Offer Status. Possible values include: 'SaaSOfferStatusStarted', 'SaaSOfferStatusPendingFulfillmentStart', 'SaaSOfferStatusInProgress', 'SaaSOfferStatusSubscribed', 'SaaSOfferStatusSuspended', 'SaaSOfferStatusReinstated', 'SaaSOfferStatusSucceeded', 'SaaSOfferStatusFailed', 'SaaSOfferStatusUnsubscribed', 'SaaSOfferStatusUpdating' Status SaaSOfferStatus `json:"status,omitempty"` } +// MarshalJSON is the custom marshaler for OfferDetail. +func (od OfferDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if od.PublisherID != nil { + objectMap["publisherId"] = od.PublisherID + } + if od.ID != nil { + objectMap["id"] = od.ID + } + if od.PlanID != nil { + objectMap["planId"] = od.PlanID + } + if od.PlanName != nil { + objectMap["planName"] = od.PlanName + } + if od.TermUnit != nil { + objectMap["termUnit"] = od.TermUnit + } + return json.Marshal(objectMap) +} + // OperationDisplay the object that represents the operation. type OperationDisplay struct { // Provider - Service provider: Microsoft.Confluent