зеркало из https://github.com/Azure/ARO-RP.git
Merge pull request #2332 from ross-bryan/ocm-config-cosmos
[M8] Hive/OCM CRUD Operations
This commit is contained in:
Коммит
e3b217fbb0
|
@ -1,4 +1,4 @@
|
|||
468fa0da0a50d50640ec57843ad288af343128b39f5bf23e76e4e336580883d4 swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2020-04-30/redhatopenshift.json
|
||||
c323c84befa5ea11da50a2407050abed6540ea01e796720bc2241604ce80567c swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/preview/2021-09-01-preview/redhatopenshift.json
|
||||
e4e522e41855de71c0318db31cbd96c8713e7a74e7c81911bb494f0b194b3f43 swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2022-04-01/redhatopenshift.json
|
||||
1904724f413437e8f7bec1493e1c332e48b2dffd0f7d1f2f6060c281c07880ce swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2022-09-04/redhatopenshift.json
|
||||
70e23386b8277aea07a1babd61fb2c1252cff46ad032f700b02074fb46a58c4c swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2022-09-04/redhatopenshift.json
|
||||
|
|
|
@ -110,6 +110,11 @@ func rp(ctx context.Context, log, audit *logrus.Entry) error {
|
|||
return err
|
||||
}
|
||||
|
||||
dbClusterManagerConfiguration, err := database.NewClusterManagerConfigurations(ctx, _env.IsLocalDevelopmentMode(), dbc)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
dbBilling, err := database.NewBilling(ctx, _env.IsLocalDevelopmentMode(), dbc)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -142,7 +147,7 @@ func rp(ctx context.Context, log, audit *logrus.Entry) error {
|
|||
return err
|
||||
}
|
||||
|
||||
f, err := frontend.NewFrontend(ctx, audit, log.WithField("component", "frontend"), _env, dbAsyncOperations, dbOpenShiftClusters, dbSubscriptions, dbOpenShiftVersions, api.APIs, m, feAead, adminactions.NewKubeActions, adminactions.NewAzureActions, clusterdata.NewBestEffortEnricher)
|
||||
f, err := frontend.NewFrontend(ctx, audit, log.WithField("component", "frontend"), _env, dbAsyncOperations, dbClusterManagerConfiguration, dbOpenShiftClusters, dbSubscriptions, dbOpenShiftVersions, api.APIs, m, feAead, adminactions.NewKubeActions, adminactions.NewAzureActions, clusterdata.NewBestEffortEnricher)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -216,6 +216,15 @@
|
|||
curl -X GET -k "https://localhost:8443/admin/subscriptions/$AZURE_SUBSCRIPTION_ID/resourceGroups/$RESOURCEGROUP/providers/Microsoft.RedHatOpenShift/openShiftClusters/$CLUSTER/kubernetespodlogs?podname=$POD&namespace=$NAMESPACE&container=$CONTAINER"
|
||||
```
|
||||
|
||||
## OpenShift Cluster Manager (OCM) Configuration API Actions
|
||||
|
||||
* Create a new OCM configuration
|
||||
* You can find example payloads in the projects `./hack/ocm` folder.
|
||||
|
||||
```bash
|
||||
curl -X PUT -k "https://localhost:8443/subscriptions/$AZURE_SUBSCRIPTION_ID/resourceGroups/$RESOURCEGROUP/providers/Microsoft.RedHatOpenShift/openShiftClusters/$CLUSTER/syncsets/mySyncSet?api-version=2022-09-04" --header "Content-Type: application/json" -d @./hack/ocm/syncset.b64
|
||||
|
||||
|
||||
## Debugging OpenShift Cluster
|
||||
|
||||
* SSH to the bootstrap node:
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
ewogICAgImFwaVZlcnNpb24iOiAiaGl2ZS5vcGVuc2hpZnQuaW8vdjEiLAogICAgImtpbmQiOiAiTWFjaGluZVBvb2wiLAogICAgIm1ldGFkYXRhIjogewogICAgICAgICJuYW1lIjogInRlc3QtY2x1c3Rlci13b3JrZXIiLAogICAgICAgICJuYW1lc3BhY2UiOiAiYXJvLWY2MGFlOGEyLWJjYTEtNDk4Ny05MDU2LVhYWFhYWFhYWFhYWCIKICAgIH0sCiAgICAic3BlYyI6IHsKICAgICAgICAiY2x1c3RlckRlcGxveW1lbnRSZWYiOiB7CiAgICAgICAgICAgICJuYW1lIjogInRlc3QtY2x1c3RlciIKICAgICAgICB9LAogICAgICAgICJuYW1lIjogIndvcmtlciIsCiAgICAgICAgInBsYXRmb3JtIjogewogICAgICAgICAgICAiYXdzIjogewogICAgICAgICAgICAgICAgInJvb3RWb2x1bWUiOiB7CiAgICAgICAgICAgICAgICAgICAgImlvcHMiOiAwLAogICAgICAgICAgICAgICAgICAgICJzaXplIjogMzAwLAogICAgICAgICAgICAgICAgICAgICJ0eXBlIjogImdwMyIKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAidHlwZSI6ICJtNS54bGFyZ2UiLAogICAgICAgICAgICAgICAgInpvbmVzIjogWwogICAgICAgICAgICAgICAgICAgICJ1cy1lYXN0LTFhIgogICAgICAgICAgICAgICAgXQogICAgICAgICAgICB9CiAgICAgICAgfSwKICAgICAgICAicmVwbGljYXMiOiAyCiAgICB9LAogICAgInN0YXR1cyI6IHsKICAgICAgICAiY29uZGl0aW9ucyI6IFsKICAgICAgICBdCiAgICB9Cn0K
|
|
@ -0,0 +1 @@
|
|||
YXBpVmVyc2lvbjogdjEKZGF0YToKICB1c2VybmFtZTogWVdSdGFXND0KICBwYXNzd29yZDogTVdZeVpERmxNbVUyTjJSbQpraW5kOiBTZWNyZXQKbWV0YWRhdGE6CiAgYW5ub3RhdGlvbnM6CiAgICBrdWJlY3RsLmt1YmVybmV0ZXMuaW8vbGFzdC1hcHBsaWVkLWNvbmZpZ3VyYXRpb246IHsgLi4uIH0KICBjcmVhdGlvblRpbWVzdGFtcDogMjAyMC0wMS0yMlQxODo0MTo1NloKICBuYW1lOiBteXNlY3JldAogIG5hbWVzcGFjZTogZGVmYXVsdAogIHJlc291cmNlVmVyc2lvbjogMTY0NjE5CiAgdWlkOiBjZmVlMDJkNi1jMTM3LTExZTUtOGQ3My00MjAxMGFmMDAwMDIKdHlwZTogT3BhcXVlCg==
|
|
@ -0,0 +1 @@
|
|||
ewogICAgImFwaVZlcnNpb24iOiAiaGl2ZS5vcGVuc2hpZnQuaW8vdjEiLAogICAgImtpbmQiOiAiU3luY0lkZW50aXR5UHJvdmlkZXIiLAogICAgIm1ldGFkYXRhIjogewogICAgICAgICJuYW1lIjogInRlc3QtY2x1c3RlciIsCiAgICAgICAgIm5hbWVzcGFjZSI6ICJhcm8tZjYwYWU4YTItYmNhMS00OTg3LTkwNTYtWFhYWFhYWFhYWFhYIgogICAgfSwKICAgICJzcGVjIjogewogICAgICAgICJjbHVzdGVyRGVwbG95bWVudFJlZnMiOiBbCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICJuYW1lIjogInRlc3QtY2x1c3RlciIKICAgICAgICAgICAgfQogICAgICAgIF0sCiAgICAgICAgImlkZW50aXR5UHJvdmlkZXJzIjogWwogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAiaHRwYXNzd2QiOiB7CiAgICAgICAgICAgICAgICAgICAgImZpbGVEYXRhIjogewogICAgICAgICAgICAgICAgICAgICAgICAibmFtZSI6ICJodHBhc3N3ZC1zZWNyZXQiCiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICJtYXBwaW5nTWV0aG9kIjogImNsYWltIiwKICAgICAgICAgICAgICAgICJuYW1lIjogIkhUUGFzc3dkIiwKICAgICAgICAgICAgICAgICJ0eXBlIjogIkhUUGFzc3dkIgogICAgICAgICAgICB9CiAgICAgICAgXQogICAgfSwKICAgICJzdGF0dXMiOiB7fQp9Cg==
|
|
@ -0,0 +1 @@
|
|||
eyAKICAiYXBpVmVyc2lvbiI6ICJoaXZlLm9wZW5zaGlmdC5pby92MSIsCiAgImtpbmQiOiAiU3luY1NldCIsCiAgIm1ldGFkYXRhIjogewogICAgIm5hbWUiOiAidGVzdC1zeW5jc2V0IiwKICAgICJuYW1lc3BhY2UiOiAiYXJvLWY2MGFlOGEyLWJjYTEtNDk4Ny05MDU2LVhYWFhYWFhYWFhYWCIKICB9LAogICJzcGVjIjogewogICAgImNsdXN0ZXJEZXBsb3ltZW50UmVmcyI6IFsKICAgICAgICB7CiAgICAgICAgICAgICJuYW1lIjogInRlc3QtY2x1c3RlciIKICAgICAgICB9CiAgICBdLAogICAgInJlc291cmNlcyI6IFsKICAgICAgewogICAgICAgICJhcGlWZXJzaW9uIjogInYxIiwKICAgICAgICAia2luZCI6ICJDb25maWdNYXAiLAogICAgICAgICJtZXRhZGF0YSI6IHsKICAgICAgICAgICJuYW1lIjogIm15Y29uZmlnbWFwIgogICAgICAgIH0KICAgICAgfQogICAgXQogIH0KfQo=
|
|
@ -0,0 +1,138 @@
|
|||
package api
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the Apache License 2.0.
|
||||
|
||||
// SyncSetList represents a list of SyncSets for a given cluster.
|
||||
type SyncSetList struct {
|
||||
SyncSets []*SyncSet `json:"value"`
|
||||
}
|
||||
|
||||
type ClusterManagerConfigurationList struct {
|
||||
ClusterManagerConfigurations []*ClusterManagerConfiguration `json:"value"`
|
||||
}
|
||||
|
||||
// ClusterManagerConfiguration represents the configuration from OpenShift Cluster Manager (OCM)
|
||||
type ClusterManagerConfiguration struct {
|
||||
// ID is the unique identifier for the cluster manager configuration
|
||||
ID string `json:"id,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
ClusterResourceID string `json:"clusterResourceId,omitempty"`
|
||||
Properties ClusterManagerConfigurationProperties `json:"properties,omitempty"`
|
||||
SystemData *SystemData `json:"systemData,omitempty"`
|
||||
}
|
||||
|
||||
// ClusterManagerConfigurationProperties houses the payloads the frontend receives for all OCM resources
|
||||
// we store them as a byte slice in cosmos
|
||||
type ClusterManagerConfigurationProperties struct {
|
||||
Resources []byte `json:"resources,omitempty"`
|
||||
}
|
||||
|
||||
// SyncSet represents a SyncSet for an Azure Red Hat OpenShift Cluster.
|
||||
type SyncSet struct {
|
||||
// Required resource properties in ARM
|
||||
ID string `json:"id,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Type string `json:"type,omitempty"`
|
||||
|
||||
// SystemData metadata relating to this resource.
|
||||
SystemData *SystemData `json:"systemData,omitempty"`
|
||||
|
||||
// The SyncSets properties
|
||||
Properties SyncSetProperties `json:"properties,omitempty"`
|
||||
}
|
||||
|
||||
// SyncSetProperties represents the properties of a SyncSet
|
||||
type SyncSetProperties struct {
|
||||
// Resources represents the SyncSets configuration.
|
||||
Resources string `json:"resources,omitempty"`
|
||||
}
|
||||
|
||||
// MachinePoolList represents a list of MachinePools
|
||||
type MachinePoolList struct {
|
||||
// The list of MachinePools.
|
||||
MachinePools []*MachinePool `json:"value"`
|
||||
}
|
||||
|
||||
// MachinePool represents a MachinePool
|
||||
type MachinePool struct {
|
||||
// The Resource ID.
|
||||
ID string `json:"id,omitempty"`
|
||||
|
||||
// The resource name.
|
||||
Name string `json:"name,omitempty"`
|
||||
|
||||
// The resource type.
|
||||
Type string `json:"type,omitempty"`
|
||||
|
||||
// SystemData metadata relating to this resource.
|
||||
SystemData *SystemData `json:"systemData,omitempty"`
|
||||
|
||||
// The MachinePool Properties
|
||||
Properties MachinePoolProperties `json:"properties,omitempty"`
|
||||
}
|
||||
|
||||
// MachinePoolProperties represents the properties of a MachinePool
|
||||
type MachinePoolProperties struct {
|
||||
Resources string `json:"resources,omitempty"`
|
||||
}
|
||||
|
||||
// SyncIdentityProviderList represents a list of SyncIdentityProvider
|
||||
type SyncIdentityProviderList struct {
|
||||
// The list of SyncIdentityProvider.
|
||||
SyncIdentityProviders []*SyncIdentityProvider `json:"value"`
|
||||
}
|
||||
|
||||
// SyncIdentityProvider represents a SyncIdentityProvider
|
||||
type SyncIdentityProvider struct {
|
||||
// The Resource ID.
|
||||
ID string `json:"id,omitempty"`
|
||||
|
||||
// The resource name.
|
||||
Name string `json:"name,omitempty"`
|
||||
|
||||
// The resource type.
|
||||
Type string `json:"type,omitempty"`
|
||||
|
||||
// SystemData metadata relating to this resource.
|
||||
SystemData *SystemData `json:"systemData,omitempty"`
|
||||
|
||||
// The SyncIdentityProvider Properties
|
||||
Properties SyncIdentityProviderProperties `json:"properties,omitempty"`
|
||||
}
|
||||
|
||||
// SyncIdentityProviderProperties represents the properties of a SyncIdentityProvider
|
||||
type SyncIdentityProviderProperties struct {
|
||||
// The SyncIdentityProvider Resources.
|
||||
Resources string `json:"resources,omitempty"`
|
||||
}
|
||||
|
||||
// SecretList represents a list of Secrets
|
||||
type SecretList struct {
|
||||
// The list of Secrets.
|
||||
Secrets []*Secret `json:"value"`
|
||||
}
|
||||
|
||||
// Secret represents a secret.
|
||||
type Secret struct {
|
||||
// The Resource ID.
|
||||
ID string `json:"id,omitempty"`
|
||||
|
||||
// The resource name.
|
||||
Name string `json:"name,omitempty"`
|
||||
|
||||
// The resource type.
|
||||
Type string `json:"type,omitempty"`
|
||||
|
||||
// SystemData metadata relating to this resource.
|
||||
SystemData *SystemData `json:"systemData,omitempty"`
|
||||
|
||||
// The Secret Properties
|
||||
Properties SecretProperties `json:"properties,omitempty"`
|
||||
}
|
||||
|
||||
// SecretProperties represents the properties of a Secret
|
||||
type SecretProperties struct {
|
||||
// The Secrets Resources.
|
||||
SecretResources SecureString `json:"secretResources,omitempty"`
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
package api
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the Apache License 2.0.
|
||||
|
||||
// ClusterManagerConfigurationDocument represents OpenShift cluster manager configuration documents.
|
||||
// pkg/database/cosmosdb requires its definition.
|
||||
type ClusterManagerConfigurationDocuments struct {
|
||||
Count int `json:"_count,omitempty"`
|
||||
ResourceID string `json:"_rid,omitempty"`
|
||||
ClusterManagerConfigurationDocuments []*ClusterManagerConfigurationDocument `json:"Documents,omitempty"`
|
||||
}
|
||||
|
||||
// String returns a JSON representation of the OpenShiftClusterManagerConfigurationDocuments struct.
|
||||
func (c *ClusterManagerConfigurationDocuments) String() string {
|
||||
return encodeJSON(c)
|
||||
}
|
||||
|
||||
// OpenShiftClusterManagerConfigurationDocument represents an OpenShift cluster manager configuration document.
|
||||
// pkg/database/cosmosdb requires its definition.
|
||||
type ClusterManagerConfigurationDocument struct {
|
||||
MissingFields
|
||||
|
||||
ID string `json:"id,omitempty"`
|
||||
ResourceID string `json:"_rid,omitempty"`
|
||||
Timestamp int `json:"_ts,omitempty"`
|
||||
Self string `json:"_self,omitempty"`
|
||||
ETag string `json:"_etag,omitempty" deep:"-"`
|
||||
Attachments string `json:"_attachments,omitempty"`
|
||||
TTL int `json:"ttl,omitempty"`
|
||||
LSN int `json:"_lsn,omitempty"`
|
||||
Metadata map[string]interface{} `json:"_metadata,omitempty"`
|
||||
|
||||
Key string `json:"key,omitempty"`
|
||||
PartitionKey string `json:"partitionKey,omitempty" deep:"-"`
|
||||
Deleting bool `json:"deleting,omitempty"` // https://docs.microsoft.com/en-us/azure/cosmos-db/change-feed-design-patterns#deletes
|
||||
|
||||
ClusterManagerConfiguration *ClusterManagerConfiguration `json:"clusterManagerConfiguration,omitempty"`
|
||||
|
||||
SyncIdentityProvider *SyncIdentityProvider `json:"syncIdentityProvider,omitempty"`
|
||||
SyncSet *SyncSet `json:"syncSet,omitempty"`
|
||||
MachinePool *MachinePool `json:"machinePool,omitempty"`
|
||||
Secret *Secret `json:"secret,omitempty"`
|
||||
|
||||
CorrelationData *CorrelationData `json:"correlationData,omitempty" deep:"-"`
|
||||
}
|
||||
|
||||
// String returns a JSON representation of the OpenShiftClusterManagerConfigurationDocument struct.
|
||||
func (c *ClusterManagerConfigurationDocument) String() string {
|
||||
return encodeJSON(c)
|
||||
}
|
|
@ -0,0 +1,78 @@
|
|||
package api
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the Apache License 2.0.
|
||||
|
||||
// ExampleClusterManagerConfigurationDocumentSyncSet returns a ClusterManagerConfigurationDocument
|
||||
// with an example syncset payload model. The resources field comes from the ./hack/ocm folder.
|
||||
func ExampleClusterManagerConfigurationDocumentSyncSet() *ClusterManagerConfigurationDocument {
|
||||
return &ClusterManagerConfigurationDocument{
|
||||
ID: "00000000-0000-0000-0000-000000000000",
|
||||
Key: "/subscriptions/subscriptionid/resourcegroups/resourcegroup/providers/microsoft.redhatopenshift/openshiftclusters/resourcename/syncSets/mySyncSet",
|
||||
ResourceID: "",
|
||||
PartitionKey: "",
|
||||
SyncSet: &SyncSet{
|
||||
Name: "mySyncSet",
|
||||
ID: "/subscriptions/subscriptionId/resourceGroups/resourceGroup/providers/Microsoft.RedHatOpenShift/OpenShiftClusters/resourceName/syncSets/mySyncSet",
|
||||
Type: "Microsoft.RedHatOpenShift/OpenShiftClusters/SyncSets",
|
||||
Properties: SyncSetProperties{
|
||||
Resources: "eyAKICAiYXBpVmVyc2lvbiI6ICJoaXZlLm9wZW5zaGlmdC5pby92MSIsCiAgImtpbmQiOiAiU3luY1NldCIsCiAgIm1ldGFkYXRhIjogewogICAgIm5hbWUiOiAic2FtcGxlIiwKICAgICJuYW1lc3BhY2UiOiAiYXJvLWY2MGFlOGEyLWJjYTEtNDk4Ny05MDU2LWYyZjZhMTgzN2NhYSIKICB9LAogICJzcGVjIjogewogICAgImNsdXN0ZXJEZXBsb3ltZW50UmVmcyI6IFtdLAogICAgInJlc291cmNlcyI6IFsKICAgICAgewogICAgICAgICJhcGlWZXJzaW9uIjogInYxIiwKICAgICAgICAia2luZCI6ICJDb25maWdNYXAiLAogICAgICAgICJtZXRhZGF0YSI6IHsKICAgICAgICAgICJuYW1lIjogIm15Y29uZmlnbWFwIgogICAgICAgIH0KICAgICAgfQogICAgXQogIH0KfQo=",
|
||||
},
|
||||
},
|
||||
CorrelationData: &CorrelationData{},
|
||||
}
|
||||
}
|
||||
|
||||
func ExampleClusterManagerConfigurationDocumentMachinePool() *ClusterManagerConfigurationDocument {
|
||||
return &ClusterManagerConfigurationDocument{
|
||||
ID: "00000000-0000-0000-0000-000000000000",
|
||||
Key: "/subscriptions/subscriptionid/resourcegroups/resourcegroup/providers/microsoft.redhatopenshift/openshiftclusters/resourcename/machinepools/myMachinePool",
|
||||
ResourceID: "",
|
||||
PartitionKey: "",
|
||||
MachinePool: &MachinePool{
|
||||
Name: "myMachinePool",
|
||||
ID: "/subscriptions/subscriptionId/resourceGroups/resourceGroup/providers/Microsoft.RedHatOpenShift/OpenShiftClusters/resourceName/machinePools/myMachinePool",
|
||||
Type: "Microsoft.RedHatOpenShift/OpenShiftClusters/MachinePools",
|
||||
Properties: MachinePoolProperties{
|
||||
Resources: "ewogICAgImFwaVZlcnNpb24iOiAiaGl2ZS5vcGVuc2hpZnQuaW8vdjEiLAogICAgImtpbmQiOiAiTWFjaGluZVBvb2wiLAogICAgIm1ldGFkYXRhIjogewogICAgICAgICJuYW1lIjogInRlc3QtY2x1c3Rlci13b3JrZXIiLAogICAgICAgICJuYW1lc3BhY2UiOiAiYXJvLWY2MGFlOGEyLWJjYTEtNDk4Ny05MDU2LVhYWFhYWFhYWFhYWCIKICAgIH0sCiAgICAic3BlYyI6IHsKICAgICAgICAiY2x1c3RlckRlcGxveW1lbnRSZWYiOiB7CiAgICAgICAgICAgICJuYW1lIjogInRlc3QtY2x1c3RlciIKICAgICAgICB9LAogICAgICAgICJuYW1lIjogIndvcmtlciIsCiAgICAgICAgInBsYXRmb3JtIjogewogICAgICAgICAgICAiYXdzIjogewogICAgICAgICAgICAgICAgInJvb3RWb2x1bWUiOiB7CiAgICAgICAgICAgICAgICAgICAgImlvcHMiOiAwLAogICAgICAgICAgICAgICAgICAgICJzaXplIjogMzAwLAogICAgICAgICAgICAgICAgICAgICJ0eXBlIjogImdwMyIKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAidHlwZSI6ICJtNS54bGFyZ2UiLAogICAgICAgICAgICAgICAgInpvbmVzIjogWwogICAgICAgICAgICAgICAgICAgICJ1cy1lYXN0LTFhIgogICAgICAgICAgICAgICAgXQogICAgICAgICAgICB9CiAgICAgICAgfSwKICAgICAgICAicmVwbGljYXMiOiAyCiAgICB9LAogICAgInN0YXR1cyI6IHsKICAgICAgICAiY29uZGl0aW9ucyI6IFsKICAgICAgICBdCiAgICB9Cn0K",
|
||||
},
|
||||
},
|
||||
CorrelationData: &CorrelationData{},
|
||||
}
|
||||
}
|
||||
|
||||
func ExampleClusterManagerConfigurationDocumentSyncIdentityProvider() *ClusterManagerConfigurationDocument {
|
||||
return &ClusterManagerConfigurationDocument{
|
||||
ID: "00000000-0000-0000-0000-000000000000",
|
||||
Key: "/subscriptions/subscriptionid/resourcegroups/resourcegroup/providers/microsoft.redhatopenshift/openshiftclusters/resourcename/syncidentityprovider/mySyncIdentityProvider",
|
||||
ResourceID: "",
|
||||
PartitionKey: "",
|
||||
SyncIdentityProvider: &SyncIdentityProvider{
|
||||
Name: "mySyncIdentityProvider",
|
||||
Type: "Microsoft.RedHatOpenShift/OpenShiftClusters/SyncIdentityProviders",
|
||||
ID: "/subscriptions/subscriptionId/resourceGroups/resourceGroup/providers/Microsoft.RedHatOpenShift/OpenShiftClusters/resourceName/syncidentityprovider/mySyncIdentityProvider",
|
||||
Properties: SyncIdentityProviderProperties{
|
||||
Resources: "ewogICAgImFwaVZlcnNpb24iOiAiaGl2ZS5vcGVuc2hpZnQuaW8vdjEiLAogICAgImtpbmQiOiAiU3luY0lkZW50aXR5UHJvdmlkZXIiLAogICAgIm1ldGFkYXRhIjogewogICAgICAgICJuYW1lIjogInRlc3QtY2x1c3RlciIsCiAgICAgICAgIm5hbWVzcGFjZSI6ICJhcm8tZjYwYWU4YTItYmNhMS00OTg3LTkwNTYtWFhYWFhYWFhYWFhYIgogICAgfSwKICAgICJzcGVjIjogewogICAgICAgICJjbHVzdGVyRGVwbG95bWVudFJlZnMiOiBbCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICJuYW1lIjogInRlc3QtY2x1c3RlciIKICAgICAgICAgICAgfQogICAgICAgIF0sCiAgICAgICAgImlkZW50aXR5UHJvdmlkZXJzIjogWwogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAiaHRwYXNzd2QiOiB7CiAgICAgICAgICAgICAgICAgICAgImZpbGVEYXRhIjogewogICAgICAgICAgICAgICAgICAgICAgICAibmFtZSI6ICJodHBhc3N3ZC1zZWNyZXQiCiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICJtYXBwaW5nTWV0aG9kIjogImNsYWltIiwKICAgICAgICAgICAgICAgICJuYW1lIjogIkhUUGFzc3dkIiwKICAgICAgICAgICAgICAgICJ0eXBlIjogIkhUUGFzc3dkIgogICAgICAgICAgICB9CiAgICAgICAgXQogICAgfSwKICAgICJzdGF0dXMiOiB7fQp9Cg==",
|
||||
},
|
||||
},
|
||||
CorrelationData: &CorrelationData{},
|
||||
}
|
||||
}
|
||||
|
||||
func ExampleClusterManagerConfigurationDocumentSecret() *ClusterManagerConfigurationDocument {
|
||||
return &ClusterManagerConfigurationDocument{
|
||||
ID: "00000000-0000-0000-0000-000000000000",
|
||||
Key: "/subscriptions/subscriptionid/resourcegroups/resourcegroup/providers/microsoft.redhatopenshift/openshiftclusters/resourcename/machinepools/mySyncIdentityProvider",
|
||||
ResourceID: "",
|
||||
PartitionKey: "",
|
||||
Secret: &Secret{
|
||||
Name: "mySecret",
|
||||
Type: "Microsoft.RedHatOpenShift/OpenShiftClusters/Secrets",
|
||||
ID: "/subscriptions/subscriptionId/resourceGroups/resourceGroup/providers/Microsoft.RedHatOpenShift/OpenShiftClusters/resourceName/secret/mySecret",
|
||||
Properties: SecretProperties{
|
||||
SecretResources: SecureString("YXBpVmVyc2lvbjogdjEKZGF0YToKICB1c2VybmFtZTogWVdSdGFXND0KICBwYXNzd29yZDogTVdZeVpERmxNbVUyTjJSbQpraW5kOiBTZWNyZXQKbWV0YWRhdGE6CiAgYW5ub3RhdGlvbnM6CiAgICBrdWJlY3RsLmt1YmVybmV0ZXMuaW8vbGFzdC1hcHBsaWVkLWNvbmZpZ3VyYXRpb246IHsgLi4uIH0KICBjcmVhdGlvblRpbWVzdGFtcDogMjAyMC0wMS0yMlQxODo0MTo1NloKICBuYW1lOiBteXNlY3JldAogIG5hbWVzcGFjZTogZGVmYXVsdAogIHJlc291cmNlVmVyc2lvbjogMTY0NjE5CiAgdWlkOiBjZmVlMDJkNi1jMTM3LTExZTUtOGQ3My00MjAxMGFmMDAwMDIKdHlwZTogT3BhcXVlCg=="),
|
||||
},
|
||||
},
|
||||
CorrelationData: &CorrelationData{},
|
||||
}
|
||||
}
|
|
@ -39,7 +39,7 @@ func ExampleOpenShiftClusterDocument() *OpenShiftClusterDocument {
|
|||
ClusterProfile: ClusterProfile{
|
||||
PullSecret: `{"auths":{"registry.connect.redhat.com":{"auth":""},"registry.redhat.io":{"auth":""}}}`,
|
||||
Domain: "cluster.location.aroapp.io",
|
||||
Version: "4.3.0",
|
||||
Version: "4.11.0",
|
||||
ResourceGroupID: "/subscriptions/subscriptionId/resourceGroups/clusterResourceGroup",
|
||||
},
|
||||
ConsoleProfile: ConsoleProfile{
|
||||
|
|
|
@ -129,3 +129,90 @@ var OperationListInstallVersions = Operation{
|
|||
},
|
||||
Origin: "user,system",
|
||||
}
|
||||
|
||||
var OperationSyncSetsRead = Operation{
|
||||
Name: "Microsoft.RedHatOpenShift/openShiftClusters/syncSets/read",
|
||||
Display: Display{
|
||||
Provider: "Azure Red Hat OpenShift",
|
||||
Resource: "syncSets",
|
||||
Operation: "Read OpenShift cluster sync set",
|
||||
},
|
||||
Origin: "user,system",
|
||||
}
|
||||
|
||||
var OperationSyncSetsWrite = Operation{
|
||||
Name: "Microsoft.RedHatOpenShift/openShiftClusters/syncSets/write",
|
||||
Display: Display{
|
||||
Provider: "Azure Red Hat OpenShift",
|
||||
Resource: "syncSets",
|
||||
Operation: "Write OpenShift cluster sync set",
|
||||
},
|
||||
Origin: "user,system",
|
||||
}
|
||||
|
||||
var OperationSyncSetsDelete = Operation{
|
||||
Name: "Microsoft.RedHatOpenShift/openShiftClusters/syncSets/delete",
|
||||
Display: Display{
|
||||
Provider: "Azure Red Hat OpenShift",
|
||||
Resource: "syncSets",
|
||||
Operation: "Delete OpenShift cluster sync set",
|
||||
},
|
||||
Origin: "user,system",
|
||||
}
|
||||
|
||||
var OperationMachinePoolsRead = Operation{
|
||||
Name: "Microsoft.RedHatOpenShift/openShiftClusters/machinePools/read",
|
||||
Display: Display{
|
||||
Provider: "Azure Red Hat OpenShift",
|
||||
Resource: "machinePools",
|
||||
Operation: "Read OpenShift cluster machine pool",
|
||||
},
|
||||
Origin: "user,system",
|
||||
}
|
||||
var OperationMachinePoolsWrite = Operation{
|
||||
Name: "Microsoft.RedHatOpenShift/openShiftClusters/machinePools/write",
|
||||
Display: Display{
|
||||
Provider: "Azure Red Hat OpenShift",
|
||||
Resource: "machinePools",
|
||||
Operation: "Write OpenShift cluster machine pool",
|
||||
},
|
||||
Origin: "user,system",
|
||||
}
|
||||
var OperationMachinePoolsDelete = Operation{
|
||||
Name: "Microsoft.RedHatOpenShift/openShiftClusters/machinePools/delete",
|
||||
Display: Display{
|
||||
Provider: "Azure Red Hat OpenShift",
|
||||
Resource: "machinePools",
|
||||
Operation: "Delete OpenShift cluster machine pool",
|
||||
},
|
||||
Origin: "user,system",
|
||||
}
|
||||
|
||||
var OperationSyncIdentityProvidersRead = Operation{
|
||||
Name: "Microsoft.RedHatOpenShift/openShiftClusters/syncIdentityProviders/read",
|
||||
Display: Display{
|
||||
Provider: "Azure Red Hat OpenShift",
|
||||
Resource: "syncIdentityProviders",
|
||||
Operation: "Read OpenShift cluster sync identity provider",
|
||||
},
|
||||
Origin: "user,system",
|
||||
}
|
||||
var OperationSyncIdentityProvidersWrite = Operation{
|
||||
Name: "Microsoft.RedHatOpenShift/openShiftClusters/syncIdentityProviders/write",
|
||||
Display: Display{
|
||||
Provider: "Azure Red Hat OpenShift",
|
||||
Resource: "syncIdentityProviders",
|
||||
Operation: "Write OpenShift cluster sync identity provider",
|
||||
},
|
||||
Origin: "user,system",
|
||||
}
|
||||
|
||||
var OperationSyncIdentityProvidersDelete = Operation{
|
||||
Name: "Microsoft.RedHatOpenShift/openShiftClusters/syncIdentityProviders/delete",
|
||||
Display: Display{
|
||||
Provider: "Azure Red Hat OpenShift",
|
||||
Resource: "syncIdentityProviders",
|
||||
Operation: "Delete OpenShift cluster sync identity provider",
|
||||
},
|
||||
Origin: "user,system",
|
||||
}
|
||||
|
|
|
@ -3,6 +3,14 @@ package api
|
|||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the Apache License 2.0.
|
||||
|
||||
type ClusterManagerConfigurationConverter interface {
|
||||
ToExternal(*ClusterManagerConfiguration) (interface{}, error)
|
||||
ToExternalList([]*ClusterManagerConfiguration, string) (interface{}, error)
|
||||
ToInternal(interface{}, *ClusterManagerConfiguration) error
|
||||
}
|
||||
type ClusterManagerConfigurationStaticValidator interface {
|
||||
Static(interface{}, *ClusterManagerConfiguration) error
|
||||
}
|
||||
type OpenShiftClusterConverter interface {
|
||||
ToExternal(*OpenShiftCluster) interface{}
|
||||
ToExternalList([]*OpenShiftCluster, string) interface{}
|
||||
|
@ -37,6 +45,7 @@ type OpenShiftVersionStaticValidator interface {
|
|||
|
||||
// Version is a set of endpoints implemented by each API version
|
||||
type Version struct {
|
||||
ClusterManagerConfigurationConverter ClusterManagerConfigurationConverter
|
||||
OpenShiftClusterConverter OpenShiftClusterConverter
|
||||
OpenShiftClusterStaticValidator OpenShiftClusterStaticValidator
|
||||
OpenShiftClusterCredentialsConverter OpenShiftClusterCredentialsConverter
|
||||
|
|
|
@ -0,0 +1,182 @@
|
|||
package v20220904
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the Apache License 2.0.
|
||||
|
||||
// ClusterManagerConfigurationList represents a list of ClusterManagerConfigurations
|
||||
type ClusterManagerConfigurationList struct {
|
||||
ClusterManagerConfigurations []*ClusterManagerConfiguration `json:"value"`
|
||||
|
||||
NextLink string `json:"nextLink,omitempty"`
|
||||
}
|
||||
|
||||
type ClusterManagerConfiguration struct {
|
||||
// ID is the unique identifier for the cluster manager configuration
|
||||
ID string `json:"id,omitempty"`
|
||||
|
||||
// The resource name
|
||||
Name string `json:"name,omitempty"`
|
||||
|
||||
// The parent cluster resourceId
|
||||
ClusterResourceID string `json:"clusterResourceId,omitempty"`
|
||||
|
||||
// The ClusterManagerConfigurations properties
|
||||
Properties ClusterManagerConfigurationProperties `json:"properties,omitempty"`
|
||||
|
||||
// SystemData metadata from ARM
|
||||
SystemData *SystemData `json:"systemData,omitempty"`
|
||||
}
|
||||
|
||||
type ClusterManagerConfigurationProperties struct {
|
||||
Resources interface{} `json:"resources,omitempty"`
|
||||
}
|
||||
|
||||
// SyncSetList represents a list of SyncSets
|
||||
type SyncSetList struct {
|
||||
// The list of syncsets.
|
||||
SyncSets []*SyncSet `json:"value"`
|
||||
|
||||
// The link used to get the next page of operations.
|
||||
NextLink string `json:"nextLink,omitempty"`
|
||||
}
|
||||
|
||||
// SyncSet represents a SyncSet for an Azure Red Hat OpenShift Cluster.
|
||||
type SyncSet struct {
|
||||
// This is a flag used during the swagger generation typewalker to
|
||||
// signal that it should be marked as a proxy resource and
|
||||
// not a tracked ARM resource.
|
||||
proxyResource bool
|
||||
|
||||
// The resource ID.
|
||||
ID string `json:"id,omitempty" mutable:"case"`
|
||||
|
||||
// The resource name.
|
||||
Name string `json:"name,omitempty" mutable:"case"`
|
||||
|
||||
// The resource type.
|
||||
Type string `json:"type,omitempty" mutable:"case"`
|
||||
|
||||
// SystemData metadata relating to this resource.
|
||||
SystemData *SystemData `json:"systemData,omitempty"`
|
||||
|
||||
// The Syncsets properties
|
||||
Properties SyncSetProperties `json:"properties,omitempty"`
|
||||
}
|
||||
|
||||
// SyncSetProperties represents the properties of a SyncSet
|
||||
type SyncSetProperties struct {
|
||||
// Resources represents the SyncSets configuration.
|
||||
Resources string `json:"resources,omitempty"`
|
||||
}
|
||||
|
||||
// MachinePoolList represents a list of MachinePools
|
||||
type MachinePoolList struct {
|
||||
// The list of Machine Pools.
|
||||
MachinePools []*MachinePool `json:"value"`
|
||||
|
||||
// The link used to get the next page of operations.
|
||||
NextLink string `json:"nextLink,omitempty"`
|
||||
}
|
||||
|
||||
// MachinePool represents a MachinePool
|
||||
type MachinePool struct {
|
||||
// This is a flag used during the swagger generation typewalker to
|
||||
// signal that it should be marked as a proxy resource and
|
||||
// not a tracked ARM resource.
|
||||
proxyResource bool
|
||||
|
||||
// The Resource ID.
|
||||
ID string `json:"id,omitempty"`
|
||||
|
||||
// The resource name.
|
||||
Name string `json:"name,omitempty"`
|
||||
|
||||
// The resource type.
|
||||
Type string `json:"type,omitempty" mutable:"case"`
|
||||
|
||||
// SystemData metadata relating to this resource.
|
||||
SystemData *SystemData `json:"systemData,omitempty"`
|
||||
|
||||
// The MachinePool Properties
|
||||
Properties MachinePoolProperties `json:"properties,omitempty"`
|
||||
}
|
||||
|
||||
// MachinePoolProperties represents the properties of a MachinePool
|
||||
type MachinePoolProperties struct {
|
||||
Resources string `json:"resources,omitempty"`
|
||||
}
|
||||
|
||||
// SyncSetList represents a list of SyncSets
|
||||
type SyncIdentityProviderList struct {
|
||||
// The list of sync identity providers
|
||||
SyncIdentityProviders []*SyncIdentityProvider `json:"value"`
|
||||
|
||||
// The link used to get the next page of operations.
|
||||
NextLink string `json:"nextLink,omitempty"`
|
||||
}
|
||||
|
||||
// SyncIdentityProvider represents a SyncIdentityProvider
|
||||
type SyncIdentityProvider struct {
|
||||
// This is a flag used during the swagger generation typewalker to
|
||||
// signal that it should be marked as a proxy resource and
|
||||
// not a tracked ARM resource.
|
||||
proxyResource bool
|
||||
|
||||
// The Resource ID.
|
||||
ID string `json:"id,omitempty"`
|
||||
|
||||
// The resource name.
|
||||
Name string `json:"name,omitempty"`
|
||||
|
||||
// The resource type.
|
||||
Type string `json:"type,omitempty" mutable:"case"`
|
||||
|
||||
// SystemData metadata relating to this resource.
|
||||
SystemData *SystemData `json:"systemData,omitempty"`
|
||||
|
||||
// The SyncIdentityProvider Properties
|
||||
Properties SyncIdentityProviderProperties `json:"properties,omitempty"`
|
||||
}
|
||||
|
||||
// SyncSetProperties represents the properties of a SyncSet
|
||||
type SyncIdentityProviderProperties struct {
|
||||
Resources string `json:"resources,omitempty"`
|
||||
}
|
||||
|
||||
// SecretList represents a list of Secrets
|
||||
type SecretList struct {
|
||||
// The list of secrets.
|
||||
Secrets []*Secret `json:"value"`
|
||||
|
||||
// The link used to get the next page of operations.
|
||||
NextLink string `json:"nextLink,omitempty"`
|
||||
}
|
||||
|
||||
// Secret represents a secret.
|
||||
type Secret struct {
|
||||
// This is a flag used during the swagger generation typewalker to
|
||||
// signal that it should be marked as a proxy resource and
|
||||
// not a tracked ARM resource.
|
||||
proxyResource bool
|
||||
|
||||
// The Resource ID.
|
||||
ID string `json:"id,omitempty"`
|
||||
|
||||
// The resource name.
|
||||
Name string `json:"name,omitempty"`
|
||||
|
||||
// The resource type.
|
||||
Type string `json:"type,omitempty" mutable:"case"`
|
||||
|
||||
// SystemData metadata relating to this resource.
|
||||
SystemData *SystemData `json:"systemData,omitempty"`
|
||||
|
||||
// The Secret Properties
|
||||
Properties SecretProperties `json:"properties,omitempty"`
|
||||
}
|
||||
|
||||
// SecretProperties represents the properties of a Secret
|
||||
type SecretProperties struct {
|
||||
// The Secrets Resources.
|
||||
SecretResources string `json:"secretResources,omitempty"`
|
||||
}
|
|
@ -0,0 +1,88 @@
|
|||
package v20220904
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the Apache License 2.0.
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"github.com/Azure/ARO-RP/pkg/api"
|
||||
)
|
||||
|
||||
type clusterManagerConfigurationConverter struct{}
|
||||
|
||||
func (c clusterManagerConfigurationConverter) ToExternal(ocm *api.ClusterManagerConfiguration) (interface{}, error) {
|
||||
out := new(ClusterManagerConfiguration)
|
||||
out.ID = ocm.ID
|
||||
var data interface{}
|
||||
err := json.Unmarshal(ocm.Properties.Resources, &data)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
out.Properties.Resources = data
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c clusterManagerConfigurationConverter) SyncSetToExternal(ocm *api.SyncSet) interface{} {
|
||||
out := new(SyncSet)
|
||||
out.proxyResource = true
|
||||
out.ID = ocm.ID
|
||||
out.Name = ocm.Name
|
||||
out.Type = ocm.Type
|
||||
out.Properties.Resources = ocm.Properties.Resources
|
||||
return out
|
||||
}
|
||||
|
||||
func (c clusterManagerConfigurationConverter) MachinePoolToExternal(ocm *api.MachinePool) interface{} {
|
||||
out := new(MachinePool)
|
||||
out.proxyResource = true
|
||||
out.ID = ocm.ID
|
||||
out.Name = ocm.Name
|
||||
out.Type = ocm.Type
|
||||
out.Properties.Resources = ocm.Properties.Resources
|
||||
return out
|
||||
}
|
||||
|
||||
func (c clusterManagerConfigurationConverter) SyncIdentityProviderToExternal(ocm *api.SyncIdentityProvider) interface{} {
|
||||
out := new(SyncIdentityProvider)
|
||||
out.proxyResource = true
|
||||
out.ID = ocm.ID
|
||||
out.Name = ocm.Name
|
||||
out.Type = ocm.Type
|
||||
out.Properties.Resources = ocm.Properties.Resources
|
||||
return out
|
||||
}
|
||||
|
||||
func (c clusterManagerConfigurationConverter) SecretToExternal(ocm *api.Secret) interface{} {
|
||||
out := new(Secret)
|
||||
out.proxyResource = true
|
||||
out.ID = ocm.ID
|
||||
out.Name = ocm.Name
|
||||
out.Type = ocm.Type
|
||||
out.Properties.SecretResources = ""
|
||||
return out
|
||||
}
|
||||
|
||||
func (c clusterManagerConfigurationConverter) ToInternal(_ocm interface{}, out *api.ClusterManagerConfiguration) error {
|
||||
ocm := _ocm.(*api.ClusterManagerConfiguration)
|
||||
out.ID = ocm.ID
|
||||
return nil
|
||||
}
|
||||
|
||||
// ToExternalList returns a slice of external representations of the internal objects
|
||||
func (c clusterManagerConfigurationConverter) ToExternalList(ocms []*api.ClusterManagerConfiguration, nextLink string) (interface{}, error) {
|
||||
l := &ClusterManagerConfigurationList{
|
||||
ClusterManagerConfigurations: make([]*ClusterManagerConfiguration, 0, len(ocms)),
|
||||
NextLink: nextLink,
|
||||
}
|
||||
|
||||
for _, ocm := range ocms {
|
||||
c, err := c.ToExternal(ocm)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
l.ClusterManagerConfigurations = append(l.ClusterManagerConfigurations, c.(*ClusterManagerConfiguration))
|
||||
}
|
||||
|
||||
return l, nil
|
||||
}
|
|
@ -0,0 +1,125 @@
|
|||
package v20220904
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the Apache License 2.0.
|
||||
|
||||
import (
|
||||
"github.com/Azure/ARO-RP/pkg/api"
|
||||
)
|
||||
|
||||
func exampleSyncSet() *SyncSet {
|
||||
doc := api.ExampleClusterManagerConfigurationDocumentSyncSet()
|
||||
doc.SyncSet.ID = ""
|
||||
doc.SyncSet.Type = ""
|
||||
doc.SyncSet.Name = ""
|
||||
ext := (&clusterManagerConfigurationConverter{}).SyncSetToExternal(doc.SyncSet)
|
||||
return ext.(*SyncSet)
|
||||
}
|
||||
|
||||
func ExampleSyncSetPutParameter() interface{} {
|
||||
return exampleSyncSet()
|
||||
}
|
||||
|
||||
func ExampleSyncSetPatchParameter() interface{} {
|
||||
return exampleSyncSet()
|
||||
}
|
||||
|
||||
func ExampleSyncSetResponse() interface{} {
|
||||
return exampleSyncSet()
|
||||
}
|
||||
|
||||
func ExampleSyncSetListResponse() interface{} {
|
||||
return &SyncSetList{
|
||||
SyncSets: []*SyncSet{
|
||||
ExampleSyncSetResponse().(*SyncSet),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func exampleMachinePool() *MachinePool {
|
||||
doc := api.ExampleClusterManagerConfigurationDocumentMachinePool()
|
||||
doc.MachinePool.ID = ""
|
||||
doc.MachinePool.Type = ""
|
||||
doc.MachinePool.Name = ""
|
||||
ext := (&clusterManagerConfigurationConverter{}).MachinePoolToExternal(doc.MachinePool)
|
||||
|
||||
return ext.(*MachinePool)
|
||||
}
|
||||
|
||||
func ExampleMachinePoolPutParameter() interface{} {
|
||||
return exampleMachinePool()
|
||||
}
|
||||
|
||||
func ExampleMachinePoolPatchParameter() interface{} {
|
||||
return exampleMachinePool()
|
||||
}
|
||||
|
||||
func ExampleMachinePoolResponse() interface{} {
|
||||
return exampleMachinePool()
|
||||
}
|
||||
|
||||
func ExampleMachinePoolListResponse() interface{} {
|
||||
return &MachinePoolList{
|
||||
MachinePools: []*MachinePool{
|
||||
ExampleMachinePoolResponse().(*MachinePool),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func exampleSyncIdentityProvider() *SyncIdentityProvider {
|
||||
doc := api.ExampleClusterManagerConfigurationDocumentSyncIdentityProvider()
|
||||
doc.SyncIdentityProvider.ID = ""
|
||||
doc.SyncIdentityProvider.Type = ""
|
||||
doc.SyncIdentityProvider.Name = ""
|
||||
ext := (&clusterManagerConfigurationConverter{}).SyncIdentityProviderToExternal(doc.SyncIdentityProvider)
|
||||
return ext.(*SyncIdentityProvider)
|
||||
}
|
||||
|
||||
func ExampleSyncIdentityProviderPutParameter() interface{} {
|
||||
return exampleSyncIdentityProvider()
|
||||
}
|
||||
|
||||
func ExampleSyncIdentityProviderPatchParameter() interface{} {
|
||||
return exampleSyncIdentityProvider()
|
||||
}
|
||||
|
||||
func ExampleSyncIdentityProviderResponse() interface{} {
|
||||
return exampleSyncIdentityProvider()
|
||||
}
|
||||
|
||||
func ExampleSyncIdentityProviderListResponse() interface{} {
|
||||
return &SyncIdentityProviderList{
|
||||
SyncIdentityProviders: []*SyncIdentityProvider{
|
||||
ExampleSyncIdentityProviderResponse().(*SyncIdentityProvider),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func exampleSecret() *Secret {
|
||||
doc := api.ExampleClusterManagerConfigurationDocumentSecret()
|
||||
doc.Secret.ID = ""
|
||||
doc.Secret.Type = ""
|
||||
doc.Secret.Name = ""
|
||||
ext := (&clusterManagerConfigurationConverter{}).SecretToExternal(doc.Secret)
|
||||
return ext.(*Secret)
|
||||
}
|
||||
|
||||
func ExampleSecretPutParameter() interface{} {
|
||||
return exampleSecret()
|
||||
}
|
||||
|
||||
func ExampleSecretPatchParameter() interface{} {
|
||||
return exampleSecret()
|
||||
}
|
||||
|
||||
func ExampleSecretResponse() interface{} {
|
||||
return exampleSecret()
|
||||
}
|
||||
|
||||
func ExampleSecretListResponse() interface{} {
|
||||
return &SecretList{
|
||||
Secrets: []*Secret{
|
||||
ExampleSecretResponse().(*Secret),
|
||||
},
|
||||
}
|
||||
}
|
|
@ -33,6 +33,15 @@ func init() {
|
|||
api.OperationOpenShiftClusterListCredentials,
|
||||
api.OperationOpenShiftClusterListAdminCredentials,
|
||||
api.OperationListInstallVersions,
|
||||
api.OperationSyncSetsRead,
|
||||
api.OperationSyncSetsWrite,
|
||||
api.OperationSyncSetsDelete,
|
||||
api.OperationMachinePoolsRead,
|
||||
api.OperationMachinePoolsWrite,
|
||||
api.OperationMachinePoolsDelete,
|
||||
api.OperationSyncIdentityProvidersRead,
|
||||
api.OperationSyncIdentityProvidersWrite,
|
||||
api.OperationSyncIdentityProvidersDelete,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
@ -27,28 +27,28 @@ import (
|
|||
"github.com/Azure/go-autorest/tracing"
|
||||
)
|
||||
|
||||
// ListClient is the rest API for Azure Red Hat OpenShift 4
|
||||
type ListClient struct {
|
||||
// InstallVersionsClient is the rest API for Azure Red Hat OpenShift 4
|
||||
type InstallVersionsClient struct {
|
||||
BaseClient
|
||||
}
|
||||
|
||||
// NewListClient creates an instance of the ListClient client.
|
||||
func NewListClient(subscriptionID string) ListClient {
|
||||
return NewListClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||
// NewInstallVersionsClient creates an instance of the InstallVersionsClient client.
|
||||
func NewInstallVersionsClient(subscriptionID string) InstallVersionsClient {
|
||||
return NewInstallVersionsClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||
}
|
||||
|
||||
// NewListClientWithBaseURI creates an instance of the ListClient 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 NewListClientWithBaseURI(baseURI string, subscriptionID string) ListClient {
|
||||
return ListClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||
// NewInstallVersionsClientWithBaseURI creates an instance of the InstallVersionsClient 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 NewInstallVersionsClientWithBaseURI(baseURI string, subscriptionID string) InstallVersionsClient {
|
||||
return InstallVersionsClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||
}
|
||||
|
||||
// Versions the operation returns the installable OpenShift versions as strings.
|
||||
// List the operation returns the installable OpenShift versions as strings.
|
||||
// Parameters:
|
||||
// location - the name of Azure region.
|
||||
func (client ListClient) Versions(ctx context.Context, location string) (result ListString, err error) {
|
||||
func (client InstallVersionsClient) List(ctx context.Context, location string) (result ListString, err error) {
|
||||
if tracing.IsEnabled() {
|
||||
ctx = tracing.StartSpan(ctx, fqdn+"/ListClient.Versions")
|
||||
ctx = tracing.StartSpan(ctx, fqdn+"/InstallVersionsClient.List")
|
||||
defer func() {
|
||||
sc := -1
|
||||
if result.Response.Response != nil {
|
||||
|
@ -62,33 +62,33 @@ func (client ListClient) Versions(ctx context.Context, location string) (result
|
|||
Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
|
||||
{TargetValue: location,
|
||||
Constraints: []validation.Constraint{{Target: "location", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewError("redhatopenshift.ListClient", "Versions", err.Error())
|
||||
return result, validation.NewError("redhatopenshift.InstallVersionsClient", "List", err.Error())
|
||||
}
|
||||
|
||||
req, err := client.VersionsPreparer(ctx, location)
|
||||
req, err := client.ListPreparer(ctx, location)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redhatopenshift.ListClient", "Versions", nil, "Failure preparing request")
|
||||
err = autorest.NewErrorWithError(err, "redhatopenshift.InstallVersionsClient", "List", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.VersionsSender(req)
|
||||
resp, err := client.ListSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "redhatopenshift.ListClient", "Versions", resp, "Failure sending request")
|
||||
err = autorest.NewErrorWithError(err, "redhatopenshift.InstallVersionsClient", "List", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.VersionsResponder(resp)
|
||||
result, err = client.ListResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redhatopenshift.ListClient", "Versions", resp, "Failure responding to request")
|
||||
err = autorest.NewErrorWithError(err, "redhatopenshift.InstallVersionsClient", "List", resp, "Failure responding to request")
|
||||
return
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// VersionsPreparer prepares the Versions request.
|
||||
func (client ListClient) VersionsPreparer(ctx context.Context, location string) (*http.Request, error) {
|
||||
// ListPreparer prepares the List request.
|
||||
func (client InstallVersionsClient) ListPreparer(ctx context.Context, location string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"location": autorest.Encode("path", location),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
|
@ -107,15 +107,15 @@ func (client ListClient) VersionsPreparer(ctx context.Context, location string)
|
|||
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||
}
|
||||
|
||||
// VersionsSender sends the Versions request. The method will close the
|
||||
// ListSender sends the List request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client ListClient) VersionsSender(req *http.Request) (*http.Response, error) {
|
||||
func (client InstallVersionsClient) ListSender(req *http.Request) (*http.Response, error) {
|
||||
return client.Send(req, azure.DoRetryWithRegistration(client.Client))
|
||||
}
|
||||
|
||||
// VersionsResponder handles the response to the Versions request. The method always
|
||||
// ListResponder handles the response to the List request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client ListClient) VersionsResponder(resp *http.Response) (result ListString, err error) {
|
||||
func (client InstallVersionsClient) ListResponder(resp *http.Response) (result ListString, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
|
@ -0,0 +1,525 @@
|
|||
package redhatopenshift
|
||||
|
||||
// Copyright (c) Microsoft and contributors. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
//
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
"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"
|
||||
)
|
||||
|
||||
// MachinePoolsClient is the rest API for Azure Red Hat OpenShift 4
|
||||
type MachinePoolsClient struct {
|
||||
BaseClient
|
||||
}
|
||||
|
||||
// NewMachinePoolsClient creates an instance of the MachinePoolsClient client.
|
||||
func NewMachinePoolsClient(subscriptionID string) MachinePoolsClient {
|
||||
return NewMachinePoolsClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||
}
|
||||
|
||||
// NewMachinePoolsClientWithBaseURI creates an instance of the MachinePoolsClient 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 NewMachinePoolsClientWithBaseURI(baseURI string, subscriptionID string) MachinePoolsClient {
|
||||
return MachinePoolsClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||
}
|
||||
|
||||
// CreateOrUpdate the operation returns properties of a MachinePool.
|
||||
// Parameters:
|
||||
// resourceGroupName - the name of the resource group. The name is case insensitive.
|
||||
// resourceName - the name of the OpenShift cluster resource.
|
||||
// childResourceName - the name of the MachinePool resource.
|
||||
// parameters - the MachinePool resource.
|
||||
func (client MachinePoolsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string, parameters MachinePool) (result MachinePool, err error) {
|
||||
if tracing.IsEnabled() {
|
||||
ctx = tracing.StartSpan(ctx, fqdn+"/MachinePoolsClient.CreateOrUpdate")
|
||||
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: client.SubscriptionID,
|
||||
Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
|
||||
{TargetValue: resourceGroupName,
|
||||
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
|
||||
{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewError("redhatopenshift.MachinePoolsClient", "CreateOrUpdate", err.Error())
|
||||
}
|
||||
|
||||
req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, resourceName, childResourceName, parameters)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redhatopenshift.MachinePoolsClient", "CreateOrUpdate", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.CreateOrUpdateSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "redhatopenshift.MachinePoolsClient", "CreateOrUpdate", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.CreateOrUpdateResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redhatopenshift.MachinePoolsClient", "CreateOrUpdate", resp, "Failure responding to request")
|
||||
return
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
|
||||
func (client MachinePoolsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string, parameters MachinePool) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"childResourceName": autorest.Encode("path", childResourceName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"resourceName": autorest.Encode("path", resourceName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
const APIVersion = "2022-09-04"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsContentType("application/json; charset=utf-8"),
|
||||
autorest.AsPut(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/machinePool/{childResourceName}", pathParameters),
|
||||
autorest.WithJSON(parameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||
}
|
||||
|
||||
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client MachinePoolsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) {
|
||||
return client.Send(req, azure.DoRetryWithRegistration(client.Client))
|
||||
}
|
||||
|
||||
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client MachinePoolsClient) CreateOrUpdateResponder(resp *http.Response) (result MachinePool, 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 the operation returns nothing.
|
||||
// Parameters:
|
||||
// resourceGroupName - the name of the resource group. The name is case insensitive.
|
||||
// resourceName - the name of the OpenShift cluster resource.
|
||||
// childResourceName - the name of the MachinePool resource.
|
||||
func (client MachinePoolsClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string) (result autorest.Response, err error) {
|
||||
if tracing.IsEnabled() {
|
||||
ctx = tracing.StartSpan(ctx, fqdn+"/MachinePoolsClient.Delete")
|
||||
defer func() {
|
||||
sc := -1
|
||||
if result.Response != nil {
|
||||
sc = result.Response.StatusCode
|
||||
}
|
||||
tracing.EndSpan(ctx, sc, err)
|
||||
}()
|
||||
}
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: client.SubscriptionID,
|
||||
Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
|
||||
{TargetValue: resourceGroupName,
|
||||
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
|
||||
{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewError("redhatopenshift.MachinePoolsClient", "Delete", err.Error())
|
||||
}
|
||||
|
||||
req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName, childResourceName)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redhatopenshift.MachinePoolsClient", "Delete", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.DeleteSender(req)
|
||||
if err != nil {
|
||||
result.Response = resp
|
||||
err = autorest.NewErrorWithError(err, "redhatopenshift.MachinePoolsClient", "Delete", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.DeleteResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redhatopenshift.MachinePoolsClient", "Delete", resp, "Failure responding to request")
|
||||
return
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// DeletePreparer prepares the Delete request.
|
||||
func (client MachinePoolsClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"childResourceName": autorest.Encode("path", childResourceName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"resourceName": autorest.Encode("path", resourceName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
const APIVersion = "2022-09-04"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsDelete(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/machinePool/{childResourceName}", 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 MachinePoolsClient) DeleteSender(req *http.Request) (*http.Response, error) {
|
||||
return client.Send(req, azure.DoRetryWithRegistration(client.Client))
|
||||
}
|
||||
|
||||
// DeleteResponder handles the response to the Delete request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client MachinePoolsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
|
||||
autorest.ByClosing())
|
||||
result.Response = resp
|
||||
return
|
||||
}
|
||||
|
||||
// Get the operation returns properties of a MachinePool.
|
||||
// Parameters:
|
||||
// resourceGroupName - the name of the resource group. The name is case insensitive.
|
||||
// resourceName - the name of the OpenShift cluster resource.
|
||||
// childResourceName - the name of the MachinePool resource.
|
||||
func (client MachinePoolsClient) Get(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string) (result MachinePool, err error) {
|
||||
if tracing.IsEnabled() {
|
||||
ctx = tracing.StartSpan(ctx, fqdn+"/MachinePoolsClient.Get")
|
||||
defer func() {
|
||||
sc := -1
|
||||
if result.Response.Response != nil {
|
||||
sc = result.Response.Response.StatusCode
|
||||
}
|
||||
tracing.EndSpan(ctx, sc, err)
|
||||
}()
|
||||
}
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: client.SubscriptionID,
|
||||
Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
|
||||
{TargetValue: resourceGroupName,
|
||||
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
|
||||
{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewError("redhatopenshift.MachinePoolsClient", "Get", err.Error())
|
||||
}
|
||||
|
||||
req, err := client.GetPreparer(ctx, resourceGroupName, resourceName, childResourceName)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redhatopenshift.MachinePoolsClient", "Get", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.GetSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "redhatopenshift.MachinePoolsClient", "Get", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.GetResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redhatopenshift.MachinePoolsClient", "Get", resp, "Failure responding to request")
|
||||
return
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// GetPreparer prepares the Get request.
|
||||
func (client MachinePoolsClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"childResourceName": autorest.Encode("path", childResourceName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"resourceName": autorest.Encode("path", resourceName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
const APIVersion = "2022-09-04"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/machinePool/{childResourceName}", 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 MachinePoolsClient) 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 MachinePoolsClient) GetResponder(resp *http.Response) (result MachinePool, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// List the operation returns properties of each MachinePool.
|
||||
// Parameters:
|
||||
// resourceGroupName - the name of the resource group. The name is case insensitive.
|
||||
// resourceName - the name of the OpenShift cluster resource.
|
||||
func (client MachinePoolsClient) List(ctx context.Context, resourceGroupName string, resourceName string) (result MachinePoolListPage, err error) {
|
||||
if tracing.IsEnabled() {
|
||||
ctx = tracing.StartSpan(ctx, fqdn+"/MachinePoolsClient.List")
|
||||
defer func() {
|
||||
sc := -1
|
||||
if result.mpl.Response.Response != nil {
|
||||
sc = result.mpl.Response.Response.StatusCode
|
||||
}
|
||||
tracing.EndSpan(ctx, sc, err)
|
||||
}()
|
||||
}
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: client.SubscriptionID,
|
||||
Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
|
||||
{TargetValue: resourceGroupName,
|
||||
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
|
||||
{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewError("redhatopenshift.MachinePoolsClient", "List", err.Error())
|
||||
}
|
||||
|
||||
result.fn = client.listNextResults
|
||||
req, err := client.ListPreparer(ctx, resourceGroupName, resourceName)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redhatopenshift.MachinePoolsClient", "List", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListSender(req)
|
||||
if err != nil {
|
||||
result.mpl.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "redhatopenshift.MachinePoolsClient", "List", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result.mpl, err = client.ListResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redhatopenshift.MachinePoolsClient", "List", resp, "Failure responding to request")
|
||||
return
|
||||
}
|
||||
if result.mpl.hasNextLink() && result.mpl.IsEmpty() {
|
||||
err = result.NextWithContext(ctx)
|
||||
return
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListPreparer prepares the List request.
|
||||
func (client MachinePoolsClient) ListPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"resourceName": autorest.Encode("path", resourceName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
const APIVersion = "2022-09-04"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftCluster/{resourceName}/machinePools", 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 MachinePoolsClient) 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 MachinePoolsClient) ListResponder(resp *http.Response) (result MachinePoolList, 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 MachinePoolsClient) listNextResults(ctx context.Context, lastResults MachinePoolList) (result MachinePoolList, err error) {
|
||||
req, err := lastResults.machinePoolListPreparer(ctx)
|
||||
if err != nil {
|
||||
return result, autorest.NewErrorWithError(err, "redhatopenshift.MachinePoolsClient", "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, "redhatopenshift.MachinePoolsClient", "listNextResults", resp, "Failure sending next results request")
|
||||
}
|
||||
result, err = client.ListResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redhatopenshift.MachinePoolsClient", "listNextResults", resp, "Failure responding to next results request")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// ListComplete enumerates all values, automatically crossing page boundaries as required.
|
||||
func (client MachinePoolsClient) ListComplete(ctx context.Context, resourceGroupName string, resourceName string) (result MachinePoolListIterator, err error) {
|
||||
if tracing.IsEnabled() {
|
||||
ctx = tracing.StartSpan(ctx, fqdn+"/MachinePoolsClient.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, resourceGroupName, resourceName)
|
||||
return
|
||||
}
|
||||
|
||||
// Update the operation returns properties of a MachinePool.
|
||||
// Parameters:
|
||||
// resourceGroupName - the name of the resource group. The name is case insensitive.
|
||||
// resourceName - the name of the OpenShift cluster resource.
|
||||
// childResourceName - the name of the MachinePool resource.
|
||||
// parameters - the MachinePool resource.
|
||||
func (client MachinePoolsClient) Update(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string, parameters MachinePoolUpdate) (result MachinePool, err error) {
|
||||
if tracing.IsEnabled() {
|
||||
ctx = tracing.StartSpan(ctx, fqdn+"/MachinePoolsClient.Update")
|
||||
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: client.SubscriptionID,
|
||||
Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
|
||||
{TargetValue: resourceGroupName,
|
||||
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
|
||||
{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewError("redhatopenshift.MachinePoolsClient", "Update", err.Error())
|
||||
}
|
||||
|
||||
req, err := client.UpdatePreparer(ctx, resourceGroupName, resourceName, childResourceName, parameters)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redhatopenshift.MachinePoolsClient", "Update", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.UpdateSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "redhatopenshift.MachinePoolsClient", "Update", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.UpdateResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redhatopenshift.MachinePoolsClient", "Update", resp, "Failure responding to request")
|
||||
return
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// UpdatePreparer prepares the Update request.
|
||||
func (client MachinePoolsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string, parameters MachinePoolUpdate) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"childResourceName": autorest.Encode("path", childResourceName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"resourceName": autorest.Encode("path", resourceName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
const APIVersion = "2022-09-04"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
parameters.SystemData = nil
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsContentType("application/json; charset=utf-8"),
|
||||
autorest.AsPatch(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/machinePool/{childResourceName}", pathParameters),
|
||||
autorest.WithJSON(parameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||
}
|
||||
|
||||
// UpdateSender sends the Update request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client MachinePoolsClient) 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 MachinePoolsClient) UpdateResponder(resp *http.Response) (result MachinePool, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -307,6 +307,125 @@ func (client OpenShiftClustersClient) GetResponder(resp *http.Response) (result
|
|||
return
|
||||
}
|
||||
|
||||
// List the operation returns properties of each OpenShift cluster.
|
||||
func (client OpenShiftClustersClient) List(ctx context.Context) (result OpenShiftClusterListPage, err error) {
|
||||
if tracing.IsEnabled() {
|
||||
ctx = tracing.StartSpan(ctx, fqdn+"/OpenShiftClustersClient.List")
|
||||
defer func() {
|
||||
sc := -1
|
||||
if result.oscl.Response.Response != nil {
|
||||
sc = result.oscl.Response.Response.StatusCode
|
||||
}
|
||||
tracing.EndSpan(ctx, sc, err)
|
||||
}()
|
||||
}
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: client.SubscriptionID,
|
||||
Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewError("redhatopenshift.OpenShiftClustersClient", "List", err.Error())
|
||||
}
|
||||
|
||||
result.fn = client.listNextResults
|
||||
req, err := client.ListPreparer(ctx)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redhatopenshift.OpenShiftClustersClient", "List", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListSender(req)
|
||||
if err != nil {
|
||||
result.oscl.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "redhatopenshift.OpenShiftClustersClient", "List", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result.oscl, err = client.ListResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redhatopenshift.OpenShiftClustersClient", "List", resp, "Failure responding to request")
|
||||
return
|
||||
}
|
||||
if result.oscl.hasNextLink() && result.oscl.IsEmpty() {
|
||||
err = result.NextWithContext(ctx)
|
||||
return
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListPreparer prepares the List request.
|
||||
func (client OpenShiftClustersClient) ListPreparer(ctx context.Context) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
const APIVersion = "2022-09-04"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.RedHatOpenShift/openShiftClusters", 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 OpenShiftClustersClient) 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 OpenShiftClustersClient) ListResponder(resp *http.Response) (result OpenShiftClusterList, 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 OpenShiftClustersClient) listNextResults(ctx context.Context, lastResults OpenShiftClusterList) (result OpenShiftClusterList, err error) {
|
||||
req, err := lastResults.openShiftClusterListPreparer(ctx)
|
||||
if err != nil {
|
||||
return result, autorest.NewErrorWithError(err, "redhatopenshift.OpenShiftClustersClient", "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, "redhatopenshift.OpenShiftClustersClient", "listNextResults", resp, "Failure sending next results request")
|
||||
}
|
||||
result, err = client.ListResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redhatopenshift.OpenShiftClustersClient", "listNextResults", resp, "Failure responding to next results request")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// ListComplete enumerates all values, automatically crossing page boundaries as required.
|
||||
func (client OpenShiftClustersClient) ListComplete(ctx context.Context) (result OpenShiftClusterListIterator, err error) {
|
||||
if tracing.IsEnabled() {
|
||||
ctx = tracing.StartSpan(ctx, fqdn+"/OpenShiftClustersClient.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
|
||||
}
|
||||
|
||||
// ListAdminCredentials the operation returns the admin kubeconfig.
|
||||
// Parameters:
|
||||
// resourceGroupName - the name of the resource group. The name is case insensitive.
|
||||
|
@ -602,125 +721,6 @@ func (client OpenShiftClustersClient) ListCredentialsResponder(resp *http.Respon
|
|||
return
|
||||
}
|
||||
|
||||
// ListMethod the operation returns properties of each OpenShift cluster.
|
||||
func (client OpenShiftClustersClient) ListMethod(ctx context.Context) (result OpenShiftClusterListPage, err error) {
|
||||
if tracing.IsEnabled() {
|
||||
ctx = tracing.StartSpan(ctx, fqdn+"/OpenShiftClustersClient.ListMethod")
|
||||
defer func() {
|
||||
sc := -1
|
||||
if result.oscl.Response.Response != nil {
|
||||
sc = result.oscl.Response.Response.StatusCode
|
||||
}
|
||||
tracing.EndSpan(ctx, sc, err)
|
||||
}()
|
||||
}
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: client.SubscriptionID,
|
||||
Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewError("redhatopenshift.OpenShiftClustersClient", "ListMethod", err.Error())
|
||||
}
|
||||
|
||||
result.fn = client.listMethodNextResults
|
||||
req, err := client.ListMethodPreparer(ctx)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redhatopenshift.OpenShiftClustersClient", "ListMethod", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListMethodSender(req)
|
||||
if err != nil {
|
||||
result.oscl.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "redhatopenshift.OpenShiftClustersClient", "ListMethod", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result.oscl, err = client.ListMethodResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redhatopenshift.OpenShiftClustersClient", "ListMethod", resp, "Failure responding to request")
|
||||
return
|
||||
}
|
||||
if result.oscl.hasNextLink() && result.oscl.IsEmpty() {
|
||||
err = result.NextWithContext(ctx)
|
||||
return
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListMethodPreparer prepares the ListMethod request.
|
||||
func (client OpenShiftClustersClient) ListMethodPreparer(ctx context.Context) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
const APIVersion = "2022-09-04"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.RedHatOpenShift/openShiftClusters", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||
}
|
||||
|
||||
// ListMethodSender sends the ListMethod request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client OpenShiftClustersClient) ListMethodSender(req *http.Request) (*http.Response, error) {
|
||||
return client.Send(req, azure.DoRetryWithRegistration(client.Client))
|
||||
}
|
||||
|
||||
// ListMethodResponder handles the response to the ListMethod request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client OpenShiftClustersClient) ListMethodResponder(resp *http.Response) (result OpenShiftClusterList, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// listMethodNextResults retrieves the next set of results, if any.
|
||||
func (client OpenShiftClustersClient) listMethodNextResults(ctx context.Context, lastResults OpenShiftClusterList) (result OpenShiftClusterList, err error) {
|
||||
req, err := lastResults.openShiftClusterListPreparer(ctx)
|
||||
if err != nil {
|
||||
return result, autorest.NewErrorWithError(err, "redhatopenshift.OpenShiftClustersClient", "listMethodNextResults", nil, "Failure preparing next results request")
|
||||
}
|
||||
if req == nil {
|
||||
return
|
||||
}
|
||||
resp, err := client.ListMethodSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return result, autorest.NewErrorWithError(err, "redhatopenshift.OpenShiftClustersClient", "listMethodNextResults", resp, "Failure sending next results request")
|
||||
}
|
||||
result, err = client.ListMethodResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redhatopenshift.OpenShiftClustersClient", "listMethodNextResults", resp, "Failure responding to next results request")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// ListMethodComplete enumerates all values, automatically crossing page boundaries as required.
|
||||
func (client OpenShiftClustersClient) ListMethodComplete(ctx context.Context) (result OpenShiftClusterListIterator, err error) {
|
||||
if tracing.IsEnabled() {
|
||||
ctx = tracing.StartSpan(ctx, fqdn+"/OpenShiftClustersClient.ListMethod")
|
||||
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.ListMethod(ctx)
|
||||
return
|
||||
}
|
||||
|
||||
// Update the operation returns properties of a OpenShift cluster.
|
||||
// Parameters:
|
||||
// resourceGroupName - the name of the resource group. The name is case insensitive.
|
||||
|
|
|
@ -20,6 +20,8 @@ package redhatopenshiftapi
|
|||
import (
|
||||
"context"
|
||||
|
||||
"github.com/Azure/go-autorest/autorest"
|
||||
|
||||
"github.com/Azure/ARO-RP/pkg/client/services/redhatopenshift/mgmt/2022-09-04/redhatopenshift"
|
||||
)
|
||||
|
||||
|
@ -31,25 +33,73 @@ type OperationsClientAPI interface {
|
|||
|
||||
var _ OperationsClientAPI = (*redhatopenshift.OperationsClient)(nil)
|
||||
|
||||
// ListClientAPI contains the set of methods on the ListClient type.
|
||||
type ListClientAPI interface {
|
||||
Versions(ctx context.Context, location string) (result redhatopenshift.ListString, err error)
|
||||
// InstallVersionsClientAPI contains the set of methods on the InstallVersionsClient type.
|
||||
type InstallVersionsClientAPI interface {
|
||||
List(ctx context.Context, location string) (result redhatopenshift.ListString, err error)
|
||||
}
|
||||
|
||||
var _ ListClientAPI = (*redhatopenshift.ListClient)(nil)
|
||||
var _ InstallVersionsClientAPI = (*redhatopenshift.InstallVersionsClient)(nil)
|
||||
|
||||
// OpenShiftClustersClientAPI contains the set of methods on the OpenShiftClustersClient type.
|
||||
type OpenShiftClustersClientAPI interface {
|
||||
CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, parameters redhatopenshift.OpenShiftCluster) (result redhatopenshift.OpenShiftClustersCreateOrUpdateFuture, err error)
|
||||
Delete(ctx context.Context, resourceGroupName string, resourceName string) (result redhatopenshift.OpenShiftClustersDeleteFuture, err error)
|
||||
Get(ctx context.Context, resourceGroupName string, resourceName string) (result redhatopenshift.OpenShiftCluster, err error)
|
||||
List(ctx context.Context) (result redhatopenshift.OpenShiftClusterListPage, err error)
|
||||
ListComplete(ctx context.Context) (result redhatopenshift.OpenShiftClusterListIterator, err error)
|
||||
ListAdminCredentials(ctx context.Context, resourceGroupName string, resourceName string) (result redhatopenshift.OpenShiftClusterAdminKubeconfig, err error)
|
||||
ListByResourceGroup(ctx context.Context, resourceGroupName string) (result redhatopenshift.OpenShiftClusterListPage, err error)
|
||||
ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result redhatopenshift.OpenShiftClusterListIterator, err error)
|
||||
ListCredentials(ctx context.Context, resourceGroupName string, resourceName string) (result redhatopenshift.OpenShiftClusterCredentials, err error)
|
||||
ListMethod(ctx context.Context) (result redhatopenshift.OpenShiftClusterListPage, err error)
|
||||
ListMethodComplete(ctx context.Context) (result redhatopenshift.OpenShiftClusterListIterator, err error)
|
||||
Update(ctx context.Context, resourceGroupName string, resourceName string, parameters redhatopenshift.OpenShiftClusterUpdate) (result redhatopenshift.OpenShiftClustersUpdateFuture, err error)
|
||||
}
|
||||
|
||||
var _ OpenShiftClustersClientAPI = (*redhatopenshift.OpenShiftClustersClient)(nil)
|
||||
|
||||
// MachinePoolsClientAPI contains the set of methods on the MachinePoolsClient type.
|
||||
type MachinePoolsClientAPI interface {
|
||||
CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string, parameters redhatopenshift.MachinePool) (result redhatopenshift.MachinePool, err error)
|
||||
Delete(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string) (result autorest.Response, err error)
|
||||
Get(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string) (result redhatopenshift.MachinePool, err error)
|
||||
List(ctx context.Context, resourceGroupName string, resourceName string) (result redhatopenshift.MachinePoolListPage, err error)
|
||||
ListComplete(ctx context.Context, resourceGroupName string, resourceName string) (result redhatopenshift.MachinePoolListIterator, err error)
|
||||
Update(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string, parameters redhatopenshift.MachinePoolUpdate) (result redhatopenshift.MachinePool, err error)
|
||||
}
|
||||
|
||||
var _ MachinePoolsClientAPI = (*redhatopenshift.MachinePoolsClient)(nil)
|
||||
|
||||
// SecretsClientAPI contains the set of methods on the SecretsClient type.
|
||||
type SecretsClientAPI interface {
|
||||
CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string, parameters redhatopenshift.Secret) (result redhatopenshift.Secret, err error)
|
||||
Delete(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string) (result autorest.Response, err error)
|
||||
Get(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string) (result redhatopenshift.Secret, err error)
|
||||
List(ctx context.Context, resourceGroupName string, resourceName string) (result redhatopenshift.SecretListPage, err error)
|
||||
ListComplete(ctx context.Context, resourceGroupName string, resourceName string) (result redhatopenshift.SecretListIterator, err error)
|
||||
Update(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string, parameters redhatopenshift.SecretUpdate) (result redhatopenshift.Secret, err error)
|
||||
}
|
||||
|
||||
var _ SecretsClientAPI = (*redhatopenshift.SecretsClient)(nil)
|
||||
|
||||
// SyncIdentityProvidersClientAPI contains the set of methods on the SyncIdentityProvidersClient type.
|
||||
type SyncIdentityProvidersClientAPI interface {
|
||||
CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string, parameters redhatopenshift.SyncIdentityProvider) (result redhatopenshift.SyncIdentityProvider, err error)
|
||||
Delete(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string) (result autorest.Response, err error)
|
||||
Get(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string) (result redhatopenshift.SyncIdentityProvider, err error)
|
||||
List(ctx context.Context, resourceGroupName string, resourceName string) (result redhatopenshift.SyncIdentityProviderListPage, err error)
|
||||
ListComplete(ctx context.Context, resourceGroupName string, resourceName string) (result redhatopenshift.SyncIdentityProviderListIterator, err error)
|
||||
Update(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string, parameters redhatopenshift.SyncIdentityProviderUpdate) (result redhatopenshift.SyncIdentityProvider, err error)
|
||||
}
|
||||
|
||||
var _ SyncIdentityProvidersClientAPI = (*redhatopenshift.SyncIdentityProvidersClient)(nil)
|
||||
|
||||
// SyncSetsClientAPI contains the set of methods on the SyncSetsClient type.
|
||||
type SyncSetsClientAPI interface {
|
||||
CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string, parameters redhatopenshift.SyncSet) (result redhatopenshift.SyncSet, err error)
|
||||
Delete(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string) (result autorest.Response, err error)
|
||||
Get(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string) (result redhatopenshift.SyncSet, err error)
|
||||
List(ctx context.Context, resourceGroupName string, resourceName string) (result redhatopenshift.SyncSetListPage, err error)
|
||||
ListComplete(ctx context.Context, resourceGroupName string, resourceName string) (result redhatopenshift.SyncSetListIterator, err error)
|
||||
Update(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string, parameters redhatopenshift.SyncSetUpdate) (result redhatopenshift.SyncSet, err error)
|
||||
}
|
||||
|
||||
var _ SyncSetsClientAPI = (*redhatopenshift.SyncSetsClient)(nil)
|
||||
|
|
|
@ -0,0 +1,525 @@
|
|||
package redhatopenshift
|
||||
|
||||
// Copyright (c) Microsoft and contributors. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
//
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
"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"
|
||||
)
|
||||
|
||||
// SecretsClient is the rest API for Azure Red Hat OpenShift 4
|
||||
type SecretsClient struct {
|
||||
BaseClient
|
||||
}
|
||||
|
||||
// NewSecretsClient creates an instance of the SecretsClient client.
|
||||
func NewSecretsClient(subscriptionID string) SecretsClient {
|
||||
return NewSecretsClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||
}
|
||||
|
||||
// NewSecretsClientWithBaseURI creates an instance of the SecretsClient 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 NewSecretsClientWithBaseURI(baseURI string, subscriptionID string) SecretsClient {
|
||||
return SecretsClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||
}
|
||||
|
||||
// CreateOrUpdate the operation returns properties of a Secret.
|
||||
// Parameters:
|
||||
// resourceGroupName - the name of the resource group. The name is case insensitive.
|
||||
// resourceName - the name of the OpenShift cluster resource.
|
||||
// childResourceName - the name of the Secret resource.
|
||||
// parameters - the Secret resource.
|
||||
func (client SecretsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string, parameters Secret) (result Secret, err error) {
|
||||
if tracing.IsEnabled() {
|
||||
ctx = tracing.StartSpan(ctx, fqdn+"/SecretsClient.CreateOrUpdate")
|
||||
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: client.SubscriptionID,
|
||||
Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
|
||||
{TargetValue: resourceGroupName,
|
||||
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
|
||||
{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewError("redhatopenshift.SecretsClient", "CreateOrUpdate", err.Error())
|
||||
}
|
||||
|
||||
req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, resourceName, childResourceName, parameters)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redhatopenshift.SecretsClient", "CreateOrUpdate", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.CreateOrUpdateSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "redhatopenshift.SecretsClient", "CreateOrUpdate", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.CreateOrUpdateResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redhatopenshift.SecretsClient", "CreateOrUpdate", resp, "Failure responding to request")
|
||||
return
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
|
||||
func (client SecretsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string, parameters Secret) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"childResourceName": autorest.Encode("path", childResourceName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"resourceName": autorest.Encode("path", resourceName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
const APIVersion = "2022-09-04"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsContentType("application/json; charset=utf-8"),
|
||||
autorest.AsPut(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/secret/{childResourceName}", pathParameters),
|
||||
autorest.WithJSON(parameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||
}
|
||||
|
||||
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client SecretsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) {
|
||||
return client.Send(req, azure.DoRetryWithRegistration(client.Client))
|
||||
}
|
||||
|
||||
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client SecretsClient) CreateOrUpdateResponder(resp *http.Response) (result Secret, 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 the operation returns nothing.
|
||||
// Parameters:
|
||||
// resourceGroupName - the name of the resource group. The name is case insensitive.
|
||||
// resourceName - the name of the OpenShift cluster resource.
|
||||
// childResourceName - the name of the Secret resource.
|
||||
func (client SecretsClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string) (result autorest.Response, err error) {
|
||||
if tracing.IsEnabled() {
|
||||
ctx = tracing.StartSpan(ctx, fqdn+"/SecretsClient.Delete")
|
||||
defer func() {
|
||||
sc := -1
|
||||
if result.Response != nil {
|
||||
sc = result.Response.StatusCode
|
||||
}
|
||||
tracing.EndSpan(ctx, sc, err)
|
||||
}()
|
||||
}
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: client.SubscriptionID,
|
||||
Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
|
||||
{TargetValue: resourceGroupName,
|
||||
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
|
||||
{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewError("redhatopenshift.SecretsClient", "Delete", err.Error())
|
||||
}
|
||||
|
||||
req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName, childResourceName)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redhatopenshift.SecretsClient", "Delete", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.DeleteSender(req)
|
||||
if err != nil {
|
||||
result.Response = resp
|
||||
err = autorest.NewErrorWithError(err, "redhatopenshift.SecretsClient", "Delete", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.DeleteResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redhatopenshift.SecretsClient", "Delete", resp, "Failure responding to request")
|
||||
return
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// DeletePreparer prepares the Delete request.
|
||||
func (client SecretsClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"childResourceName": autorest.Encode("path", childResourceName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"resourceName": autorest.Encode("path", resourceName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
const APIVersion = "2022-09-04"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsDelete(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/secret/{childResourceName}", 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 SecretsClient) DeleteSender(req *http.Request) (*http.Response, error) {
|
||||
return client.Send(req, azure.DoRetryWithRegistration(client.Client))
|
||||
}
|
||||
|
||||
// DeleteResponder handles the response to the Delete request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client SecretsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
|
||||
autorest.ByClosing())
|
||||
result.Response = resp
|
||||
return
|
||||
}
|
||||
|
||||
// Get the operation returns properties of a Secret.
|
||||
// Parameters:
|
||||
// resourceGroupName - the name of the resource group. The name is case insensitive.
|
||||
// resourceName - the name of the OpenShift cluster resource.
|
||||
// childResourceName - the name of the Secret resource.
|
||||
func (client SecretsClient) Get(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string) (result Secret, err error) {
|
||||
if tracing.IsEnabled() {
|
||||
ctx = tracing.StartSpan(ctx, fqdn+"/SecretsClient.Get")
|
||||
defer func() {
|
||||
sc := -1
|
||||
if result.Response.Response != nil {
|
||||
sc = result.Response.Response.StatusCode
|
||||
}
|
||||
tracing.EndSpan(ctx, sc, err)
|
||||
}()
|
||||
}
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: client.SubscriptionID,
|
||||
Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
|
||||
{TargetValue: resourceGroupName,
|
||||
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
|
||||
{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewError("redhatopenshift.SecretsClient", "Get", err.Error())
|
||||
}
|
||||
|
||||
req, err := client.GetPreparer(ctx, resourceGroupName, resourceName, childResourceName)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redhatopenshift.SecretsClient", "Get", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.GetSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "redhatopenshift.SecretsClient", "Get", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.GetResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redhatopenshift.SecretsClient", "Get", resp, "Failure responding to request")
|
||||
return
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// GetPreparer prepares the Get request.
|
||||
func (client SecretsClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"childResourceName": autorest.Encode("path", childResourceName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"resourceName": autorest.Encode("path", resourceName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
const APIVersion = "2022-09-04"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/secret/{childResourceName}", 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 SecretsClient) 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 SecretsClient) GetResponder(resp *http.Response) (result Secret, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// List the operation returns properties of each Secret.
|
||||
// Parameters:
|
||||
// resourceGroupName - the name of the resource group. The name is case insensitive.
|
||||
// resourceName - the name of the OpenShift cluster resource.
|
||||
func (client SecretsClient) List(ctx context.Context, resourceGroupName string, resourceName string) (result SecretListPage, err error) {
|
||||
if tracing.IsEnabled() {
|
||||
ctx = tracing.StartSpan(ctx, fqdn+"/SecretsClient.List")
|
||||
defer func() {
|
||||
sc := -1
|
||||
if result.sl.Response.Response != nil {
|
||||
sc = result.sl.Response.Response.StatusCode
|
||||
}
|
||||
tracing.EndSpan(ctx, sc, err)
|
||||
}()
|
||||
}
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: client.SubscriptionID,
|
||||
Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
|
||||
{TargetValue: resourceGroupName,
|
||||
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
|
||||
{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewError("redhatopenshift.SecretsClient", "List", err.Error())
|
||||
}
|
||||
|
||||
result.fn = client.listNextResults
|
||||
req, err := client.ListPreparer(ctx, resourceGroupName, resourceName)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redhatopenshift.SecretsClient", "List", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListSender(req)
|
||||
if err != nil {
|
||||
result.sl.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "redhatopenshift.SecretsClient", "List", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result.sl, err = client.ListResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redhatopenshift.SecretsClient", "List", resp, "Failure responding to request")
|
||||
return
|
||||
}
|
||||
if result.sl.hasNextLink() && result.sl.IsEmpty() {
|
||||
err = result.NextWithContext(ctx)
|
||||
return
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListPreparer prepares the List request.
|
||||
func (client SecretsClient) ListPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"resourceName": autorest.Encode("path", resourceName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
const APIVersion = "2022-09-04"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftCluster/{resourceName}/secrets", 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 SecretsClient) 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 SecretsClient) ListResponder(resp *http.Response) (result SecretList, 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 SecretsClient) listNextResults(ctx context.Context, lastResults SecretList) (result SecretList, err error) {
|
||||
req, err := lastResults.secretListPreparer(ctx)
|
||||
if err != nil {
|
||||
return result, autorest.NewErrorWithError(err, "redhatopenshift.SecretsClient", "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, "redhatopenshift.SecretsClient", "listNextResults", resp, "Failure sending next results request")
|
||||
}
|
||||
result, err = client.ListResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redhatopenshift.SecretsClient", "listNextResults", resp, "Failure responding to next results request")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// ListComplete enumerates all values, automatically crossing page boundaries as required.
|
||||
func (client SecretsClient) ListComplete(ctx context.Context, resourceGroupName string, resourceName string) (result SecretListIterator, err error) {
|
||||
if tracing.IsEnabled() {
|
||||
ctx = tracing.StartSpan(ctx, fqdn+"/SecretsClient.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, resourceGroupName, resourceName)
|
||||
return
|
||||
}
|
||||
|
||||
// Update the operation returns properties of a Secret.
|
||||
// Parameters:
|
||||
// resourceGroupName - the name of the resource group. The name is case insensitive.
|
||||
// resourceName - the name of the OpenShift cluster resource.
|
||||
// childResourceName - the name of the Secret resource.
|
||||
// parameters - the Secret resource.
|
||||
func (client SecretsClient) Update(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string, parameters SecretUpdate) (result Secret, err error) {
|
||||
if tracing.IsEnabled() {
|
||||
ctx = tracing.StartSpan(ctx, fqdn+"/SecretsClient.Update")
|
||||
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: client.SubscriptionID,
|
||||
Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
|
||||
{TargetValue: resourceGroupName,
|
||||
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
|
||||
{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewError("redhatopenshift.SecretsClient", "Update", err.Error())
|
||||
}
|
||||
|
||||
req, err := client.UpdatePreparer(ctx, resourceGroupName, resourceName, childResourceName, parameters)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redhatopenshift.SecretsClient", "Update", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.UpdateSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "redhatopenshift.SecretsClient", "Update", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.UpdateResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redhatopenshift.SecretsClient", "Update", resp, "Failure responding to request")
|
||||
return
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// UpdatePreparer prepares the Update request.
|
||||
func (client SecretsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string, parameters SecretUpdate) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"childResourceName": autorest.Encode("path", childResourceName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"resourceName": autorest.Encode("path", resourceName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
const APIVersion = "2022-09-04"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
parameters.SystemData = nil
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsContentType("application/json; charset=utf-8"),
|
||||
autorest.AsPatch(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/secret/{childResourceName}", pathParameters),
|
||||
autorest.WithJSON(parameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||
}
|
||||
|
||||
// UpdateSender sends the Update request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client SecretsClient) 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 SecretsClient) UpdateResponder(resp *http.Response) (result Secret, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
|
@ -0,0 +1,526 @@
|
|||
package redhatopenshift
|
||||
|
||||
// Copyright (c) Microsoft and contributors. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
//
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
"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"
|
||||
)
|
||||
|
||||
// SyncIdentityProvidersClient is the rest API for Azure Red Hat OpenShift 4
|
||||
type SyncIdentityProvidersClient struct {
|
||||
BaseClient
|
||||
}
|
||||
|
||||
// NewSyncIdentityProvidersClient creates an instance of the SyncIdentityProvidersClient client.
|
||||
func NewSyncIdentityProvidersClient(subscriptionID string) SyncIdentityProvidersClient {
|
||||
return NewSyncIdentityProvidersClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||
}
|
||||
|
||||
// NewSyncIdentityProvidersClientWithBaseURI creates an instance of the SyncIdentityProvidersClient 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 NewSyncIdentityProvidersClientWithBaseURI(baseURI string, subscriptionID string) SyncIdentityProvidersClient {
|
||||
return SyncIdentityProvidersClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||
}
|
||||
|
||||
// CreateOrUpdate the operation returns properties of a SyncIdentityProvider.
|
||||
// Parameters:
|
||||
// resourceGroupName - the name of the resource group. The name is case insensitive.
|
||||
// resourceName - the name of the OpenShift cluster resource.
|
||||
// childResourceName - the name of the SyncIdentityProvider resource.
|
||||
// parameters - the SyncIdentityProvider resource.
|
||||
func (client SyncIdentityProvidersClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string, parameters SyncIdentityProvider) (result SyncIdentityProvider, err error) {
|
||||
if tracing.IsEnabled() {
|
||||
ctx = tracing.StartSpan(ctx, fqdn+"/SyncIdentityProvidersClient.CreateOrUpdate")
|
||||
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: client.SubscriptionID,
|
||||
Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
|
||||
{TargetValue: resourceGroupName,
|
||||
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
|
||||
{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewError("redhatopenshift.SyncIdentityProvidersClient", "CreateOrUpdate", err.Error())
|
||||
}
|
||||
|
||||
req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, resourceName, childResourceName, parameters)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redhatopenshift.SyncIdentityProvidersClient", "CreateOrUpdate", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.CreateOrUpdateSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "redhatopenshift.SyncIdentityProvidersClient", "CreateOrUpdate", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.CreateOrUpdateResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redhatopenshift.SyncIdentityProvidersClient", "CreateOrUpdate", resp, "Failure responding to request")
|
||||
return
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
|
||||
func (client SyncIdentityProvidersClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string, parameters SyncIdentityProvider) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"childResourceName": autorest.Encode("path", childResourceName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"resourceName": autorest.Encode("path", resourceName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
const APIVersion = "2022-09-04"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsContentType("application/json; charset=utf-8"),
|
||||
autorest.AsPut(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/syncIdentityProvider/{childResourceName}", pathParameters),
|
||||
autorest.WithJSON(parameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||
}
|
||||
|
||||
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client SyncIdentityProvidersClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) {
|
||||
return client.Send(req, azure.DoRetryWithRegistration(client.Client))
|
||||
}
|
||||
|
||||
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client SyncIdentityProvidersClient) CreateOrUpdateResponder(resp *http.Response) (result SyncIdentityProvider, 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 the operation returns nothing.
|
||||
// Parameters:
|
||||
// resourceGroupName - the name of the resource group. The name is case insensitive.
|
||||
// resourceName - the name of the OpenShift cluster resource.
|
||||
// childResourceName - the name of the SyncIdentityProvider resource.
|
||||
func (client SyncIdentityProvidersClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string) (result autorest.Response, err error) {
|
||||
if tracing.IsEnabled() {
|
||||
ctx = tracing.StartSpan(ctx, fqdn+"/SyncIdentityProvidersClient.Delete")
|
||||
defer func() {
|
||||
sc := -1
|
||||
if result.Response != nil {
|
||||
sc = result.Response.StatusCode
|
||||
}
|
||||
tracing.EndSpan(ctx, sc, err)
|
||||
}()
|
||||
}
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: client.SubscriptionID,
|
||||
Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
|
||||
{TargetValue: resourceGroupName,
|
||||
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
|
||||
{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewError("redhatopenshift.SyncIdentityProvidersClient", "Delete", err.Error())
|
||||
}
|
||||
|
||||
req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName, childResourceName)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redhatopenshift.SyncIdentityProvidersClient", "Delete", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.DeleteSender(req)
|
||||
if err != nil {
|
||||
result.Response = resp
|
||||
err = autorest.NewErrorWithError(err, "redhatopenshift.SyncIdentityProvidersClient", "Delete", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.DeleteResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redhatopenshift.SyncIdentityProvidersClient", "Delete", resp, "Failure responding to request")
|
||||
return
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// DeletePreparer prepares the Delete request.
|
||||
func (client SyncIdentityProvidersClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"childResourceName": autorest.Encode("path", childResourceName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"resourceName": autorest.Encode("path", resourceName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
const APIVersion = "2022-09-04"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsDelete(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/syncIdentityProvider/{childResourceName}", 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 SyncIdentityProvidersClient) DeleteSender(req *http.Request) (*http.Response, error) {
|
||||
return client.Send(req, azure.DoRetryWithRegistration(client.Client))
|
||||
}
|
||||
|
||||
// DeleteResponder handles the response to the Delete request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client SyncIdentityProvidersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
|
||||
autorest.ByClosing())
|
||||
result.Response = resp
|
||||
return
|
||||
}
|
||||
|
||||
// Get the operation returns properties of a SyncIdentityProvider.
|
||||
// Parameters:
|
||||
// resourceGroupName - the name of the resource group. The name is case insensitive.
|
||||
// resourceName - the name of the OpenShift cluster resource.
|
||||
// childResourceName - the name of the SyncIdentityProvider resource.
|
||||
func (client SyncIdentityProvidersClient) Get(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string) (result SyncIdentityProvider, err error) {
|
||||
if tracing.IsEnabled() {
|
||||
ctx = tracing.StartSpan(ctx, fqdn+"/SyncIdentityProvidersClient.Get")
|
||||
defer func() {
|
||||
sc := -1
|
||||
if result.Response.Response != nil {
|
||||
sc = result.Response.Response.StatusCode
|
||||
}
|
||||
tracing.EndSpan(ctx, sc, err)
|
||||
}()
|
||||
}
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: client.SubscriptionID,
|
||||
Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
|
||||
{TargetValue: resourceGroupName,
|
||||
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
|
||||
{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewError("redhatopenshift.SyncIdentityProvidersClient", "Get", err.Error())
|
||||
}
|
||||
|
||||
req, err := client.GetPreparer(ctx, resourceGroupName, resourceName, childResourceName)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redhatopenshift.SyncIdentityProvidersClient", "Get", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.GetSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "redhatopenshift.SyncIdentityProvidersClient", "Get", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.GetResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redhatopenshift.SyncIdentityProvidersClient", "Get", resp, "Failure responding to request")
|
||||
return
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// GetPreparer prepares the Get request.
|
||||
func (client SyncIdentityProvidersClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"childResourceName": autorest.Encode("path", childResourceName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"resourceName": autorest.Encode("path", resourceName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
const APIVersion = "2022-09-04"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/syncIdentityProvider/{childResourceName}", 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 SyncIdentityProvidersClient) 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 SyncIdentityProvidersClient) GetResponder(resp *http.Response) (result SyncIdentityProvider, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// List the operation returns properties of each SyncIdentityProvider.
|
||||
// Parameters:
|
||||
// resourceGroupName - the name of the resource group. The name is case insensitive.
|
||||
// resourceName - the name of the OpenShift cluster resource.
|
||||
func (client SyncIdentityProvidersClient) List(ctx context.Context, resourceGroupName string, resourceName string) (result SyncIdentityProviderListPage, err error) {
|
||||
if tracing.IsEnabled() {
|
||||
ctx = tracing.StartSpan(ctx, fqdn+"/SyncIdentityProvidersClient.List")
|
||||
defer func() {
|
||||
sc := -1
|
||||
if result.sipl.Response.Response != nil {
|
||||
sc = result.sipl.Response.Response.StatusCode
|
||||
}
|
||||
tracing.EndSpan(ctx, sc, err)
|
||||
}()
|
||||
}
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: client.SubscriptionID,
|
||||
Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
|
||||
{TargetValue: resourceGroupName,
|
||||
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
|
||||
{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewError("redhatopenshift.SyncIdentityProvidersClient", "List", err.Error())
|
||||
}
|
||||
|
||||
result.fn = client.listNextResults
|
||||
req, err := client.ListPreparer(ctx, resourceGroupName, resourceName)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redhatopenshift.SyncIdentityProvidersClient", "List", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListSender(req)
|
||||
if err != nil {
|
||||
result.sipl.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "redhatopenshift.SyncIdentityProvidersClient", "List", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result.sipl, err = client.ListResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redhatopenshift.SyncIdentityProvidersClient", "List", resp, "Failure responding to request")
|
||||
return
|
||||
}
|
||||
if result.sipl.hasNextLink() && result.sipl.IsEmpty() {
|
||||
err = result.NextWithContext(ctx)
|
||||
return
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListPreparer prepares the List request.
|
||||
func (client SyncIdentityProvidersClient) ListPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"resourceName": autorest.Encode("path", resourceName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
const APIVersion = "2022-09-04"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftCluster/{resourceName}/syncIdentityProviders", 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 SyncIdentityProvidersClient) 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 SyncIdentityProvidersClient) ListResponder(resp *http.Response) (result SyncIdentityProviderList, 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 SyncIdentityProvidersClient) listNextResults(ctx context.Context, lastResults SyncIdentityProviderList) (result SyncIdentityProviderList, err error) {
|
||||
req, err := lastResults.syncIdentityProviderListPreparer(ctx)
|
||||
if err != nil {
|
||||
return result, autorest.NewErrorWithError(err, "redhatopenshift.SyncIdentityProvidersClient", "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, "redhatopenshift.SyncIdentityProvidersClient", "listNextResults", resp, "Failure sending next results request")
|
||||
}
|
||||
result, err = client.ListResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redhatopenshift.SyncIdentityProvidersClient", "listNextResults", resp, "Failure responding to next results request")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// ListComplete enumerates all values, automatically crossing page boundaries as required.
|
||||
func (client SyncIdentityProvidersClient) ListComplete(ctx context.Context, resourceGroupName string, resourceName string) (result SyncIdentityProviderListIterator, err error) {
|
||||
if tracing.IsEnabled() {
|
||||
ctx = tracing.StartSpan(ctx, fqdn+"/SyncIdentityProvidersClient.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, resourceGroupName, resourceName)
|
||||
return
|
||||
}
|
||||
|
||||
// Update the operation returns properties of a SyncIdentityProvider.
|
||||
// Parameters:
|
||||
// resourceGroupName - the name of the resource group. The name is case insensitive.
|
||||
// resourceName - the name of the OpenShift cluster resource.
|
||||
// childResourceName - the name of the SyncIdentityProvider resource.
|
||||
// parameters - the SyncIdentityProvider resource.
|
||||
func (client SyncIdentityProvidersClient) Update(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string, parameters SyncIdentityProviderUpdate) (result SyncIdentityProvider, err error) {
|
||||
if tracing.IsEnabled() {
|
||||
ctx = tracing.StartSpan(ctx, fqdn+"/SyncIdentityProvidersClient.Update")
|
||||
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: client.SubscriptionID,
|
||||
Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
|
||||
{TargetValue: resourceGroupName,
|
||||
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
|
||||
{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewError("redhatopenshift.SyncIdentityProvidersClient", "Update", err.Error())
|
||||
}
|
||||
|
||||
req, err := client.UpdatePreparer(ctx, resourceGroupName, resourceName, childResourceName, parameters)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redhatopenshift.SyncIdentityProvidersClient", "Update", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.UpdateSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "redhatopenshift.SyncIdentityProvidersClient", "Update", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.UpdateResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redhatopenshift.SyncIdentityProvidersClient", "Update", resp, "Failure responding to request")
|
||||
return
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// UpdatePreparer prepares the Update request.
|
||||
func (client SyncIdentityProvidersClient) UpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string, parameters SyncIdentityProviderUpdate) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"childResourceName": autorest.Encode("path", childResourceName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"resourceName": autorest.Encode("path", resourceName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
const APIVersion = "2022-09-04"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
parameters.SystemData = nil
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsContentType("application/json; charset=utf-8"),
|
||||
autorest.AsPatch(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/syncIdentityProvider/{childResourceName}", pathParameters),
|
||||
autorest.WithJSON(parameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||
}
|
||||
|
||||
// UpdateSender sends the Update request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client SyncIdentityProvidersClient) 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 SyncIdentityProvidersClient) UpdateResponder(resp *http.Response) (result SyncIdentityProvider, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
|
@ -0,0 +1,525 @@
|
|||
package redhatopenshift
|
||||
|
||||
// Copyright (c) Microsoft and contributors. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
//
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
"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"
|
||||
)
|
||||
|
||||
// SyncSetsClient is the rest API for Azure Red Hat OpenShift 4
|
||||
type SyncSetsClient struct {
|
||||
BaseClient
|
||||
}
|
||||
|
||||
// NewSyncSetsClient creates an instance of the SyncSetsClient client.
|
||||
func NewSyncSetsClient(subscriptionID string) SyncSetsClient {
|
||||
return NewSyncSetsClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||
}
|
||||
|
||||
// NewSyncSetsClientWithBaseURI creates an instance of the SyncSetsClient 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 NewSyncSetsClientWithBaseURI(baseURI string, subscriptionID string) SyncSetsClient {
|
||||
return SyncSetsClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||
}
|
||||
|
||||
// CreateOrUpdate the operation returns properties of a SyncSet.
|
||||
// Parameters:
|
||||
// resourceGroupName - the name of the resource group. The name is case insensitive.
|
||||
// resourceName - the name of the OpenShift cluster resource.
|
||||
// childResourceName - the name of the SyncSet resource.
|
||||
// parameters - the SyncSet resource.
|
||||
func (client SyncSetsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string, parameters SyncSet) (result SyncSet, err error) {
|
||||
if tracing.IsEnabled() {
|
||||
ctx = tracing.StartSpan(ctx, fqdn+"/SyncSetsClient.CreateOrUpdate")
|
||||
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: client.SubscriptionID,
|
||||
Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
|
||||
{TargetValue: resourceGroupName,
|
||||
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
|
||||
{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewError("redhatopenshift.SyncSetsClient", "CreateOrUpdate", err.Error())
|
||||
}
|
||||
|
||||
req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, resourceName, childResourceName, parameters)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redhatopenshift.SyncSetsClient", "CreateOrUpdate", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.CreateOrUpdateSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "redhatopenshift.SyncSetsClient", "CreateOrUpdate", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.CreateOrUpdateResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redhatopenshift.SyncSetsClient", "CreateOrUpdate", resp, "Failure responding to request")
|
||||
return
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
|
||||
func (client SyncSetsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string, parameters SyncSet) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"childResourceName": autorest.Encode("path", childResourceName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"resourceName": autorest.Encode("path", resourceName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
const APIVersion = "2022-09-04"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsContentType("application/json; charset=utf-8"),
|
||||
autorest.AsPut(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/syncSet/{childResourceName}", pathParameters),
|
||||
autorest.WithJSON(parameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||
}
|
||||
|
||||
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client SyncSetsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) {
|
||||
return client.Send(req, azure.DoRetryWithRegistration(client.Client))
|
||||
}
|
||||
|
||||
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client SyncSetsClient) CreateOrUpdateResponder(resp *http.Response) (result SyncSet, 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 the operation returns nothing.
|
||||
// Parameters:
|
||||
// resourceGroupName - the name of the resource group. The name is case insensitive.
|
||||
// resourceName - the name of the OpenShift cluster resource.
|
||||
// childResourceName - the name of the SyncSet resource.
|
||||
func (client SyncSetsClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string) (result autorest.Response, err error) {
|
||||
if tracing.IsEnabled() {
|
||||
ctx = tracing.StartSpan(ctx, fqdn+"/SyncSetsClient.Delete")
|
||||
defer func() {
|
||||
sc := -1
|
||||
if result.Response != nil {
|
||||
sc = result.Response.StatusCode
|
||||
}
|
||||
tracing.EndSpan(ctx, sc, err)
|
||||
}()
|
||||
}
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: client.SubscriptionID,
|
||||
Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
|
||||
{TargetValue: resourceGroupName,
|
||||
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
|
||||
{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewError("redhatopenshift.SyncSetsClient", "Delete", err.Error())
|
||||
}
|
||||
|
||||
req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName, childResourceName)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redhatopenshift.SyncSetsClient", "Delete", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.DeleteSender(req)
|
||||
if err != nil {
|
||||
result.Response = resp
|
||||
err = autorest.NewErrorWithError(err, "redhatopenshift.SyncSetsClient", "Delete", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.DeleteResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redhatopenshift.SyncSetsClient", "Delete", resp, "Failure responding to request")
|
||||
return
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// DeletePreparer prepares the Delete request.
|
||||
func (client SyncSetsClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"childResourceName": autorest.Encode("path", childResourceName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"resourceName": autorest.Encode("path", resourceName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
const APIVersion = "2022-09-04"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsDelete(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/syncSet/{childResourceName}", 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 SyncSetsClient) DeleteSender(req *http.Request) (*http.Response, error) {
|
||||
return client.Send(req, azure.DoRetryWithRegistration(client.Client))
|
||||
}
|
||||
|
||||
// DeleteResponder handles the response to the Delete request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client SyncSetsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
|
||||
autorest.ByClosing())
|
||||
result.Response = resp
|
||||
return
|
||||
}
|
||||
|
||||
// Get the operation returns properties of a SyncSet.
|
||||
// Parameters:
|
||||
// resourceGroupName - the name of the resource group. The name is case insensitive.
|
||||
// resourceName - the name of the OpenShift cluster resource.
|
||||
// childResourceName - the name of the SyncSet resource.
|
||||
func (client SyncSetsClient) Get(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string) (result SyncSet, err error) {
|
||||
if tracing.IsEnabled() {
|
||||
ctx = tracing.StartSpan(ctx, fqdn+"/SyncSetsClient.Get")
|
||||
defer func() {
|
||||
sc := -1
|
||||
if result.Response.Response != nil {
|
||||
sc = result.Response.Response.StatusCode
|
||||
}
|
||||
tracing.EndSpan(ctx, sc, err)
|
||||
}()
|
||||
}
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: client.SubscriptionID,
|
||||
Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
|
||||
{TargetValue: resourceGroupName,
|
||||
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
|
||||
{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewError("redhatopenshift.SyncSetsClient", "Get", err.Error())
|
||||
}
|
||||
|
||||
req, err := client.GetPreparer(ctx, resourceGroupName, resourceName, childResourceName)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redhatopenshift.SyncSetsClient", "Get", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.GetSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "redhatopenshift.SyncSetsClient", "Get", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.GetResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redhatopenshift.SyncSetsClient", "Get", resp, "Failure responding to request")
|
||||
return
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// GetPreparer prepares the Get request.
|
||||
func (client SyncSetsClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"childResourceName": autorest.Encode("path", childResourceName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"resourceName": autorest.Encode("path", resourceName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
const APIVersion = "2022-09-04"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/syncSet/{childResourceName}", 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 SyncSetsClient) 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 SyncSetsClient) GetResponder(resp *http.Response) (result SyncSet, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// List the operation returns properties of each SyncSet.
|
||||
// Parameters:
|
||||
// resourceGroupName - the name of the resource group. The name is case insensitive.
|
||||
// resourceName - the name of the OpenShift cluster resource.
|
||||
func (client SyncSetsClient) List(ctx context.Context, resourceGroupName string, resourceName string) (result SyncSetListPage, err error) {
|
||||
if tracing.IsEnabled() {
|
||||
ctx = tracing.StartSpan(ctx, fqdn+"/SyncSetsClient.List")
|
||||
defer func() {
|
||||
sc := -1
|
||||
if result.ssl.Response.Response != nil {
|
||||
sc = result.ssl.Response.Response.StatusCode
|
||||
}
|
||||
tracing.EndSpan(ctx, sc, err)
|
||||
}()
|
||||
}
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: client.SubscriptionID,
|
||||
Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
|
||||
{TargetValue: resourceGroupName,
|
||||
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
|
||||
{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewError("redhatopenshift.SyncSetsClient", "List", err.Error())
|
||||
}
|
||||
|
||||
result.fn = client.listNextResults
|
||||
req, err := client.ListPreparer(ctx, resourceGroupName, resourceName)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redhatopenshift.SyncSetsClient", "List", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListSender(req)
|
||||
if err != nil {
|
||||
result.ssl.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "redhatopenshift.SyncSetsClient", "List", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result.ssl, err = client.ListResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redhatopenshift.SyncSetsClient", "List", resp, "Failure responding to request")
|
||||
return
|
||||
}
|
||||
if result.ssl.hasNextLink() && result.ssl.IsEmpty() {
|
||||
err = result.NextWithContext(ctx)
|
||||
return
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListPreparer prepares the List request.
|
||||
func (client SyncSetsClient) ListPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"resourceName": autorest.Encode("path", resourceName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
const APIVersion = "2022-09-04"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftCluster/{resourceName}/syncSets", 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 SyncSetsClient) 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 SyncSetsClient) ListResponder(resp *http.Response) (result SyncSetList, 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 SyncSetsClient) listNextResults(ctx context.Context, lastResults SyncSetList) (result SyncSetList, err error) {
|
||||
req, err := lastResults.syncSetListPreparer(ctx)
|
||||
if err != nil {
|
||||
return result, autorest.NewErrorWithError(err, "redhatopenshift.SyncSetsClient", "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, "redhatopenshift.SyncSetsClient", "listNextResults", resp, "Failure sending next results request")
|
||||
}
|
||||
result, err = client.ListResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redhatopenshift.SyncSetsClient", "listNextResults", resp, "Failure responding to next results request")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// ListComplete enumerates all values, automatically crossing page boundaries as required.
|
||||
func (client SyncSetsClient) ListComplete(ctx context.Context, resourceGroupName string, resourceName string) (result SyncSetListIterator, err error) {
|
||||
if tracing.IsEnabled() {
|
||||
ctx = tracing.StartSpan(ctx, fqdn+"/SyncSetsClient.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, resourceGroupName, resourceName)
|
||||
return
|
||||
}
|
||||
|
||||
// Update the operation returns properties of a SyncSet.
|
||||
// Parameters:
|
||||
// resourceGroupName - the name of the resource group. The name is case insensitive.
|
||||
// resourceName - the name of the OpenShift cluster resource.
|
||||
// childResourceName - the name of the SyncSet resource.
|
||||
// parameters - the SyncSet resource.
|
||||
func (client SyncSetsClient) Update(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string, parameters SyncSetUpdate) (result SyncSet, err error) {
|
||||
if tracing.IsEnabled() {
|
||||
ctx = tracing.StartSpan(ctx, fqdn+"/SyncSetsClient.Update")
|
||||
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: client.SubscriptionID,
|
||||
Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
|
||||
{TargetValue: resourceGroupName,
|
||||
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
|
||||
{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewError("redhatopenshift.SyncSetsClient", "Update", err.Error())
|
||||
}
|
||||
|
||||
req, err := client.UpdatePreparer(ctx, resourceGroupName, resourceName, childResourceName, parameters)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redhatopenshift.SyncSetsClient", "Update", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.UpdateSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "redhatopenshift.SyncSetsClient", "Update", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.UpdateResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "redhatopenshift.SyncSetsClient", "Update", resp, "Failure responding to request")
|
||||
return
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// UpdatePreparer prepares the Update request.
|
||||
func (client SyncSetsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string, parameters SyncSetUpdate) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"childResourceName": autorest.Encode("path", childResourceName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"resourceName": autorest.Encode("path", resourceName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
const APIVersion = "2022-09-04"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
parameters.SystemData = nil
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsContentType("application/json; charset=utf-8"),
|
||||
autorest.AsPatch(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/syncSet/{childResourceName}", pathParameters),
|
||||
autorest.WithJSON(parameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare((&http.Request{}).WithContext(ctx))
|
||||
}
|
||||
|
||||
// UpdateSender sends the Update request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client SyncSetsClient) 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 SyncSetsClient) UpdateResponder(resp *http.Response) (result SyncSet, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
|
@ -0,0 +1,143 @@
|
|||
package database
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the Apache License 2.0.
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/Azure/go-autorest/autorest/azure"
|
||||
|
||||
"github.com/Azure/ARO-RP/pkg/api"
|
||||
"github.com/Azure/ARO-RP/pkg/database/cosmosdb"
|
||||
"github.com/Azure/ARO-RP/pkg/util/uuid"
|
||||
)
|
||||
|
||||
const (
|
||||
ClusterManagerConfigurationsGetQuery = `SELECT * FROM ClusterManagerConfigurations doc WHERE doc.key = @key`
|
||||
)
|
||||
|
||||
type clusterManagerConfiguration struct {
|
||||
c cosmosdb.ClusterManagerConfigurationDocumentClient
|
||||
collc cosmosdb.CollectionClient
|
||||
uuid string
|
||||
uuidGenerator uuid.Generator
|
||||
}
|
||||
|
||||
type ClusterManagerConfigurations interface {
|
||||
Create(context.Context, *api.ClusterManagerConfigurationDocument) (*api.ClusterManagerConfigurationDocument, error)
|
||||
Get(context.Context, string) (*api.ClusterManagerConfigurationDocument, error)
|
||||
Update(context.Context, *api.ClusterManagerConfigurationDocument) (*api.ClusterManagerConfigurationDocument, error)
|
||||
Delete(context.Context, *api.ClusterManagerConfigurationDocument) error
|
||||
ChangeFeed() cosmosdb.ClusterManagerConfigurationDocumentIterator
|
||||
NewUUID() string
|
||||
}
|
||||
|
||||
func NewClusterManagerConfigurations(ctx context.Context, isDevelopmentMode bool, dbc cosmosdb.DatabaseClient) (ClusterManagerConfigurations, error) {
|
||||
dbid, err := Name(isDevelopmentMode)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
collc := cosmosdb.NewCollectionClient(dbc, dbid)
|
||||
|
||||
documentClient := cosmosdb.NewClusterManagerConfigurationDocumentClient(collc, collClusterManager)
|
||||
return NewClusterManagerConfigurationsWithProvidedClient(documentClient, collc, uuid.DefaultGenerator.Generate(), uuid.DefaultGenerator), nil
|
||||
}
|
||||
|
||||
func NewClusterManagerConfigurationsWithProvidedClient(client cosmosdb.ClusterManagerConfigurationDocumentClient, collectionClient cosmosdb.CollectionClient, uuid string, uuidGenerator uuid.Generator) ClusterManagerConfigurations {
|
||||
return &clusterManagerConfiguration{
|
||||
c: client,
|
||||
collc: collectionClient,
|
||||
uuid: uuid,
|
||||
uuidGenerator: uuidGenerator,
|
||||
}
|
||||
}
|
||||
|
||||
func (c *clusterManagerConfiguration) NewUUID() string {
|
||||
return c.uuidGenerator.Generate()
|
||||
}
|
||||
|
||||
func (c *clusterManagerConfiguration) Create(ctx context.Context, doc *api.ClusterManagerConfigurationDocument) (*api.ClusterManagerConfigurationDocument, error) {
|
||||
if doc.ID != strings.ToLower(doc.ID) {
|
||||
return nil, fmt.Errorf("id %q is not lower case", doc.ID)
|
||||
}
|
||||
|
||||
var err error
|
||||
doc.PartitionKey, err = c.partitionKey(doc.Key)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
doc, err = c.c.Create(ctx, doc.PartitionKey, doc, nil)
|
||||
|
||||
if err, ok := err.(*cosmosdb.Error); ok && err.StatusCode == http.StatusConflict {
|
||||
err.StatusCode = http.StatusPreconditionFailed
|
||||
}
|
||||
|
||||
return doc, err
|
||||
}
|
||||
|
||||
func (c *clusterManagerConfiguration) Get(ctx context.Context, id string) (*api.ClusterManagerConfigurationDocument, error) {
|
||||
if id != strings.ToLower(id) {
|
||||
return nil, fmt.Errorf("id %q is not lower case", id)
|
||||
}
|
||||
partitionKey, err := c.partitionKey(id)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
docs, err := c.c.QueryAll(ctx, partitionKey, &cosmosdb.Query{
|
||||
Query: ClusterManagerConfigurationsGetQuery,
|
||||
Parameters: []cosmosdb.Parameter{
|
||||
{
|
||||
Name: "@key",
|
||||
Value: id,
|
||||
},
|
||||
},
|
||||
}, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
switch {
|
||||
case len(docs.ClusterManagerConfigurationDocuments) > 1:
|
||||
return nil, fmt.Errorf("read %d documents, expected <= 1", len(docs.ClusterManagerConfigurationDocuments))
|
||||
case len(docs.ClusterManagerConfigurationDocuments) == 1:
|
||||
return docs.ClusterManagerConfigurationDocuments[0], nil
|
||||
default:
|
||||
return nil, &cosmosdb.Error{StatusCode: http.StatusNotFound}
|
||||
}
|
||||
}
|
||||
|
||||
func (c *clusterManagerConfiguration) Update(ctx context.Context, doc *api.ClusterManagerConfigurationDocument) (*api.ClusterManagerConfigurationDocument, error) {
|
||||
return c.update(ctx, doc, nil)
|
||||
}
|
||||
|
||||
func (c *clusterManagerConfiguration) update(ctx context.Context, doc *api.ClusterManagerConfigurationDocument, options *cosmosdb.Options) (*api.ClusterManagerConfigurationDocument, error) {
|
||||
if doc.Key != strings.ToLower(doc.Key) {
|
||||
return nil, fmt.Errorf("key %q is not lower case", doc.Key)
|
||||
}
|
||||
|
||||
return c.c.Replace(ctx, doc.PartitionKey, doc, options)
|
||||
}
|
||||
|
||||
func (c *clusterManagerConfiguration) Delete(ctx context.Context, doc *api.ClusterManagerConfigurationDocument) error {
|
||||
if doc.ID != strings.ToLower(doc.ID) {
|
||||
return fmt.Errorf("id %q is not lower case", doc.ID)
|
||||
}
|
||||
|
||||
return c.c.Delete(ctx, doc.PartitionKey, doc, &cosmosdb.Options{NoETag: true})
|
||||
}
|
||||
|
||||
func (c *clusterManagerConfiguration) ChangeFeed() cosmosdb.ClusterManagerConfigurationDocumentIterator {
|
||||
return c.c.ChangeFeed(nil)
|
||||
}
|
||||
|
||||
func (c *clusterManagerConfiguration) partitionKey(key string) (string, error) {
|
||||
r, err := azure.ParseResourceID(key)
|
||||
return r.SubscriptionID, err
|
||||
}
|
|
@ -3,7 +3,7 @@ package cosmosdb
|
|||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the Apache License 2.0.
|
||||
|
||||
//go:generate go run ../../../vendor/github.com/jewzaam/go-cosmosdb/cmd/gencosmosdb github.com/Azure/ARO-RP/pkg/api,AsyncOperationDocument github.com/Azure/ARO-RP/pkg/api,BillingDocument github.com/Azure/ARO-RP/pkg/api,GatewayDocument github.com/Azure/ARO-RP/pkg/api,MonitorDocument github.com/Azure/ARO-RP/pkg/api,OpenShiftClusterDocument github.com/Azure/ARO-RP/pkg/api,SubscriptionDocument github.com/Azure/ARO-RP/pkg/api,OpenShiftVersionDocument
|
||||
//go:generate go run ../../../vendor/github.com/jewzaam/go-cosmosdb/cmd/gencosmosdb github.com/Azure/ARO-RP/pkg/api,AsyncOperationDocument github.com/Azure/ARO-RP/pkg/api,BillingDocument github.com/Azure/ARO-RP/pkg/api,GatewayDocument github.com/Azure/ARO-RP/pkg/api,MonitorDocument github.com/Azure/ARO-RP/pkg/api,OpenShiftClusterDocument github.com/Azure/ARO-RP/pkg/api,SubscriptionDocument github.com/Azure/ARO-RP/pkg/api,OpenShiftVersionDocument github.com/Azure/ARO-RP/pkg/api,ClusterManagerConfigurationDocument
|
||||
//go:generate go run ../../../vendor/golang.org/x/tools/cmd/goimports -local=github.com/Azure/ARO-RP -e -w ./
|
||||
//go:generate go run ../../../vendor/github.com/golang/mock/mockgen -destination=../../util/mocks/$GOPACKAGE/$GOPACKAGE.go github.com/Azure/ARO-RP/pkg/database/$GOPACKAGE PermissionClient
|
||||
//go:generate go run ../../../vendor/golang.org/x/tools/cmd/goimports -local=github.com/Azure/ARO-RP -e -w ../../util/mocks/$GOPACKAGE/$GOPACKAGE.go
|
||||
|
|
|
@ -0,0 +1,313 @@
|
|||
// Code generated by github.com/jewzaam/go-cosmosdb, DO NOT EDIT.
|
||||
|
||||
package cosmosdb
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
pkg "github.com/Azure/ARO-RP/pkg/api"
|
||||
)
|
||||
|
||||
type clusterManagerConfigurationDocumentClient struct {
|
||||
*databaseClient
|
||||
path string
|
||||
}
|
||||
|
||||
// ClusterManagerConfigurationDocumentClient is a clusterManagerConfigurationDocument client
|
||||
type ClusterManagerConfigurationDocumentClient interface {
|
||||
Create(context.Context, string, *pkg.ClusterManagerConfigurationDocument, *Options) (*pkg.ClusterManagerConfigurationDocument, error)
|
||||
List(*Options) ClusterManagerConfigurationDocumentIterator
|
||||
ListAll(context.Context, *Options) (*pkg.ClusterManagerConfigurationDocuments, error)
|
||||
Get(context.Context, string, string, *Options) (*pkg.ClusterManagerConfigurationDocument, error)
|
||||
Replace(context.Context, string, *pkg.ClusterManagerConfigurationDocument, *Options) (*pkg.ClusterManagerConfigurationDocument, error)
|
||||
Delete(context.Context, string, *pkg.ClusterManagerConfigurationDocument, *Options) error
|
||||
Query(string, *Query, *Options) ClusterManagerConfigurationDocumentRawIterator
|
||||
QueryAll(context.Context, string, *Query, *Options) (*pkg.ClusterManagerConfigurationDocuments, error)
|
||||
ChangeFeed(*Options) ClusterManagerConfigurationDocumentIterator
|
||||
}
|
||||
|
||||
type clusterManagerConfigurationDocumentChangeFeedIterator struct {
|
||||
*clusterManagerConfigurationDocumentClient
|
||||
continuation string
|
||||
options *Options
|
||||
}
|
||||
|
||||
type clusterManagerConfigurationDocumentListIterator struct {
|
||||
*clusterManagerConfigurationDocumentClient
|
||||
continuation string
|
||||
done bool
|
||||
options *Options
|
||||
}
|
||||
|
||||
type clusterManagerConfigurationDocumentQueryIterator struct {
|
||||
*clusterManagerConfigurationDocumentClient
|
||||
partitionkey string
|
||||
query *Query
|
||||
continuation string
|
||||
done bool
|
||||
options *Options
|
||||
}
|
||||
|
||||
// ClusterManagerConfigurationDocumentIterator is a clusterManagerConfigurationDocument iterator
|
||||
type ClusterManagerConfigurationDocumentIterator interface {
|
||||
Next(context.Context, int) (*pkg.ClusterManagerConfigurationDocuments, error)
|
||||
Continuation() string
|
||||
}
|
||||
|
||||
// ClusterManagerConfigurationDocumentRawIterator is a clusterManagerConfigurationDocument raw iterator
|
||||
type ClusterManagerConfigurationDocumentRawIterator interface {
|
||||
ClusterManagerConfigurationDocumentIterator
|
||||
NextRaw(context.Context, int, interface{}) error
|
||||
}
|
||||
|
||||
// NewClusterManagerConfigurationDocumentClient returns a new clusterManagerConfigurationDocument client
|
||||
func NewClusterManagerConfigurationDocumentClient(collc CollectionClient, collid string) ClusterManagerConfigurationDocumentClient {
|
||||
return &clusterManagerConfigurationDocumentClient{
|
||||
databaseClient: collc.(*collectionClient).databaseClient,
|
||||
path: collc.(*collectionClient).path + "/colls/" + collid,
|
||||
}
|
||||
}
|
||||
|
||||
func (c *clusterManagerConfigurationDocumentClient) all(ctx context.Context, i ClusterManagerConfigurationDocumentIterator) (*pkg.ClusterManagerConfigurationDocuments, error) {
|
||||
allclusterManagerConfigurationDocuments := &pkg.ClusterManagerConfigurationDocuments{}
|
||||
|
||||
for {
|
||||
clusterManagerConfigurationDocuments, err := i.Next(ctx, -1)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if clusterManagerConfigurationDocuments == nil {
|
||||
break
|
||||
}
|
||||
|
||||
allclusterManagerConfigurationDocuments.Count += clusterManagerConfigurationDocuments.Count
|
||||
allclusterManagerConfigurationDocuments.ResourceID = clusterManagerConfigurationDocuments.ResourceID
|
||||
allclusterManagerConfigurationDocuments.ClusterManagerConfigurationDocuments = append(allclusterManagerConfigurationDocuments.ClusterManagerConfigurationDocuments, clusterManagerConfigurationDocuments.ClusterManagerConfigurationDocuments...)
|
||||
}
|
||||
|
||||
return allclusterManagerConfigurationDocuments, nil
|
||||
}
|
||||
|
||||
func (c *clusterManagerConfigurationDocumentClient) Create(ctx context.Context, partitionkey string, newclusterManagerConfigurationDocument *pkg.ClusterManagerConfigurationDocument, options *Options) (clusterManagerConfigurationDocument *pkg.ClusterManagerConfigurationDocument, err error) {
|
||||
headers := http.Header{}
|
||||
headers.Set("X-Ms-Documentdb-Partitionkey", `["`+partitionkey+`"]`)
|
||||
|
||||
if options == nil {
|
||||
options = &Options{}
|
||||
}
|
||||
options.NoETag = true
|
||||
|
||||
err = c.setOptions(options, newclusterManagerConfigurationDocument, headers)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = c.do(ctx, http.MethodPost, c.path+"/docs", "docs", c.path, http.StatusCreated, &newclusterManagerConfigurationDocument, &clusterManagerConfigurationDocument, headers)
|
||||
return
|
||||
}
|
||||
|
||||
func (c *clusterManagerConfigurationDocumentClient) List(options *Options) ClusterManagerConfigurationDocumentIterator {
|
||||
continuation := ""
|
||||
if options != nil {
|
||||
continuation = options.Continuation
|
||||
}
|
||||
|
||||
return &clusterManagerConfigurationDocumentListIterator{clusterManagerConfigurationDocumentClient: c, options: options, continuation: continuation}
|
||||
}
|
||||
|
||||
func (c *clusterManagerConfigurationDocumentClient) ListAll(ctx context.Context, options *Options) (*pkg.ClusterManagerConfigurationDocuments, error) {
|
||||
return c.all(ctx, c.List(options))
|
||||
}
|
||||
|
||||
func (c *clusterManagerConfigurationDocumentClient) Get(ctx context.Context, partitionkey, clusterManagerConfigurationDocumentid string, options *Options) (clusterManagerConfigurationDocument *pkg.ClusterManagerConfigurationDocument, err error) {
|
||||
headers := http.Header{}
|
||||
headers.Set("X-Ms-Documentdb-Partitionkey", `["`+partitionkey+`"]`)
|
||||
|
||||
err = c.setOptions(options, nil, headers)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = c.do(ctx, http.MethodGet, c.path+"/docs/"+clusterManagerConfigurationDocumentid, "docs", c.path+"/docs/"+clusterManagerConfigurationDocumentid, http.StatusOK, nil, &clusterManagerConfigurationDocument, headers)
|
||||
return
|
||||
}
|
||||
|
||||
func (c *clusterManagerConfigurationDocumentClient) Replace(ctx context.Context, partitionkey string, newclusterManagerConfigurationDocument *pkg.ClusterManagerConfigurationDocument, options *Options) (clusterManagerConfigurationDocument *pkg.ClusterManagerConfigurationDocument, err error) {
|
||||
headers := http.Header{}
|
||||
headers.Set("X-Ms-Documentdb-Partitionkey", `["`+partitionkey+`"]`)
|
||||
|
||||
err = c.setOptions(options, newclusterManagerConfigurationDocument, headers)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = c.do(ctx, http.MethodPut, c.path+"/docs/"+newclusterManagerConfigurationDocument.ID, "docs", c.path+"/docs/"+newclusterManagerConfigurationDocument.ID, http.StatusOK, &newclusterManagerConfigurationDocument, &clusterManagerConfigurationDocument, headers)
|
||||
return
|
||||
}
|
||||
|
||||
func (c *clusterManagerConfigurationDocumentClient) Delete(ctx context.Context, partitionkey string, clusterManagerConfigurationDocument *pkg.ClusterManagerConfigurationDocument, options *Options) (err error) {
|
||||
headers := http.Header{}
|
||||
headers.Set("X-Ms-Documentdb-Partitionkey", `["`+partitionkey+`"]`)
|
||||
|
||||
err = c.setOptions(options, clusterManagerConfigurationDocument, headers)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = c.do(ctx, http.MethodDelete, c.path+"/docs/"+clusterManagerConfigurationDocument.ID, "docs", c.path+"/docs/"+clusterManagerConfigurationDocument.ID, http.StatusNoContent, nil, nil, headers)
|
||||
return
|
||||
}
|
||||
|
||||
func (c *clusterManagerConfigurationDocumentClient) Query(partitionkey string, query *Query, options *Options) ClusterManagerConfigurationDocumentRawIterator {
|
||||
continuation := ""
|
||||
if options != nil {
|
||||
continuation = options.Continuation
|
||||
}
|
||||
|
||||
return &clusterManagerConfigurationDocumentQueryIterator{clusterManagerConfigurationDocumentClient: c, partitionkey: partitionkey, query: query, options: options, continuation: continuation}
|
||||
}
|
||||
|
||||
func (c *clusterManagerConfigurationDocumentClient) QueryAll(ctx context.Context, partitionkey string, query *Query, options *Options) (*pkg.ClusterManagerConfigurationDocuments, error) {
|
||||
return c.all(ctx, c.Query(partitionkey, query, options))
|
||||
}
|
||||
|
||||
func (c *clusterManagerConfigurationDocumentClient) ChangeFeed(options *Options) ClusterManagerConfigurationDocumentIterator {
|
||||
continuation := ""
|
||||
if options != nil {
|
||||
continuation = options.Continuation
|
||||
}
|
||||
|
||||
return &clusterManagerConfigurationDocumentChangeFeedIterator{clusterManagerConfigurationDocumentClient: c, options: options, continuation: continuation}
|
||||
}
|
||||
|
||||
func (c *clusterManagerConfigurationDocumentClient) setOptions(options *Options, clusterManagerConfigurationDocument *pkg.ClusterManagerConfigurationDocument, headers http.Header) error {
|
||||
if options == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
if clusterManagerConfigurationDocument != nil && !options.NoETag {
|
||||
if clusterManagerConfigurationDocument.ETag == "" {
|
||||
return ErrETagRequired
|
||||
}
|
||||
headers.Set("If-Match", clusterManagerConfigurationDocument.ETag)
|
||||
}
|
||||
if len(options.PreTriggers) > 0 {
|
||||
headers.Set("X-Ms-Documentdb-Pre-Trigger-Include", strings.Join(options.PreTriggers, ","))
|
||||
}
|
||||
if len(options.PostTriggers) > 0 {
|
||||
headers.Set("X-Ms-Documentdb-Post-Trigger-Include", strings.Join(options.PostTriggers, ","))
|
||||
}
|
||||
if len(options.PartitionKeyRangeID) > 0 {
|
||||
headers.Set("X-Ms-Documentdb-PartitionKeyRangeID", options.PartitionKeyRangeID)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (i *clusterManagerConfigurationDocumentChangeFeedIterator) Next(ctx context.Context, maxItemCount int) (clusterManagerConfigurationDocuments *pkg.ClusterManagerConfigurationDocuments, err error) {
|
||||
headers := http.Header{}
|
||||
headers.Set("A-IM", "Incremental feed")
|
||||
|
||||
headers.Set("X-Ms-Max-Item-Count", strconv.Itoa(maxItemCount))
|
||||
if i.continuation != "" {
|
||||
headers.Set("If-None-Match", i.continuation)
|
||||
}
|
||||
|
||||
err = i.setOptions(i.options, nil, headers)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = i.do(ctx, http.MethodGet, i.path+"/docs", "docs", i.path, http.StatusOK, nil, &clusterManagerConfigurationDocuments, headers)
|
||||
if IsErrorStatusCode(err, http.StatusNotModified) {
|
||||
err = nil
|
||||
}
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
i.continuation = headers.Get("Etag")
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func (i *clusterManagerConfigurationDocumentChangeFeedIterator) Continuation() string {
|
||||
return i.continuation
|
||||
}
|
||||
|
||||
func (i *clusterManagerConfigurationDocumentListIterator) Next(ctx context.Context, maxItemCount int) (clusterManagerConfigurationDocuments *pkg.ClusterManagerConfigurationDocuments, err error) {
|
||||
if i.done {
|
||||
return
|
||||
}
|
||||
|
||||
headers := http.Header{}
|
||||
headers.Set("X-Ms-Max-Item-Count", strconv.Itoa(maxItemCount))
|
||||
if i.continuation != "" {
|
||||
headers.Set("X-Ms-Continuation", i.continuation)
|
||||
}
|
||||
|
||||
err = i.setOptions(i.options, nil, headers)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = i.do(ctx, http.MethodGet, i.path+"/docs", "docs", i.path, http.StatusOK, nil, &clusterManagerConfigurationDocuments, headers)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
i.continuation = headers.Get("X-Ms-Continuation")
|
||||
i.done = i.continuation == ""
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func (i *clusterManagerConfigurationDocumentListIterator) Continuation() string {
|
||||
return i.continuation
|
||||
}
|
||||
|
||||
func (i *clusterManagerConfigurationDocumentQueryIterator) Next(ctx context.Context, maxItemCount int) (clusterManagerConfigurationDocuments *pkg.ClusterManagerConfigurationDocuments, err error) {
|
||||
err = i.NextRaw(ctx, maxItemCount, &clusterManagerConfigurationDocuments)
|
||||
return
|
||||
}
|
||||
|
||||
func (i *clusterManagerConfigurationDocumentQueryIterator) NextRaw(ctx context.Context, maxItemCount int, raw interface{}) (err error) {
|
||||
if i.done {
|
||||
return
|
||||
}
|
||||
|
||||
headers := http.Header{}
|
||||
headers.Set("X-Ms-Max-Item-Count", strconv.Itoa(maxItemCount))
|
||||
headers.Set("X-Ms-Documentdb-Isquery", "True")
|
||||
headers.Set("Content-Type", "application/query+json")
|
||||
if i.partitionkey != "" {
|
||||
headers.Set("X-Ms-Documentdb-Partitionkey", `["`+i.partitionkey+`"]`)
|
||||
} else {
|
||||
headers.Set("X-Ms-Documentdb-Query-Enablecrosspartition", "True")
|
||||
}
|
||||
if i.continuation != "" {
|
||||
headers.Set("X-Ms-Continuation", i.continuation)
|
||||
}
|
||||
|
||||
err = i.setOptions(i.options, nil, headers)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = i.do(ctx, http.MethodPost, i.path+"/docs", "docs", i.path, http.StatusOK, &i.query, &raw, headers)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
i.continuation = headers.Get("X-Ms-Continuation")
|
||||
i.done = i.continuation == ""
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func (i *clusterManagerConfigurationDocumentQueryIterator) Continuation() string {
|
||||
return i.continuation
|
||||
}
|
|
@ -0,0 +1,361 @@
|
|||
// Code generated by github.com/jewzaam/go-cosmosdb, DO NOT EDIT.
|
||||
|
||||
package cosmosdb
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"sync"
|
||||
|
||||
"github.com/ugorji/go/codec"
|
||||
|
||||
pkg "github.com/Azure/ARO-RP/pkg/api"
|
||||
)
|
||||
|
||||
type fakeClusterManagerConfigurationDocumentTriggerHandler func(context.Context, *pkg.ClusterManagerConfigurationDocument) error
|
||||
type fakeClusterManagerConfigurationDocumentQueryHandler func(ClusterManagerConfigurationDocumentClient, *Query, *Options) ClusterManagerConfigurationDocumentRawIterator
|
||||
|
||||
var _ ClusterManagerConfigurationDocumentClient = &FakeClusterManagerConfigurationDocumentClient{}
|
||||
|
||||
// NewFakeClusterManagerConfigurationDocumentClient returns a FakeClusterManagerConfigurationDocumentClient
|
||||
func NewFakeClusterManagerConfigurationDocumentClient(h *codec.JsonHandle) *FakeClusterManagerConfigurationDocumentClient {
|
||||
return &FakeClusterManagerConfigurationDocumentClient{
|
||||
jsonHandle: h,
|
||||
clusterManagerConfigurationDocuments: make(map[string]*pkg.ClusterManagerConfigurationDocument),
|
||||
triggerHandlers: make(map[string]fakeClusterManagerConfigurationDocumentTriggerHandler),
|
||||
queryHandlers: make(map[string]fakeClusterManagerConfigurationDocumentQueryHandler),
|
||||
}
|
||||
}
|
||||
|
||||
// FakeClusterManagerConfigurationDocumentClient is a FakeClusterManagerConfigurationDocumentClient
|
||||
type FakeClusterManagerConfigurationDocumentClient struct {
|
||||
lock sync.RWMutex
|
||||
jsonHandle *codec.JsonHandle
|
||||
clusterManagerConfigurationDocuments map[string]*pkg.ClusterManagerConfigurationDocument
|
||||
triggerHandlers map[string]fakeClusterManagerConfigurationDocumentTriggerHandler
|
||||
queryHandlers map[string]fakeClusterManagerConfigurationDocumentQueryHandler
|
||||
sorter func([]*pkg.ClusterManagerConfigurationDocument)
|
||||
etag int
|
||||
|
||||
// returns true if documents conflict
|
||||
conflictChecker func(*pkg.ClusterManagerConfigurationDocument, *pkg.ClusterManagerConfigurationDocument) bool
|
||||
|
||||
// err, if not nil, is an error to return when attempting to communicate
|
||||
// with this Client
|
||||
err error
|
||||
}
|
||||
|
||||
// SetError sets or unsets an error that will be returned on any
|
||||
// FakeClusterManagerConfigurationDocumentClient method invocation
|
||||
func (c *FakeClusterManagerConfigurationDocumentClient) SetError(err error) {
|
||||
c.lock.Lock()
|
||||
defer c.lock.Unlock()
|
||||
|
||||
c.err = err
|
||||
}
|
||||
|
||||
// SetSorter sets or unsets a sorter function which will be used to sort values
|
||||
// returned by List() for test stability
|
||||
func (c *FakeClusterManagerConfigurationDocumentClient) SetSorter(sorter func([]*pkg.ClusterManagerConfigurationDocument)) {
|
||||
c.lock.Lock()
|
||||
defer c.lock.Unlock()
|
||||
|
||||
c.sorter = sorter
|
||||
}
|
||||
|
||||
// SetConflictChecker sets or unsets a function which can be used to validate
|
||||
// additional unique keys in a ClusterManagerConfigurationDocument
|
||||
func (c *FakeClusterManagerConfigurationDocumentClient) SetConflictChecker(conflictChecker func(*pkg.ClusterManagerConfigurationDocument, *pkg.ClusterManagerConfigurationDocument) bool) {
|
||||
c.lock.Lock()
|
||||
defer c.lock.Unlock()
|
||||
|
||||
c.conflictChecker = conflictChecker
|
||||
}
|
||||
|
||||
// SetTriggerHandler sets or unsets a trigger handler
|
||||
func (c *FakeClusterManagerConfigurationDocumentClient) SetTriggerHandler(triggerName string, trigger fakeClusterManagerConfigurationDocumentTriggerHandler) {
|
||||
c.lock.Lock()
|
||||
defer c.lock.Unlock()
|
||||
|
||||
c.triggerHandlers[triggerName] = trigger
|
||||
}
|
||||
|
||||
// SetQueryHandler sets or unsets a query handler
|
||||
func (c *FakeClusterManagerConfigurationDocumentClient) SetQueryHandler(queryName string, query fakeClusterManagerConfigurationDocumentQueryHandler) {
|
||||
c.lock.Lock()
|
||||
defer c.lock.Unlock()
|
||||
|
||||
c.queryHandlers[queryName] = query
|
||||
}
|
||||
|
||||
func (c *FakeClusterManagerConfigurationDocumentClient) deepCopy(clusterManagerConfigurationDocument *pkg.ClusterManagerConfigurationDocument) (*pkg.ClusterManagerConfigurationDocument, error) {
|
||||
var b []byte
|
||||
err := codec.NewEncoderBytes(&b, c.jsonHandle).Encode(clusterManagerConfigurationDocument)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
clusterManagerConfigurationDocument = nil
|
||||
err = codec.NewDecoderBytes(b, c.jsonHandle).Decode(&clusterManagerConfigurationDocument)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return clusterManagerConfigurationDocument, nil
|
||||
}
|
||||
|
||||
func (c *FakeClusterManagerConfigurationDocumentClient) apply(ctx context.Context, partitionkey string, clusterManagerConfigurationDocument *pkg.ClusterManagerConfigurationDocument, options *Options, isCreate bool) (*pkg.ClusterManagerConfigurationDocument, error) {
|
||||
c.lock.Lock()
|
||||
defer c.lock.Unlock()
|
||||
|
||||
if c.err != nil {
|
||||
return nil, c.err
|
||||
}
|
||||
|
||||
clusterManagerConfigurationDocument, err := c.deepCopy(clusterManagerConfigurationDocument) // copy now because pretriggers can mutate clusterManagerConfigurationDocument
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if options != nil {
|
||||
err := c.processPreTriggers(ctx, clusterManagerConfigurationDocument, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
existingClusterManagerConfigurationDocument, exists := c.clusterManagerConfigurationDocuments[clusterManagerConfigurationDocument.ID]
|
||||
if isCreate && exists {
|
||||
return nil, &Error{
|
||||
StatusCode: http.StatusConflict,
|
||||
Message: "Entity with the specified id already exists in the system",
|
||||
}
|
||||
}
|
||||
if !isCreate {
|
||||
if !exists {
|
||||
return nil, &Error{StatusCode: http.StatusNotFound}
|
||||
}
|
||||
|
||||
if clusterManagerConfigurationDocument.ETag != existingClusterManagerConfigurationDocument.ETag {
|
||||
return nil, &Error{StatusCode: http.StatusPreconditionFailed}
|
||||
}
|
||||
}
|
||||
|
||||
if c.conflictChecker != nil {
|
||||
for _, clusterManagerConfigurationDocumentToCheck := range c.clusterManagerConfigurationDocuments {
|
||||
if c.conflictChecker(clusterManagerConfigurationDocumentToCheck, clusterManagerConfigurationDocument) {
|
||||
return nil, &Error{
|
||||
StatusCode: http.StatusConflict,
|
||||
Message: "Entity with the specified id already exists in the system",
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
clusterManagerConfigurationDocument.ETag = fmt.Sprint(c.etag)
|
||||
c.etag++
|
||||
|
||||
c.clusterManagerConfigurationDocuments[clusterManagerConfigurationDocument.ID] = clusterManagerConfigurationDocument
|
||||
|
||||
return c.deepCopy(clusterManagerConfigurationDocument)
|
||||
}
|
||||
|
||||
// Create creates a ClusterManagerConfigurationDocument in the database
|
||||
func (c *FakeClusterManagerConfigurationDocumentClient) Create(ctx context.Context, partitionkey string, clusterManagerConfigurationDocument *pkg.ClusterManagerConfigurationDocument, options *Options) (*pkg.ClusterManagerConfigurationDocument, error) {
|
||||
return c.apply(ctx, partitionkey, clusterManagerConfigurationDocument, options, true)
|
||||
}
|
||||
|
||||
// Replace replaces a ClusterManagerConfigurationDocument in the database
|
||||
func (c *FakeClusterManagerConfigurationDocumentClient) Replace(ctx context.Context, partitionkey string, clusterManagerConfigurationDocument *pkg.ClusterManagerConfigurationDocument, options *Options) (*pkg.ClusterManagerConfigurationDocument, error) {
|
||||
return c.apply(ctx, partitionkey, clusterManagerConfigurationDocument, options, false)
|
||||
}
|
||||
|
||||
// List returns a ClusterManagerConfigurationDocumentIterator to list all ClusterManagerConfigurationDocuments in the database
|
||||
func (c *FakeClusterManagerConfigurationDocumentClient) List(*Options) ClusterManagerConfigurationDocumentIterator {
|
||||
c.lock.RLock()
|
||||
defer c.lock.RUnlock()
|
||||
|
||||
if c.err != nil {
|
||||
return NewFakeClusterManagerConfigurationDocumentErroringRawIterator(c.err)
|
||||
}
|
||||
|
||||
clusterManagerConfigurationDocuments := make([]*pkg.ClusterManagerConfigurationDocument, 0, len(c.clusterManagerConfigurationDocuments))
|
||||
for _, clusterManagerConfigurationDocument := range c.clusterManagerConfigurationDocuments {
|
||||
clusterManagerConfigurationDocument, err := c.deepCopy(clusterManagerConfigurationDocument)
|
||||
if err != nil {
|
||||
return NewFakeClusterManagerConfigurationDocumentErroringRawIterator(err)
|
||||
}
|
||||
clusterManagerConfigurationDocuments = append(clusterManagerConfigurationDocuments, clusterManagerConfigurationDocument)
|
||||
}
|
||||
|
||||
if c.sorter != nil {
|
||||
c.sorter(clusterManagerConfigurationDocuments)
|
||||
}
|
||||
|
||||
return NewFakeClusterManagerConfigurationDocumentIterator(clusterManagerConfigurationDocuments, 0)
|
||||
}
|
||||
|
||||
// ListAll lists all ClusterManagerConfigurationDocuments in the database
|
||||
func (c *FakeClusterManagerConfigurationDocumentClient) ListAll(ctx context.Context, options *Options) (*pkg.ClusterManagerConfigurationDocuments, error) {
|
||||
iter := c.List(options)
|
||||
return iter.Next(ctx, -1)
|
||||
}
|
||||
|
||||
// Get gets a ClusterManagerConfigurationDocument from the database
|
||||
func (c *FakeClusterManagerConfigurationDocumentClient) Get(ctx context.Context, partitionkey string, id string, options *Options) (*pkg.ClusterManagerConfigurationDocument, error) {
|
||||
c.lock.RLock()
|
||||
defer c.lock.RUnlock()
|
||||
|
||||
if c.err != nil {
|
||||
return nil, c.err
|
||||
}
|
||||
|
||||
clusterManagerConfigurationDocument, exists := c.clusterManagerConfigurationDocuments[id]
|
||||
if !exists {
|
||||
return nil, &Error{StatusCode: http.StatusNotFound}
|
||||
}
|
||||
|
||||
return c.deepCopy(clusterManagerConfigurationDocument)
|
||||
}
|
||||
|
||||
// Delete deletes a ClusterManagerConfigurationDocument from the database
|
||||
func (c *FakeClusterManagerConfigurationDocumentClient) Delete(ctx context.Context, partitionKey string, clusterManagerConfigurationDocument *pkg.ClusterManagerConfigurationDocument, options *Options) error {
|
||||
c.lock.Lock()
|
||||
defer c.lock.Unlock()
|
||||
|
||||
if c.err != nil {
|
||||
return c.err
|
||||
}
|
||||
|
||||
_, exists := c.clusterManagerConfigurationDocuments[clusterManagerConfigurationDocument.ID]
|
||||
if !exists {
|
||||
return &Error{StatusCode: http.StatusNotFound}
|
||||
}
|
||||
|
||||
delete(c.clusterManagerConfigurationDocuments, clusterManagerConfigurationDocument.ID)
|
||||
return nil
|
||||
}
|
||||
|
||||
// ChangeFeed is unimplemented
|
||||
func (c *FakeClusterManagerConfigurationDocumentClient) ChangeFeed(*Options) ClusterManagerConfigurationDocumentIterator {
|
||||
c.lock.RLock()
|
||||
defer c.lock.RUnlock()
|
||||
|
||||
if c.err != nil {
|
||||
return NewFakeClusterManagerConfigurationDocumentErroringRawIterator(c.err)
|
||||
}
|
||||
|
||||
return NewFakeClusterManagerConfigurationDocumentErroringRawIterator(ErrNotImplemented)
|
||||
}
|
||||
|
||||
func (c *FakeClusterManagerConfigurationDocumentClient) processPreTriggers(ctx context.Context, clusterManagerConfigurationDocument *pkg.ClusterManagerConfigurationDocument, options *Options) error {
|
||||
for _, triggerName := range options.PreTriggers {
|
||||
if triggerHandler := c.triggerHandlers[triggerName]; triggerHandler != nil {
|
||||
c.lock.Unlock()
|
||||
err := triggerHandler(ctx, clusterManagerConfigurationDocument)
|
||||
c.lock.Lock()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
return ErrNotImplemented
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Query calls a query handler to implement database querying
|
||||
func (c *FakeClusterManagerConfigurationDocumentClient) Query(name string, query *Query, options *Options) ClusterManagerConfigurationDocumentRawIterator {
|
||||
c.lock.RLock()
|
||||
defer c.lock.RUnlock()
|
||||
|
||||
if c.err != nil {
|
||||
return NewFakeClusterManagerConfigurationDocumentErroringRawIterator(c.err)
|
||||
}
|
||||
|
||||
if queryHandler := c.queryHandlers[query.Query]; queryHandler != nil {
|
||||
c.lock.RUnlock()
|
||||
i := queryHandler(c, query, options)
|
||||
c.lock.RLock()
|
||||
return i
|
||||
}
|
||||
|
||||
return NewFakeClusterManagerConfigurationDocumentErroringRawIterator(ErrNotImplemented)
|
||||
}
|
||||
|
||||
// QueryAll calls a query handler to implement database querying
|
||||
func (c *FakeClusterManagerConfigurationDocumentClient) QueryAll(ctx context.Context, partitionkey string, query *Query, options *Options) (*pkg.ClusterManagerConfigurationDocuments, error) {
|
||||
iter := c.Query("", query, options)
|
||||
return iter.Next(ctx, -1)
|
||||
}
|
||||
|
||||
func NewFakeClusterManagerConfigurationDocumentIterator(clusterManagerConfigurationDocuments []*pkg.ClusterManagerConfigurationDocument, continuation int) ClusterManagerConfigurationDocumentRawIterator {
|
||||
return &fakeClusterManagerConfigurationDocumentIterator{clusterManagerConfigurationDocuments: clusterManagerConfigurationDocuments, continuation: continuation}
|
||||
}
|
||||
|
||||
type fakeClusterManagerConfigurationDocumentIterator struct {
|
||||
clusterManagerConfigurationDocuments []*pkg.ClusterManagerConfigurationDocument
|
||||
continuation int
|
||||
done bool
|
||||
}
|
||||
|
||||
func (i *fakeClusterManagerConfigurationDocumentIterator) NextRaw(ctx context.Context, maxItemCount int, out interface{}) error {
|
||||
return ErrNotImplemented
|
||||
}
|
||||
|
||||
func (i *fakeClusterManagerConfigurationDocumentIterator) Next(ctx context.Context, maxItemCount int) (*pkg.ClusterManagerConfigurationDocuments, error) {
|
||||
if i.done {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
var clusterManagerConfigurationDocuments []*pkg.ClusterManagerConfigurationDocument
|
||||
if maxItemCount == -1 {
|
||||
clusterManagerConfigurationDocuments = i.clusterManagerConfigurationDocuments[i.continuation:]
|
||||
i.continuation = len(i.clusterManagerConfigurationDocuments)
|
||||
i.done = true
|
||||
} else {
|
||||
max := i.continuation + maxItemCount
|
||||
if max > len(i.clusterManagerConfigurationDocuments) {
|
||||
max = len(i.clusterManagerConfigurationDocuments)
|
||||
}
|
||||
clusterManagerConfigurationDocuments = i.clusterManagerConfigurationDocuments[i.continuation:max]
|
||||
i.continuation += max
|
||||
i.done = i.Continuation() == ""
|
||||
}
|
||||
|
||||
return &pkg.ClusterManagerConfigurationDocuments{
|
||||
ClusterManagerConfigurationDocuments: clusterManagerConfigurationDocuments,
|
||||
Count: len(clusterManagerConfigurationDocuments),
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (i *fakeClusterManagerConfigurationDocumentIterator) Continuation() string {
|
||||
if i.continuation >= len(i.clusterManagerConfigurationDocuments) {
|
||||
return ""
|
||||
}
|
||||
return fmt.Sprintf("%d", i.continuation)
|
||||
}
|
||||
|
||||
// NewFakeClusterManagerConfigurationDocumentErroringRawIterator returns a ClusterManagerConfigurationDocumentRawIterator which
|
||||
// whose methods return the given error
|
||||
func NewFakeClusterManagerConfigurationDocumentErroringRawIterator(err error) ClusterManagerConfigurationDocumentRawIterator {
|
||||
return &fakeClusterManagerConfigurationDocumentErroringRawIterator{err: err}
|
||||
}
|
||||
|
||||
type fakeClusterManagerConfigurationDocumentErroringRawIterator struct {
|
||||
err error
|
||||
}
|
||||
|
||||
func (i *fakeClusterManagerConfigurationDocumentErroringRawIterator) Next(ctx context.Context, maxItemCount int) (*pkg.ClusterManagerConfigurationDocuments, error) {
|
||||
return nil, i.err
|
||||
}
|
||||
|
||||
func (i *fakeClusterManagerConfigurationDocumentErroringRawIterator) NextRaw(context.Context, int, interface{}) error {
|
||||
return i.err
|
||||
}
|
||||
|
||||
func (i *fakeClusterManagerConfigurationDocumentErroringRawIterator) Continuation() string {
|
||||
return ""
|
||||
}
|
|
@ -28,12 +28,13 @@ import (
|
|||
const (
|
||||
collAsyncOperations = "AsyncOperations"
|
||||
collBilling = "Billing"
|
||||
collClusterManager = "ClusterManagerConfigurations"
|
||||
collGateway = "Gateway"
|
||||
collMonitors = "Monitors"
|
||||
collOpenShiftClusters = "OpenShiftClusters"
|
||||
collOpenShiftVersion = "OpenShiftVersions"
|
||||
collPortal = "Portal"
|
||||
collSubscriptions = "Subscriptions"
|
||||
collOpenShiftVersion = "OpenShiftVersions"
|
||||
)
|
||||
|
||||
func NewDatabaseClient(log *logrus.Entry, env env.Core, authorizer cosmosdb.Authorizer, m metrics.Emitter, aead encryption.AEAD) (cosmosdb.DatabaseClient, error) {
|
||||
|
|
|
@ -68,6 +68,27 @@
|
|||
"[resourceId('Microsoft.DocumentDB/databaseAccounts/sqlDatabases', parameters('databaseAccountName'), parameters('databaseName'))]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"resource": {
|
||||
"id": "ClusterManagerConfigurations",
|
||||
"partitionKey": {
|
||||
"paths": [
|
||||
"/partitionKey"
|
||||
],
|
||||
"kind": "Hash"
|
||||
}
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"name": "[concat(parameters('databaseAccountName'), '/', parameters('databaseName'), '/ClusterManagerConfigurations')]",
|
||||
"type": "Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers",
|
||||
"location": "[resourceGroup().location]",
|
||||
"apiVersion": "2021-01-15",
|
||||
"dependsOn": [
|
||||
"[resourceId('Microsoft.DocumentDB/databaseAccounts/sqlDatabases', parameters('databaseAccountName'), parameters('databaseName'))]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"resource": {
|
||||
|
@ -204,6 +225,15 @@
|
|||
"/id"
|
||||
],
|
||||
"kind": "Hash"
|
||||
},
|
||||
"uniqueKeyPolicy": {
|
||||
"uniqueKeys": [
|
||||
{
|
||||
"paths": [
|
||||
"/key"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"options": {}
|
||||
|
|
|
@ -815,6 +815,28 @@
|
|||
"[resourceId('Microsoft.DocumentDB/databaseAccounts', parameters('databaseAccountName'))]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"resource": {
|
||||
"id": "ClusterManagerConfigurations",
|
||||
"partitionKey": {
|
||||
"paths": [
|
||||
"/partitionKey"
|
||||
],
|
||||
"kind": "Hash"
|
||||
}
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"name": "[concat(parameters('databaseAccountName'), '/', 'ARO', '/ClusterManagerConfigurations')]",
|
||||
"type": "Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers",
|
||||
"location": "[resourceGroup().location]",
|
||||
"apiVersion": "2021-01-15",
|
||||
"dependsOn": [
|
||||
"[resourceId('Microsoft.DocumentDB/databaseAccounts/sqlDatabases', parameters('databaseAccountName'), 'ARO')]",
|
||||
"[resourceId('Microsoft.DocumentDB/databaseAccounts', parameters('databaseAccountName'))]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"resource": {
|
||||
|
@ -960,6 +982,15 @@
|
|||
"/id"
|
||||
],
|
||||
"kind": "Hash"
|
||||
},
|
||||
"uniqueKeyPolicy": {
|
||||
"uniqueKeys": [
|
||||
{
|
||||
"paths": [
|
||||
"/key"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"options": {}
|
||||
|
|
|
@ -1669,6 +1669,29 @@ func (g *generator) database(databaseName string, addDependsOn bool) []*arm.Reso
|
|||
"[resourceId('Microsoft.DocumentDB/databaseAccounts/sqlDatabases', parameters('databaseAccountName'), " + databaseName + ")]",
|
||||
},
|
||||
},
|
||||
{
|
||||
Resource: &mgmtdocumentdb.SQLContainerCreateUpdateParameters{
|
||||
SQLContainerCreateUpdateProperties: &mgmtdocumentdb.SQLContainerCreateUpdateProperties{
|
||||
Resource: &mgmtdocumentdb.SQLContainerResource{
|
||||
ID: to.StringPtr("ClusterManagerConfigurations"),
|
||||
PartitionKey: &mgmtdocumentdb.ContainerPartitionKey{
|
||||
Paths: &[]string{
|
||||
"/partitionKey",
|
||||
},
|
||||
Kind: mgmtdocumentdb.PartitionKindHash,
|
||||
},
|
||||
},
|
||||
Options: &mgmtdocumentdb.CreateUpdateOptions{},
|
||||
},
|
||||
Name: to.StringPtr("[concat(parameters('databaseAccountName'), '/', " + databaseName + ", '/ClusterManagerConfigurations')]"),
|
||||
Type: to.StringPtr("Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers"),
|
||||
Location: to.StringPtr("[resourceGroup().location]"),
|
||||
},
|
||||
APIVersion: azureclient.APIVersion("Microsoft.DocumentDB"),
|
||||
DependsOn: []string{
|
||||
"[resourceId('Microsoft.DocumentDB/databaseAccounts/sqlDatabases', parameters('databaseAccountName'), " + databaseName + ")]",
|
||||
},
|
||||
},
|
||||
{
|
||||
Resource: &mgmtdocumentdb.SQLContainerCreateUpdateParameters{
|
||||
SQLContainerCreateUpdateProperties: &mgmtdocumentdb.SQLContainerCreateUpdateProperties{
|
||||
|
@ -1771,6 +1794,15 @@ func (g *generator) database(databaseName string, addDependsOn bool) []*arm.Reso
|
|||
},
|
||||
Kind: mgmtdocumentdb.PartitionKindHash,
|
||||
},
|
||||
UniqueKeyPolicy: &mgmtdocumentdb.UniqueKeyPolicy{
|
||||
UniqueKeys: &[]mgmtdocumentdb.UniqueKey{
|
||||
{
|
||||
Paths: &[]string{
|
||||
"/key",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Options: &mgmtdocumentdb.CreateUpdateOptions{},
|
||||
},
|
||||
|
|
|
@ -152,7 +152,7 @@ func TestAdminCordonUncordonNode(t *testing.T) {
|
|||
t.Fatal(err)
|
||||
}
|
||||
|
||||
f, err := NewFrontend(ctx, ti.audit, ti.log, ti.env, ti.asyncOperationsDatabase, ti.openShiftClustersDatabase, ti.subscriptionsDatabase, nil, api.APIs, &noop.Noop{}, nil, func(*logrus.Entry, env.Interface, *api.OpenShiftCluster) (adminactions.KubeActions, error) {
|
||||
f, err := NewFrontend(ctx, ti.audit, ti.log, ti.env, ti.asyncOperationsDatabase, ti.clusterManagerDatabase, ti.openShiftClustersDatabase, ti.subscriptionsDatabase, nil, api.APIs, &noop.Noop{}, nil, func(*logrus.Entry, env.Interface, *api.OpenShiftCluster) (adminactions.KubeActions, error) {
|
||||
return k, nil
|
||||
}, nil, nil)
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ func TestAdminDrainNode(t *testing.T) {
|
|||
t.Fatal(err)
|
||||
}
|
||||
|
||||
f, err := NewFrontend(ctx, ti.audit, ti.log, ti.env, ti.asyncOperationsDatabase, ti.openShiftClustersDatabase, ti.subscriptionsDatabase, nil, api.APIs, &noop.Noop{}, nil, func(*logrus.Entry, env.Interface, *api.OpenShiftCluster) (adminactions.KubeActions, error) {
|
||||
f, err := NewFrontend(ctx, ti.audit, ti.log, ti.env, ti.asyncOperationsDatabase, ti.clusterManagerDatabase, ti.openShiftClustersDatabase, ti.subscriptionsDatabase, nil, api.APIs, &noop.Noop{}, nil, func(*logrus.Entry, env.Interface, *api.OpenShiftCluster) (adminactions.KubeActions, error) {
|
||||
return k, nil
|
||||
}, nil, nil)
|
||||
|
||||
|
|
|
@ -200,7 +200,7 @@ func TestAdminKubernetesObjectsGetAndDelete(t *testing.T) {
|
|||
t.Fatal(err)
|
||||
}
|
||||
|
||||
f, err := NewFrontend(ctx, ti.audit, ti.log, ti.env, ti.asyncOperationsDatabase, ti.openShiftClustersDatabase, ti.subscriptionsDatabase, nil, api.APIs, &noop.Noop{}, nil, func(*logrus.Entry, env.Interface, *api.OpenShiftCluster) (adminactions.KubeActions, error) {
|
||||
f, err := NewFrontend(ctx, ti.audit, ti.log, ti.env, ti.asyncOperationsDatabase, ti.clusterManagerDatabase, ti.openShiftClustersDatabase, ti.subscriptionsDatabase, nil, api.APIs, &noop.Noop{}, nil, func(*logrus.Entry, env.Interface, *api.OpenShiftCluster) (adminactions.KubeActions, error) {
|
||||
return k, nil
|
||||
}, nil, nil)
|
||||
if err != nil {
|
||||
|
@ -428,7 +428,7 @@ func TestAdminPostKubernetesObjects(t *testing.T) {
|
|||
t.Fatal(err)
|
||||
}
|
||||
|
||||
f, err := NewFrontend(ctx, ti.audit, ti.log, ti.env, ti.asyncOperationsDatabase, ti.openShiftClustersDatabase, ti.subscriptionsDatabase, nil, api.APIs, &noop.Noop{}, nil, func(*logrus.Entry, env.Interface, *api.OpenShiftCluster) (adminactions.KubeActions, error) {
|
||||
f, err := NewFrontend(ctx, ti.audit, ti.log, ti.env, ti.asyncOperationsDatabase, ti.clusterManagerDatabase, ti.openShiftClustersDatabase, ti.subscriptionsDatabase, nil, api.APIs, &noop.Noop{}, nil, func(*logrus.Entry, env.Interface, *api.OpenShiftCluster) (adminactions.KubeActions, error) {
|
||||
return k, nil
|
||||
}, nil, nil)
|
||||
if err != nil {
|
||||
|
|
|
@ -125,7 +125,7 @@ func TestAdminKubernetesGetPodLogs(t *testing.T) {
|
|||
t.Fatal(err)
|
||||
}
|
||||
|
||||
f, err := NewFrontend(ctx, ti.audit, ti.log, ti.env, ti.asyncOperationsDatabase, ti.openShiftClustersDatabase, ti.subscriptionsDatabase, nil, api.APIs, &noop.Noop{}, nil, func(*logrus.Entry, env.Interface, *api.OpenShiftCluster) (adminactions.KubeActions, error) {
|
||||
f, err := NewFrontend(ctx, ti.audit, ti.log, ti.env, ti.asyncOperationsDatabase, ti.clusterManagerDatabase, ti.openShiftClustersDatabase, ti.subscriptionsDatabase, nil, api.APIs, &noop.Noop{}, nil, func(*logrus.Entry, env.Interface, *api.OpenShiftCluster) (adminactions.KubeActions, error) {
|
||||
return k, nil
|
||||
}, nil, nil)
|
||||
if err != nil {
|
||||
|
|
|
@ -123,7 +123,7 @@ func TestAdminListOpenShiftCluster(t *testing.T) {
|
|||
ti.openShiftClustersClient.SetError(tt.throwsError)
|
||||
}
|
||||
|
||||
f, err := NewFrontend(ctx, ti.audit, ti.log, ti.env, ti.asyncOperationsDatabase, ti.openShiftClustersDatabase, ti.subscriptionsDatabase, nil, api.APIs, &noop.Noop{}, aead, nil, nil, func(log *logrus.Entry, dialer proxy.Dialer, m metrics.Emitter) clusterdata.OpenShiftClusterEnricher {
|
||||
f, err := NewFrontend(ctx, ti.audit, ti.log, ti.env, ti.asyncOperationsDatabase, ti.clusterManagerDatabase, ti.openShiftClustersDatabase, ti.subscriptionsDatabase, nil, api.APIs, &noop.Noop{}, aead, nil, nil, func(log *logrus.Entry, dialer proxy.Dialer, m metrics.Emitter) clusterdata.OpenShiftClusterEnricher {
|
||||
return ti.enricher
|
||||
})
|
||||
if err != nil {
|
||||
|
|
|
@ -84,7 +84,7 @@ func TestAdminRedeployVM(t *testing.T) {
|
|||
t.Fatal(err)
|
||||
}
|
||||
|
||||
f, err := NewFrontend(ctx, ti.audit, ti.log, ti.env, ti.asyncOperationsDatabase, ti.openShiftClustersDatabase, ti.subscriptionsDatabase, nil, api.APIs, &noop.Noop{}, nil, nil, func(*logrus.Entry, env.Interface, *api.OpenShiftCluster, *api.SubscriptionDocument) (adminactions.AzureActions, error) {
|
||||
f, err := NewFrontend(ctx, ti.audit, ti.log, ti.env, ti.asyncOperationsDatabase, ti.clusterManagerDatabase, ti.openShiftClustersDatabase, ti.subscriptionsDatabase, nil, api.APIs, &noop.Noop{}, nil, nil, func(*logrus.Entry, env.Interface, *api.OpenShiftCluster, *api.SubscriptionDocument) (adminactions.AzureActions, error) {
|
||||
return a, nil
|
||||
}, nil)
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ func TestAdminListResourcesList(t *testing.T) {
|
|||
t.Fatal(err)
|
||||
}
|
||||
|
||||
f, err := NewFrontend(ctx, ti.audit, ti.log, ti.env, ti.asyncOperationsDatabase, ti.openShiftClustersDatabase, ti.subscriptionsDatabase, nil, api.APIs, &noop.Noop{}, nil, nil, func(*logrus.Entry, env.Interface, *api.OpenShiftCluster, *api.SubscriptionDocument) (adminactions.AzureActions, error) {
|
||||
f, err := NewFrontend(ctx, ti.audit, ti.log, ti.env, ti.asyncOperationsDatabase, ti.clusterManagerDatabase, ti.openShiftClustersDatabase, ti.subscriptionsDatabase, nil, api.APIs, &noop.Noop{}, nil, nil, func(*logrus.Entry, env.Interface, *api.OpenShiftCluster, *api.SubscriptionDocument) (adminactions.AzureActions, error) {
|
||||
return a, nil
|
||||
}, nil)
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ func TestAdminStartVM(t *testing.T) {
|
|||
t.Fatal(err)
|
||||
}
|
||||
|
||||
f, err := NewFrontend(ctx, ti.audit, ti.log, ti.env, ti.asyncOperationsDatabase, ti.openShiftClustersDatabase, ti.subscriptionsDatabase, nil, api.APIs, &noop.Noop{}, nil, nil, func(*logrus.Entry, env.Interface, *api.OpenShiftCluster, *api.SubscriptionDocument) (adminactions.AzureActions, error) {
|
||||
f, err := NewFrontend(ctx, ti.audit, ti.log, ti.env, ti.asyncOperationsDatabase, ti.clusterManagerDatabase, ti.openShiftClustersDatabase, ti.subscriptionsDatabase, nil, api.APIs, &noop.Noop{}, nil, nil, func(*logrus.Entry, env.Interface, *api.OpenShiftCluster, *api.SubscriptionDocument) (adminactions.AzureActions, error) {
|
||||
return a, nil
|
||||
}, nil)
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ func TestAdminStopVM(t *testing.T) {
|
|||
t.Fatal(err)
|
||||
}
|
||||
|
||||
f, err := NewFrontend(ctx, ti.audit, ti.log, ti.env, ti.asyncOperationsDatabase, ti.openShiftClustersDatabase, ti.subscriptionsDatabase, nil, api.APIs, &noop.Noop{}, nil, nil, func(*logrus.Entry, env.Interface, *api.OpenShiftCluster, *api.SubscriptionDocument) (adminactions.AzureActions, error) {
|
||||
f, err := NewFrontend(ctx, ti.audit, ti.log, ti.env, ti.asyncOperationsDatabase, ti.clusterManagerDatabase, ti.openShiftClustersDatabase, ti.subscriptionsDatabase, nil, api.APIs, &noop.Noop{}, nil, nil, func(*logrus.Entry, env.Interface, *api.OpenShiftCluster, *api.SubscriptionDocument) (adminactions.AzureActions, error) {
|
||||
return a, nil
|
||||
}, nil)
|
||||
|
||||
|
|
|
@ -211,7 +211,7 @@ func TestAdminVMResize(t *testing.T) {
|
|||
t.Fatal(err)
|
||||
}
|
||||
|
||||
f, err := NewFrontend(ctx, ti.audit, ti.log, ti.env, ti.asyncOperationsDatabase, ti.openShiftClustersDatabase, ti.subscriptionsDatabase, nil, api.APIs, &noop.Noop{}, nil,
|
||||
f, err := NewFrontend(ctx, ti.audit, ti.log, ti.env, ti.asyncOperationsDatabase, ti.clusterManagerDatabase, ti.openShiftClustersDatabase, ti.subscriptionsDatabase, nil, api.APIs, &noop.Noop{}, nil,
|
||||
func(e *logrus.Entry, i env.Interface, osc *api.OpenShiftCluster) (adminactions.KubeActions, error) {
|
||||
return k, nil
|
||||
}, func(*logrus.Entry, env.Interface, *api.OpenShiftCluster, *api.SubscriptionDocument) (adminactions.AzureActions, error) {
|
||||
|
|
|
@ -136,7 +136,7 @@ func TestAdminListVMSizeList(t *testing.T) {
|
|||
t.Fatal(err)
|
||||
}
|
||||
|
||||
f, err := NewFrontend(ctx, ti.audit, ti.log, ti.env, ti.asyncOperationsDatabase, ti.openShiftClustersDatabase, ti.subscriptionsDatabase, nil, api.APIs, &noop.Noop{}, nil, nil, func(*logrus.Entry, env.Interface, *api.OpenShiftCluster, *api.SubscriptionDocument) (adminactions.AzureActions, error) {
|
||||
f, err := NewFrontend(ctx, ti.audit, ti.log, ti.env, ti.asyncOperationsDatabase, ti.clusterManagerDatabase, ti.openShiftClustersDatabase, ti.subscriptionsDatabase, nil, api.APIs, &noop.Noop{}, nil, nil, func(*logrus.Entry, env.Interface, *api.OpenShiftCluster, *api.SubscriptionDocument) (adminactions.AzureActions, error) {
|
||||
return a, nil
|
||||
}, nil)
|
||||
|
||||
|
|
|
@ -96,7 +96,7 @@ func TestOpenShiftVersionList(t *testing.T) {
|
|||
t.Fatal(err)
|
||||
}
|
||||
|
||||
f, err := NewFrontend(ctx, ti.audit, ti.log, ti.env, nil, nil, nil, ti.openShiftVersionsDatabase, api.APIs, &noop.Noop{}, nil, nil, nil, nil)
|
||||
f, err := NewFrontend(ctx, ti.audit, ti.log, ti.env, nil, nil, nil, nil, ti.openShiftVersionsDatabase, api.APIs, &noop.Noop{}, nil, nil, nil, nil)
|
||||
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
|
|
|
@ -196,7 +196,7 @@ func TestOpenShiftVersionPut(t *testing.T) {
|
|||
t.Fatal(err)
|
||||
}
|
||||
|
||||
f, err := NewFrontend(ctx, ti.audit, ti.log, ti.env, nil, nil, nil, ti.openShiftVersionsDatabase, api.APIs, &noop.Noop{}, nil, nil, nil, nil)
|
||||
f, err := NewFrontend(ctx, ti.audit, ti.log, ti.env, nil, nil, nil, nil, ti.openShiftVersionsDatabase, api.APIs, &noop.Noop{}, nil, nil, nil, nil)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
|
|
@ -133,7 +133,7 @@ func TestGetAsyncOperationResult(t *testing.T) {
|
|||
t.Fatal(err)
|
||||
}
|
||||
|
||||
f, err := NewFrontend(ctx, ti.audit, ti.log, ti.env, ti.asyncOperationsDatabase, ti.openShiftClustersDatabase, ti.subscriptionsDatabase, nil, api.APIs, &noop.Noop{}, nil, nil, nil, nil)
|
||||
f, err := NewFrontend(ctx, ti.audit, ti.log, ti.env, ti.asyncOperationsDatabase, ti.clusterManagerDatabase, ti.openShiftClustersDatabase, ti.subscriptionsDatabase, nil, api.APIs, &noop.Noop{}, nil, nil, nil, nil)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
|
|
@ -183,7 +183,7 @@ func TestGetAsyncOperationsStatus(t *testing.T) {
|
|||
ti.asyncOperationsClient.SetError(tt.dbError)
|
||||
}
|
||||
|
||||
f, err := NewFrontend(ctx, ti.audit, ti.log, ti.env, ti.asyncOperationsDatabase, ti.openShiftClustersDatabase, ti.subscriptionsDatabase, nil, api.APIs, &noop.Noop{}, nil, nil, nil, nil)
|
||||
f, err := NewFrontend(ctx, ti.audit, ti.log, ti.env, ti.asyncOperationsDatabase, ti.clusterManagerDatabase, ti.openShiftClustersDatabase, ti.subscriptionsDatabase, nil, api.APIs, &noop.Noop{}, nil, nil, nil, nil)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
|
|
@ -0,0 +1,62 @@
|
|||
package frontend
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the Apache License 2.0.
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
"github.com/sirupsen/logrus"
|
||||
|
||||
"github.com/Azure/ARO-RP/pkg/api"
|
||||
"github.com/Azure/ARO-RP/pkg/database/cosmosdb"
|
||||
"github.com/Azure/ARO-RP/pkg/frontend/middleware"
|
||||
)
|
||||
|
||||
func (f *frontend) deleteClusterManagerConfiguration(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
log := ctx.Value(middleware.ContextKeyLog).(*logrus.Entry)
|
||||
|
||||
if disableOCMAPI {
|
||||
reply(log, w, nil, []byte("forbidden."), api.NewCloudError(http.StatusForbidden, api.CloudErrorCodeForbidden, "", "forbidden."))
|
||||
return
|
||||
}
|
||||
|
||||
err := f._deleteClusterManagerConfiguration(ctx, log, r)
|
||||
switch {
|
||||
case cosmosdb.IsErrorStatusCode(err, http.StatusNotFound):
|
||||
err = statusCodeError(http.StatusNoContent)
|
||||
case err == nil:
|
||||
err = statusCodeError(http.StatusOK)
|
||||
}
|
||||
reply(log, w, nil, nil, err)
|
||||
}
|
||||
|
||||
func (f *frontend) _deleteClusterManagerConfiguration(ctx context.Context, log *logrus.Entry, r *http.Request) error {
|
||||
vars := mux.Vars(r)
|
||||
|
||||
_, err := f.validateSubscriptionState(ctx, r.URL.Path, api.SubscriptionStateRegistered, api.SubscriptionStateSuspended, api.SubscriptionStateWarned)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
doc, err := f.dbClusterManagerConfiguration.Get(ctx, r.URL.Path)
|
||||
switch {
|
||||
case cosmosdb.IsErrorStatusCode(err, http.StatusNotFound):
|
||||
return api.NewCloudError(http.StatusNotFound, api.CloudErrorCodeResourceNotFound, "", "The Resource '%s/%s/%s/%s' under resource group '%s' was not found.",
|
||||
vars["resourceType"], vars["resourceName"], vars["ocmResourceType"], vars["ocmResourceName"], vars["resourceGroupName"])
|
||||
case err != nil:
|
||||
return err
|
||||
}
|
||||
|
||||
// Right now we are going to assume that the backend will delete the document, we will just mark for deletion.
|
||||
doc.Deleting = true
|
||||
err = cosmosdb.RetryOnPreconditionFailed(func() error {
|
||||
var err error
|
||||
_, err = f.dbClusterManagerConfiguration.Update(ctx, doc)
|
||||
return err
|
||||
})
|
||||
return err
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
package frontend
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the Apache License 2.0.
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
"github.com/sirupsen/logrus"
|
||||
|
||||
"github.com/Azure/ARO-RP/pkg/api"
|
||||
"github.com/Azure/ARO-RP/pkg/database/cosmosdb"
|
||||
"github.com/Azure/ARO-RP/pkg/frontend/middleware"
|
||||
)
|
||||
|
||||
func (f *frontend) getClusterManagerConfiguration(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
log := ctx.Value(middleware.ContextKeyLog).(*logrus.Entry)
|
||||
vars := mux.Vars(r)
|
||||
|
||||
if disableOCMAPI {
|
||||
reply(log, w, nil, []byte("forbidden."), api.NewCloudError(http.StatusForbidden, api.CloudErrorCodeForbidden, "", "forbidden."))
|
||||
return
|
||||
}
|
||||
|
||||
b, err := f._getClusterManagerConfiguration(ctx, log, r, f.apis[vars["api-version"]].ClusterManagerConfigurationConverter)
|
||||
reply(log, w, nil, b, err)
|
||||
}
|
||||
|
||||
func (f *frontend) _getClusterManagerConfiguration(ctx context.Context, log *logrus.Entry, r *http.Request, converter api.ClusterManagerConfigurationConverter) ([]byte, error) {
|
||||
vars := mux.Vars(r)
|
||||
|
||||
doc, err := f.dbClusterManagerConfiguration.Get(ctx, r.URL.Path)
|
||||
switch {
|
||||
case cosmosdb.IsErrorStatusCode(err, http.StatusNotFound):
|
||||
return nil, api.NewCloudError(http.StatusNotFound, api.CloudErrorCodeResourceNotFound, "", "The Resource '%s/%s/%s/%s' under resource group '%s' was not found.",
|
||||
vars["resourceType"], vars["resourceName"], vars["ocmResourceType"], vars["ocmResourceName"], vars["resourceGroupName"])
|
||||
case err != nil:
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if doc.Deleting {
|
||||
return nil, api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeRequestNotAllowed, "", "Request is not allowed on a resource marked for deletion.")
|
||||
}
|
||||
|
||||
ext, err := converter.ToExternal(doc.ClusterManagerConfiguration)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return json.MarshalIndent(ext, "", " ")
|
||||
}
|
|
@ -0,0 +1,147 @@
|
|||
package frontend
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the Apache License 2.0.
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
"github.com/sirupsen/logrus"
|
||||
|
||||
"github.com/Azure/ARO-RP/pkg/api"
|
||||
"github.com/Azure/ARO-RP/pkg/database/cosmosdb"
|
||||
"github.com/Azure/ARO-RP/pkg/frontend/middleware"
|
||||
"github.com/Azure/ARO-RP/pkg/util/arm"
|
||||
)
|
||||
|
||||
func (f *frontend) putOrPatchClusterManagerConfiguration(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
log := ctx.Value(middleware.ContextKeyLog).(*logrus.Entry)
|
||||
vars := mux.Vars(r)
|
||||
var header http.Header
|
||||
var b []byte
|
||||
|
||||
if disableOCMAPI {
|
||||
reply(log, w, nil, []byte("forbidden."), api.NewCloudError(http.StatusForbidden, api.CloudErrorCodeForbidden, "", "forbidden."))
|
||||
return
|
||||
}
|
||||
|
||||
err := cosmosdb.RetryOnPreconditionFailed(func() error {
|
||||
var err error
|
||||
b, err = f._putOrPatchClusterManagerConfiguration(ctx, log, r, &header, f.apis[vars["api-version"]].ClusterManagerConfigurationConverter)
|
||||
return err
|
||||
})
|
||||
|
||||
reply(log, w, header, b, err)
|
||||
}
|
||||
|
||||
func (f *frontend) _putOrPatchClusterManagerConfiguration(ctx context.Context, log *logrus.Entry, r *http.Request, header *http.Header, converter api.ClusterManagerConfigurationConverter) ([]byte, error) {
|
||||
body := r.Context().Value(middleware.ContextKeyBody).([]byte)
|
||||
correlationData := r.Context().Value(middleware.ContextKeyCorrelationData).(*api.CorrelationData)
|
||||
systemData, _ := r.Context().Value(middleware.ContextKeySystemData).(*api.SystemData) // don't panic
|
||||
vars := mux.Vars(r)
|
||||
|
||||
_, err := f.validateSubscriptionState(ctx, r.URL.Path, api.SubscriptionStateRegistered)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
originalPath := r.Context().Value(middleware.ContextKeyOriginalPath).(string)
|
||||
armResource, err := arm.ParseArmResourceId(originalPath)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
ocp, err := f.dbOpenShiftClusters.Get(ctx, armResource.ParentResource())
|
||||
if err != nil && !cosmosdb.IsErrorStatusCode(err, http.StatusNotFound) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if ocp == nil || cosmosdb.IsErrorStatusCode(err, http.StatusNotFound) {
|
||||
return nil, api.NewCloudError(http.StatusNotFound, api.CloudErrorCodeResourceNotFound, "", "The Resource '%s/%s' under resource group '%s' was not found.", vars["resourceType"], vars["resourceName"], vars["resourceGroupName"])
|
||||
}
|
||||
|
||||
ocmdoc, _ := f.dbClusterManagerConfiguration.Get(ctx, r.URL.Path)
|
||||
if err != nil && !cosmosdb.IsErrorStatusCode(err, http.StatusNotFound) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
isCreate := ocmdoc == nil
|
||||
uuid := f.dbClusterManagerConfiguration.NewUUID()
|
||||
if isCreate {
|
||||
ocmdoc = &api.ClusterManagerConfigurationDocument{
|
||||
ID: uuid,
|
||||
Key: r.URL.Path,
|
||||
ClusterManagerConfiguration: &api.ClusterManagerConfiguration{
|
||||
ID: originalPath,
|
||||
Name: armResource.SubResource.ResourceName,
|
||||
ClusterResourceID: strings.ToLower(armResource.ParentResource()),
|
||||
Properties: api.ClusterManagerConfigurationProperties{
|
||||
Resources: body,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
var newdoc *api.ClusterManagerConfigurationDocument
|
||||
err = cosmosdb.RetryOnPreconditionFailed(func() error {
|
||||
newdoc, err = f.dbClusterManagerConfiguration.Create(ctx, ocmdoc)
|
||||
return err
|
||||
})
|
||||
ocmdoc = newdoc
|
||||
} else {
|
||||
if ocmdoc.Deleting {
|
||||
return nil, api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeRequestNotAllowed, "", "Request is not allowed on a resource marked for deletion.")
|
||||
}
|
||||
if ocmdoc.ClusterManagerConfiguration != nil {
|
||||
ocmdoc.ClusterManagerConfiguration.Properties.Resources = body
|
||||
}
|
||||
}
|
||||
|
||||
ocmdoc.CorrelationData = correlationData
|
||||
|
||||
f.systemDataClusterManagerEnricher(ocmdoc, systemData)
|
||||
ocmdoc, err = f.dbClusterManagerConfiguration.Update(ctx, ocmdoc)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var ext interface{}
|
||||
ext, err = converter.ToExternal(ocmdoc.ClusterManagerConfiguration)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
b, err := json.MarshalIndent(ext, "", " ")
|
||||
return b, err
|
||||
}
|
||||
|
||||
// TODO once we hit go1.18 we can refactor to use generics for any document using systemData
|
||||
// enrichClusterManagerSystemData will selectively overwrite systemData fields based on
|
||||
// arm inputs
|
||||
func enrichClusterManagerSystemData(doc *api.ClusterManagerConfigurationDocument, systemData *api.SystemData) {
|
||||
if systemData == nil {
|
||||
return
|
||||
}
|
||||
if systemData.CreatedAt != nil {
|
||||
doc.ClusterManagerConfiguration.SystemData.CreatedAt = systemData.CreatedAt
|
||||
}
|
||||
if systemData.CreatedBy != "" {
|
||||
doc.ClusterManagerConfiguration.SystemData.CreatedBy = systemData.CreatedBy
|
||||
}
|
||||
if systemData.CreatedByType != "" {
|
||||
doc.ClusterManagerConfiguration.SystemData.CreatedByType = systemData.CreatedByType
|
||||
}
|
||||
if systemData.LastModifiedAt != nil {
|
||||
doc.ClusterManagerConfiguration.SystemData.LastModifiedAt = systemData.LastModifiedAt
|
||||
}
|
||||
if systemData.LastModifiedBy != "" {
|
||||
doc.ClusterManagerConfiguration.SystemData.LastModifiedBy = systemData.LastModifiedBy
|
||||
}
|
||||
if systemData.LastModifiedByType != "" {
|
||||
doc.ClusterManagerConfiguration.SystemData.LastModifiedByType = systemData.LastModifiedByType
|
||||
}
|
||||
}
|
|
@ -32,6 +32,10 @@ import (
|
|||
"github.com/Azure/ARO-RP/pkg/util/recover"
|
||||
)
|
||||
|
||||
// TODO this const was put in place to disable the ocm routes
|
||||
// once we are ready to begin testing we can remove this bool and related code
|
||||
const disableOCMAPI = true
|
||||
|
||||
type statusCodeError int
|
||||
|
||||
func (err statusCodeError) Error() string {
|
||||
|
@ -49,10 +53,11 @@ type frontend struct {
|
|||
baseLog *logrus.Entry
|
||||
env env.Interface
|
||||
|
||||
dbAsyncOperations database.AsyncOperations
|
||||
dbOpenShiftClusters database.OpenShiftClusters
|
||||
dbSubscriptions database.Subscriptions
|
||||
dbOpenShiftVersions database.OpenShiftVersions
|
||||
dbAsyncOperations database.AsyncOperations
|
||||
dbClusterManagerConfiguration database.ClusterManagerConfigurations
|
||||
dbOpenShiftClusters database.OpenShiftClusters
|
||||
dbSubscriptions database.Subscriptions
|
||||
dbOpenShiftVersions database.OpenShiftVersions
|
||||
|
||||
apis map[string]*api.Version
|
||||
m metrics.Emitter
|
||||
|
@ -72,8 +77,9 @@ type frontend struct {
|
|||
ready atomic.Value
|
||||
|
||||
// these helps us to test and mock easier
|
||||
now func() time.Time
|
||||
systemDataEnricher func(*api.OpenShiftClusterDocument, *api.SystemData)
|
||||
now func() time.Time
|
||||
systemDataClusterDocEnricher func(*api.OpenShiftClusterDocument, *api.SystemData)
|
||||
systemDataClusterManagerEnricher func(*api.ClusterManagerConfigurationDocument, *api.SystemData)
|
||||
}
|
||||
|
||||
// Runnable represents a runnable object
|
||||
|
@ -87,6 +93,7 @@ func NewFrontend(ctx context.Context,
|
|||
baseLog *logrus.Entry,
|
||||
_env env.Interface,
|
||||
dbAsyncOperations database.AsyncOperations,
|
||||
dbClusterManagerConfiguration database.ClusterManagerConfigurations,
|
||||
dbOpenShiftClusters database.OpenShiftClusters,
|
||||
dbSubscriptions database.Subscriptions,
|
||||
dbOpenShiftVersions database.OpenShiftVersions,
|
||||
|
@ -97,26 +104,28 @@ func NewFrontend(ctx context.Context,
|
|||
azureActionsFactory azureActionsFactory,
|
||||
ocEnricherFactory ocEnricherFactory) (Runnable, error) {
|
||||
f := &frontend{
|
||||
auditLog: auditLog,
|
||||
baseLog: baseLog,
|
||||
env: _env,
|
||||
dbAsyncOperations: dbAsyncOperations,
|
||||
dbOpenShiftClusters: dbOpenShiftClusters,
|
||||
dbSubscriptions: dbSubscriptions,
|
||||
dbOpenShiftVersions: dbOpenShiftVersions,
|
||||
apis: apis,
|
||||
m: m,
|
||||
aead: aead,
|
||||
kubeActionsFactory: kubeActionsFactory,
|
||||
azureActionsFactory: azureActionsFactory,
|
||||
ocEnricherFactory: ocEnricherFactory,
|
||||
auditLog: auditLog,
|
||||
baseLog: baseLog,
|
||||
env: _env,
|
||||
dbAsyncOperations: dbAsyncOperations,
|
||||
dbClusterManagerConfiguration: dbClusterManagerConfiguration,
|
||||
dbOpenShiftClusters: dbOpenShiftClusters,
|
||||
dbSubscriptions: dbSubscriptions,
|
||||
dbOpenShiftVersions: dbOpenShiftVersions,
|
||||
apis: apis,
|
||||
m: m,
|
||||
aead: aead,
|
||||
kubeActionsFactory: kubeActionsFactory,
|
||||
azureActionsFactory: azureActionsFactory,
|
||||
ocEnricherFactory: ocEnricherFactory,
|
||||
|
||||
bucketAllocator: &bucket.Random{},
|
||||
|
||||
startTime: time.Now(),
|
||||
|
||||
now: time.Now,
|
||||
systemDataEnricher: enrichSystemData,
|
||||
now: time.Now,
|
||||
systemDataClusterDocEnricher: enrichClusterSystemData,
|
||||
systemDataClusterManagerEnricher: enrichClusterManagerSystemData,
|
||||
}
|
||||
|
||||
l, err := f.env.Listen()
|
||||
|
@ -179,6 +188,16 @@ func (f *frontend) authenticatedRoutes(r *mux.Router) {
|
|||
s.Methods(http.MethodPatch).HandlerFunc(f.putOrPatchOpenShiftCluster).Name("putOrPatchOpenShiftCluster")
|
||||
s.Methods(http.MethodPut).HandlerFunc(f.putOrPatchOpenShiftCluster).Name("putOrPatchOpenShiftCluster")
|
||||
|
||||
s = r.
|
||||
Path("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}/{ocmResourceType}/{ocmResourceName}").
|
||||
Queries("api-version", "{api-version}").
|
||||
Subrouter()
|
||||
|
||||
s.Methods(http.MethodDelete).HandlerFunc(f.deleteClusterManagerConfiguration).Name("deleteClusterManagerConfiguration")
|
||||
s.Methods(http.MethodGet).HandlerFunc(f.getClusterManagerConfiguration).Name("getClusterManagerConfiguration")
|
||||
s.Methods(http.MethodPatch).HandlerFunc(f.putOrPatchClusterManagerConfiguration).Name("putOrPatchClusterManagerConfiguration")
|
||||
s.Methods(http.MethodPut).HandlerFunc(f.putOrPatchClusterManagerConfiguration).Name("putOrPatchClusterManagerConfiguration")
|
||||
|
||||
s = r.
|
||||
Path("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}").
|
||||
Queries("api-version", "{api-version}").
|
||||
|
|
|
@ -99,7 +99,7 @@ func TestListInstallVersions(t *testing.T) {
|
|||
t.Fatal(err)
|
||||
}
|
||||
|
||||
f, err := NewFrontend(ctx, ti.audit, ti.log, ti.env, nil, nil, nil, ti.openShiftVersionsDatabase, api.APIs, &noop.Noop{}, nil, nil, nil, nil)
|
||||
f, err := NewFrontend(ctx, ti.audit, ti.log, ti.env, nil, nil, nil, nil, ti.openShiftVersionsDatabase, api.APIs, &noop.Noop{}, nil, nil, nil, nil)
|
||||
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
|
|
|
@ -114,7 +114,7 @@ func TestDeleteOpenShiftCluster(t *testing.T) {
|
|||
ti.subscriptionsClient.SetError(tt.dbError)
|
||||
}
|
||||
|
||||
f, err := NewFrontend(ctx, ti.audit, ti.log, ti.env, ti.asyncOperationsDatabase, ti.openShiftClustersDatabase, ti.subscriptionsDatabase, nil, api.APIs, &noop.Noop{}, nil, nil, nil, nil)
|
||||
f, err := NewFrontend(ctx, ti.audit, ti.log, ti.env, ti.asyncOperationsDatabase, ti.clusterManagerDatabase, ti.openShiftClustersDatabase, ti.subscriptionsDatabase, nil, api.APIs, &noop.Noop{}, nil, nil, nil, nil)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
|
|
@ -97,7 +97,7 @@ func TestGetOpenShiftCluster(t *testing.T) {
|
|||
ti.openShiftClustersClient.SetError(tt.dbError)
|
||||
}
|
||||
|
||||
f, err := NewFrontend(ctx, ti.audit, ti.log, ti.env, ti.asyncOperationsDatabase, ti.openShiftClustersDatabase, ti.subscriptionsDatabase, nil, api.APIs, &noop.Noop{}, nil, nil, nil, func(log *logrus.Entry, dialer proxy.Dialer, m metrics.Emitter) clusterdata.OpenShiftClusterEnricher {
|
||||
f, err := NewFrontend(ctx, ti.audit, ti.log, ti.env, ti.asyncOperationsDatabase, ti.clusterManagerDatabase, ti.openShiftClustersDatabase, ti.subscriptionsDatabase, nil, api.APIs, &noop.Noop{}, nil, nil, nil, func(log *logrus.Entry, dialer proxy.Dialer, m metrics.Emitter) clusterdata.OpenShiftClusterEnricher {
|
||||
return ti.enricher
|
||||
})
|
||||
if err != nil {
|
||||
|
|
|
@ -197,7 +197,7 @@ func TestListOpenShiftCluster(t *testing.T) {
|
|||
|
||||
aead := testdatabase.NewFakeAEAD()
|
||||
|
||||
f, err := NewFrontend(ctx, ti.audit, ti.log, ti.env, ti.asyncOperationsDatabase, ti.openShiftClustersDatabase, ti.subscriptionsDatabase, nil, api.APIs, &noop.Noop{}, aead, nil, nil, func(log *logrus.Entry, dialer proxy.Dialer, m metrics.Emitter) clusterdata.OpenShiftClusterEnricher {
|
||||
f, err := NewFrontend(ctx, ti.audit, ti.log, ti.env, ti.asyncOperationsDatabase, ti.clusterManagerDatabase, ti.openShiftClustersDatabase, ti.subscriptionsDatabase, nil, api.APIs, &noop.Noop{}, aead, nil, nil, func(log *logrus.Entry, dialer proxy.Dialer, m metrics.Emitter) clusterdata.OpenShiftClusterEnricher {
|
||||
return ti.enricher
|
||||
})
|
||||
if err != nil {
|
||||
|
|
|
@ -57,7 +57,6 @@ func (f *frontend) _putOrPatchOpenShiftCluster(ctx context.Context, log *logrus.
|
|||
if err != nil && !cosmosdb.IsErrorStatusCode(err, http.StatusNotFound) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
isCreate := doc == nil
|
||||
|
||||
if isCreate {
|
||||
|
@ -176,7 +175,7 @@ func (f *frontend) _putOrPatchOpenShiftCluster(ctx context.Context, log *logrus.
|
|||
|
||||
// This will update systemData from the values in the header. Old values, which
|
||||
// is not provided in the header must be preserved
|
||||
f.systemDataEnricher(doc, systemData)
|
||||
f.systemDataClusterDocEnricher(doc, systemData)
|
||||
|
||||
if isCreate {
|
||||
// on create, make the cluster resourcegroup ID lower case to work
|
||||
|
@ -251,9 +250,9 @@ func (f *frontend) _putOrPatchOpenShiftCluster(ctx context.Context, log *logrus.
|
|||
return b, err
|
||||
}
|
||||
|
||||
// enrichSystemData will selectively overwrite systemData fields based on
|
||||
// enrichClusterSystemData will selectively overwrite systemData fields based on
|
||||
// arm inputs
|
||||
func enrichSystemData(doc *api.OpenShiftClusterDocument, systemData *api.SystemData) {
|
||||
func enrichClusterSystemData(doc *api.OpenShiftClusterDocument, systemData *api.SystemData) {
|
||||
if systemData == nil {
|
||||
return
|
||||
}
|
||||
|
|
|
@ -567,7 +567,7 @@ func TestPutOrPatchOpenShiftClusterAdminAPI(t *testing.T) {
|
|||
t.Fatal(err)
|
||||
}
|
||||
|
||||
f, err := NewFrontend(ctx, ti.audit, ti.log, ti.env, ti.asyncOperationsDatabase, ti.openShiftClustersDatabase, ti.subscriptionsDatabase, nil, apis, &noop.Noop{}, nil, nil, nil, func(log *logrus.Entry, dialer proxy.Dialer, m metrics.Emitter) clusterdata.OpenShiftClusterEnricher {
|
||||
f, err := NewFrontend(ctx, ti.audit, ti.log, ti.env, ti.asyncOperationsDatabase, ti.clusterManagerDatabase, ti.openShiftClustersDatabase, ti.subscriptionsDatabase, nil, apis, &noop.Noop{}, nil, nil, nil, func(log *logrus.Entry, dialer proxy.Dialer, m metrics.Emitter) clusterdata.OpenShiftClusterEnricher {
|
||||
return ti.enricher
|
||||
})
|
||||
if err != nil {
|
||||
|
@ -575,9 +575,9 @@ func TestPutOrPatchOpenShiftClusterAdminAPI(t *testing.T) {
|
|||
}
|
||||
f.(*frontend).bucketAllocator = bucket.Fixed(1)
|
||||
|
||||
var systemDataEnricherCalled bool
|
||||
f.(*frontend).systemDataEnricher = func(doc *api.OpenShiftClusterDocument, systemData *api.SystemData) {
|
||||
systemDataEnricherCalled = true
|
||||
var systemDataClusterDocEnricherCalled bool
|
||||
f.(*frontend).systemDataClusterDocEnricher = func(doc *api.OpenShiftClusterDocument, systemData *api.SystemData) {
|
||||
systemDataClusterDocEnricherCalled = true
|
||||
}
|
||||
|
||||
go f.Run(ctx, nil, nil)
|
||||
|
@ -633,8 +633,8 @@ func TestPutOrPatchOpenShiftClusterAdminAPI(t *testing.T) {
|
|||
t.Error(err)
|
||||
}
|
||||
|
||||
if tt.wantSystemDataEnriched != systemDataEnricherCalled {
|
||||
t.Error(systemDataEnricherCalled)
|
||||
if tt.wantSystemDataEnriched != systemDataClusterDocEnricherCalled {
|
||||
t.Error(systemDataClusterDocEnricherCalled)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -1392,7 +1392,7 @@ func TestPutOrPatchOpenShiftCluster(t *testing.T) {
|
|||
t.Fatal(err)
|
||||
}
|
||||
|
||||
f, err := NewFrontend(ctx, ti.audit, ti.log, ti.env, ti.asyncOperationsDatabase, ti.openShiftClustersDatabase, ti.subscriptionsDatabase, ti.openShiftVersionsDatabase, apis, &noop.Noop{}, nil, nil, nil, func(log *logrus.Entry, dialer proxy.Dialer, m metrics.Emitter) clusterdata.OpenShiftClusterEnricher {
|
||||
f, err := NewFrontend(ctx, ti.audit, ti.log, ti.env, ti.asyncOperationsDatabase, ti.clusterManagerDatabase, ti.openShiftClustersDatabase, ti.subscriptionsDatabase, ti.openShiftVersionsDatabase, apis, &noop.Noop{}, nil, nil, nil, func(log *logrus.Entry, dialer proxy.Dialer, m metrics.Emitter) clusterdata.OpenShiftClusterEnricher {
|
||||
return ti.enricher
|
||||
})
|
||||
if err != nil {
|
||||
|
@ -1401,9 +1401,9 @@ func TestPutOrPatchOpenShiftCluster(t *testing.T) {
|
|||
f.(*frontend).bucketAllocator = bucket.Fixed(1)
|
||||
f.(*frontend).now = func() time.Time { return mockCurrentTime }
|
||||
|
||||
var systemDataEnricherCalled bool
|
||||
f.(*frontend).systemDataEnricher = func(doc *api.OpenShiftClusterDocument, systemData *api.SystemData) {
|
||||
systemDataEnricherCalled = true
|
||||
var systemDataClusterDocEnricherCalled bool
|
||||
f.(*frontend).systemDataClusterDocEnricher = func(doc *api.OpenShiftClusterDocument, systemData *api.SystemData) {
|
||||
systemDataClusterDocEnricherCalled = true
|
||||
}
|
||||
|
||||
go f.Run(ctx, nil, nil)
|
||||
|
@ -1457,8 +1457,8 @@ func TestPutOrPatchOpenShiftCluster(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
if tt.wantSystemDataEnriched != systemDataEnricherCalled {
|
||||
t.Error(systemDataEnricherCalled)
|
||||
if tt.wantSystemDataEnriched != systemDataClusterDocEnricherCalled {
|
||||
t.Error(systemDataClusterDocEnricherCalled)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -1694,7 +1694,7 @@ func TestPutOrPatchOpenShiftClusterValidated(t *testing.T) {
|
|||
t.Fatal(err)
|
||||
}
|
||||
|
||||
f, err := NewFrontend(ctx, ti.audit, ti.log, ti.env, ti.asyncOperationsDatabase, ti.openShiftClustersDatabase, ti.subscriptionsDatabase, ti.openShiftVersionsDatabase, api.APIs, &noop.Noop{}, nil, nil, nil, func(log *logrus.Entry, dialer proxy.Dialer, m metrics.Emitter) clusterdata.OpenShiftClusterEnricher {
|
||||
f, err := NewFrontend(ctx, ti.audit, ti.log, ti.env, ti.asyncOperationsDatabase, ti.clusterManagerDatabase, ti.openShiftClustersDatabase, ti.subscriptionsDatabase, ti.openShiftVersionsDatabase, api.APIs, &noop.Noop{}, nil, nil, nil, func(log *logrus.Entry, dialer proxy.Dialer, m metrics.Emitter) clusterdata.OpenShiftClusterEnricher {
|
||||
return ti.enricher
|
||||
})
|
||||
if err != nil {
|
||||
|
@ -1703,10 +1703,10 @@ func TestPutOrPatchOpenShiftClusterValidated(t *testing.T) {
|
|||
f.(*frontend).bucketAllocator = bucket.Fixed(1)
|
||||
f.(*frontend).now = func() time.Time { return mockCurrentTime }
|
||||
|
||||
var systemDataEnricherCalled bool
|
||||
f.(*frontend).systemDataEnricher = func(doc *api.OpenShiftClusterDocument, systemData *api.SystemData) {
|
||||
enrichSystemData(doc, systemData)
|
||||
systemDataEnricherCalled = true
|
||||
var systemDataClusterDocEnricherCalled bool
|
||||
f.(*frontend).systemDataClusterDocEnricher = func(doc *api.OpenShiftClusterDocument, systemData *api.SystemData) {
|
||||
enrichClusterSystemData(doc, systemData)
|
||||
systemDataClusterDocEnricherCalled = true
|
||||
}
|
||||
|
||||
go f.Run(ctx, nil, nil)
|
||||
|
@ -1769,14 +1769,14 @@ func TestPutOrPatchOpenShiftClusterValidated(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
if tt.wantSystemDataEnriched != systemDataEnricherCalled {
|
||||
t.Error(systemDataEnricherCalled)
|
||||
if tt.wantSystemDataEnriched != systemDataClusterDocEnricherCalled {
|
||||
t.Error(systemDataClusterDocEnricherCalled)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestEnrichSystemData(t *testing.T) {
|
||||
func TestEnrichClusterSystemData(t *testing.T) {
|
||||
accountID1 := "00000000-0000-0000-0000-000000000001"
|
||||
accountID2 := "00000000-0000-0000-0000-000000000002"
|
||||
timestampString := "2021-01-23T12:34:54.0000000Z"
|
||||
|
@ -1865,7 +1865,7 @@ func TestEnrichSystemData(t *testing.T) {
|
|||
doc := &api.OpenShiftClusterDocument{
|
||||
OpenShiftCluster: &api.OpenShiftCluster{},
|
||||
}
|
||||
enrichSystemData(doc, tt.systemData)
|
||||
enrichClusterSystemData(doc, tt.systemData)
|
||||
|
||||
if !reflect.DeepEqual(doc, tt.expected) {
|
||||
t.Error(cmp.Diff(doc, tt.expected))
|
||||
|
|
|
@ -267,7 +267,7 @@ func TestPostOpenShiftClusterCredentials(t *testing.T) {
|
|||
t.Fatal(err)
|
||||
}
|
||||
|
||||
f, err := NewFrontend(ctx, ti.audit, ti.log, ti.env, ti.asyncOperationsDatabase, ti.openShiftClustersDatabase, ti.subscriptionsDatabase, nil, apis, &noop.Noop{}, nil, nil, nil, nil)
|
||||
f, err := NewFrontend(ctx, ti.audit, ti.log, ti.env, ti.asyncOperationsDatabase, ti.clusterManagerDatabase, ti.openShiftClustersDatabase, ti.subscriptionsDatabase, nil, apis, &noop.Noop{}, nil, nil, nil, nil)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
|
|
@ -305,7 +305,7 @@ func TestPostOpenShiftClusterKubeConfigCredentials(t *testing.T) {
|
|||
t.Fatal(err)
|
||||
}
|
||||
|
||||
f, err := NewFrontend(ctx, ti.audit, ti.log, ti.env, ti.asyncOperationsDatabase, ti.openShiftClustersDatabase, ti.subscriptionsDatabase, nil, apis, &noop.Noop{}, nil, nil, nil, nil)
|
||||
f, err := NewFrontend(ctx, ti.audit, ti.log, ti.env, ti.asyncOperationsDatabase, ti.clusterManagerDatabase, ti.openShiftClustersDatabase, ti.subscriptionsDatabase, nil, apis, &noop.Noop{}, nil, nil, nil, nil)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ func TestSecurity(t *testing.T) {
|
|||
|
||||
log := logrus.NewEntry(logrus.StandardLogger())
|
||||
auditHook, auditEntry := testlog.NewAudit()
|
||||
f, err := NewFrontend(ctx, auditEntry, log, _env, nil, nil, nil, nil, api.APIs, &noop.Noop{}, nil, nil, nil, nil)
|
||||
f, err := NewFrontend(ctx, auditEntry, log, _env, nil, nil, nil, nil, nil, api.APIs, &noop.Noop{}, nil, nil, nil, nil)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
|
|
@ -74,6 +74,8 @@ type testInfra struct {
|
|||
asyncOperationsDatabase database.AsyncOperations
|
||||
billingClient *cosmosdb.FakeBillingDocumentClient
|
||||
billingDatabase database.Billing
|
||||
clusterManagerClient *cosmosdb.FakeClusterManagerConfigurationDocumentClient
|
||||
clusterManagerDatabase database.ClusterManagerConfigurations
|
||||
subscriptionsClient *cosmosdb.FakeSubscriptionDocumentClient
|
||||
subscriptionsDatabase database.Subscriptions
|
||||
openShiftVersionsClient *cosmosdb.FakeOpenShiftVersionDocumentClient
|
||||
|
@ -169,6 +171,12 @@ func (ti *testInfra) WithOpenShiftVersions() *testInfra {
|
|||
return ti
|
||||
}
|
||||
|
||||
func (ti *testInfra) WithClusterManagerConfigurations() *testInfra {
|
||||
ti.clusterManagerDatabase, ti.clusterManagerClient = testdatabase.NewFakeClusterManager()
|
||||
ti.fixture.WithClusterManagerConfigurations(ti.clusterManagerDatabase)
|
||||
return ti
|
||||
}
|
||||
|
||||
func (ti *testInfra) done() {
|
||||
ti.controller.Finish()
|
||||
ti.cli.CloseIdleConnections()
|
||||
|
|
|
@ -244,7 +244,7 @@ func TestPutSubscription(t *testing.T) {
|
|||
t.Fatal(err)
|
||||
}
|
||||
|
||||
f, err := NewFrontend(ctx, ti.audit, ti.log, ti.env, ti.asyncOperationsDatabase, ti.openShiftClustersDatabase, ti.subscriptionsDatabase, nil, api.APIs, &noop.Noop{}, nil, nil, nil, nil)
|
||||
f, err := NewFrontend(ctx, ti.audit, ti.log, ti.env, ti.asyncOperationsDatabase, ti.clusterManagerDatabase, ti.openShiftClustersDatabase, ti.subscriptionsDatabase, nil, api.APIs, &noop.Noop{}, nil, nil, nil, nil)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
|
|
@ -34,7 +34,6 @@ func (g *generator) generateExamples(outputDir string, s *Swagger) error {
|
|||
}{
|
||||
Responses: Responses{},
|
||||
}
|
||||
|
||||
for _, param := range op.Parameters {
|
||||
switch param := param.(type) {
|
||||
case Reference:
|
||||
|
@ -67,6 +66,11 @@ func (g *generator) generateExamples(outputDir string, s *Swagger) error {
|
|||
Name: param.Name,
|
||||
Parameter: "resourceName",
|
||||
})
|
||||
case "childResourceName":
|
||||
example.Parameters = append(example.Parameters, NameParameter{
|
||||
Name: "childResourceName",
|
||||
Parameter: "childResourceName",
|
||||
})
|
||||
case "parameters":
|
||||
switch param.Schema.Ref {
|
||||
case "#/definitions/OpenShiftCluster":
|
||||
|
@ -79,6 +83,46 @@ func (g *generator) generateExamples(outputDir string, s *Swagger) error {
|
|||
Name: param.Name,
|
||||
Parameter: g.exampleOpenShiftClusterPatchParameter(),
|
||||
})
|
||||
case "#/definitions/SyncSet":
|
||||
example.Parameters = append(example.Parameters, NameParameter{
|
||||
Name: param.Name,
|
||||
Parameter: g.exampleSyncSetPutParameter(),
|
||||
})
|
||||
case "#/definitions/SyncSetUpdate":
|
||||
example.Parameters = append(example.Parameters, NameParameter{
|
||||
Name: param.Name,
|
||||
Parameter: g.exampleSyncSetPatchParameter(),
|
||||
})
|
||||
case "#/definitions/MachinePool":
|
||||
example.Parameters = append(example.Parameters, NameParameter{
|
||||
Name: param.Name,
|
||||
Parameter: g.exampleMachinePoolPutParameter(),
|
||||
})
|
||||
case "#/definitions/MachinePoolUpdate":
|
||||
example.Parameters = append(example.Parameters, NameParameter{
|
||||
Name: param.Name,
|
||||
Parameter: g.exampleMachinePoolPatchParameter(),
|
||||
})
|
||||
case "#/definitions/SyncIdentityProvider":
|
||||
example.Parameters = append(example.Parameters, NameParameter{
|
||||
Name: param.Name,
|
||||
Parameter: g.exampleSyncIdentityProviderPutParameter(),
|
||||
})
|
||||
case "#/definitions/SyncIdentityProviderUpdate":
|
||||
example.Parameters = append(example.Parameters, NameParameter{
|
||||
Name: param.Name,
|
||||
Parameter: g.exampleSyncIdentityProviderPatchParameter(),
|
||||
})
|
||||
case "#/definitions/Secret":
|
||||
example.Parameters = append(example.Parameters, NameParameter{
|
||||
Name: param.Name,
|
||||
Parameter: g.exampleSecretPutParameter(),
|
||||
})
|
||||
case "#/definitions/SecretUpdate":
|
||||
example.Parameters = append(example.Parameters, NameParameter{
|
||||
Name: param.Name,
|
||||
Parameter: g.exampleSecretPatchParameter(),
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -94,6 +138,22 @@ func (g *generator) generateExamples(outputDir string, s *Swagger) error {
|
|||
var body interface{}
|
||||
if response.Schema != nil {
|
||||
switch response.Schema.Ref {
|
||||
case "#/definitions/SyncSet":
|
||||
body = g.exampleSyncSetResponse()
|
||||
case "#/definitions/SyncSetList":
|
||||
body = g.exampleSyncSetListResponse()
|
||||
case "#/definitions/MachinePool":
|
||||
body = g.exampleSyncSetResponse()
|
||||
case "#/definitions/MachinePoolList":
|
||||
body = g.exampleSyncSetListResponse()
|
||||
case "#/definitions/SyncIdentityProvider":
|
||||
body = g.exampleSyncSetResponse()
|
||||
case "#/definitions/SyncIdentityProviderList":
|
||||
body = g.exampleSyncSetListResponse()
|
||||
case "#/definitions/Secret":
|
||||
body = g.exampleSecretResponse()
|
||||
case "#/definitions/SecretList":
|
||||
body = g.exampleSecretListResponse()
|
||||
case "#/definitions/OpenShiftCluster":
|
||||
body = g.exampleOpenShiftClusterResponse()
|
||||
case "#/definitions/OpenShiftClusterCredentials":
|
||||
|
|
|
@ -19,6 +19,22 @@ const apiv20220401Path = "github.com/Azure/ARO-RP/pkg/api/v20220401"
|
|||
const apiv20220904Path = "github.com/Azure/ARO-RP/pkg/api/v20220904"
|
||||
|
||||
type generator struct {
|
||||
exampleSyncSetPutParameter func() interface{}
|
||||
exampleSyncSetPatchParameter func() interface{}
|
||||
exampleSyncSetResponse func() interface{}
|
||||
exampleSyncSetListResponse func() interface{}
|
||||
exampleMachinePoolPutParameter func() interface{}
|
||||
exampleMachinePoolPatchParameter func() interface{}
|
||||
exampleMachinePoolResponse func() interface{}
|
||||
exampleMachinePoolListResponse func() interface{}
|
||||
exampleSyncIdentityProviderPutParameter func() interface{}
|
||||
exampleSyncIdentityProviderPatchParameter func() interface{}
|
||||
exampleSyncIdentityProviderResponse func() interface{}
|
||||
exampleSyncIdentityProviderListResponse func() interface{}
|
||||
exampleSecretPutParameter func() interface{}
|
||||
exampleSecretPatchParameter func() interface{}
|
||||
exampleSecretResponse func() interface{}
|
||||
exampleSecretListResponse func() interface{}
|
||||
exampleOpenShiftClusterPutParameter func() interface{}
|
||||
exampleOpenShiftClusterPatchParameter func() interface{}
|
||||
exampleOpenShiftClusterResponse func() interface{}
|
||||
|
@ -31,6 +47,7 @@ type generator struct {
|
|||
systemData bool
|
||||
kubeConfig bool
|
||||
installVersionList bool
|
||||
clusterManager bool
|
||||
xmsEnum []string
|
||||
xmsSecretList []string
|
||||
xmsIdentifiers []string
|
||||
|
@ -81,6 +98,22 @@ var apis = map[string]*generator{
|
|||
kubeConfig: true,
|
||||
},
|
||||
apiv20220904Path: {
|
||||
exampleSyncSetPutParameter: v20220904.ExampleSyncSetPutParameter,
|
||||
exampleSyncSetPatchParameter: v20220904.ExampleSyncSetPatchParameter,
|
||||
exampleSyncSetResponse: v20220904.ExampleSyncSetResponse,
|
||||
exampleSyncSetListResponse: v20220904.ExampleSyncSetListResponse,
|
||||
exampleMachinePoolPutParameter: v20220904.ExampleMachinePoolPutParameter,
|
||||
exampleMachinePoolPatchParameter: v20220904.ExampleMachinePoolPatchParameter,
|
||||
exampleMachinePoolResponse: v20220904.ExampleMachinePoolResponse,
|
||||
exampleMachinePoolListResponse: v20220904.ExampleMachinePoolListResponse,
|
||||
exampleSyncIdentityProviderPutParameter: v20220904.ExampleSyncIdentityProviderPutParameter,
|
||||
exampleSyncIdentityProviderPatchParameter: v20220904.ExampleSyncIdentityProviderPatchParameter,
|
||||
exampleSyncIdentityProviderResponse: v20220904.ExampleSyncIdentityProviderResponse,
|
||||
exampleSyncIdentityProviderListResponse: v20220904.ExampleSyncIdentityProviderListResponse,
|
||||
exampleSecretPutParameter: v20220904.ExampleSecretPutParameter,
|
||||
exampleSecretPatchParameter: v20220904.ExampleSecretPatchParameter,
|
||||
exampleSecretResponse: v20220904.ExampleSecretResponse,
|
||||
exampleSecretListResponse: v20220904.ExampleSecretListResponse,
|
||||
exampleOpenShiftClusterPutParameter: v20220904.ExampleOpenShiftClusterPutParameter,
|
||||
exampleOpenShiftClusterPatchParameter: v20220904.ExampleOpenShiftClusterPatchParameter,
|
||||
exampleOpenShiftClusterResponse: v20220904.ExampleOpenShiftClusterResponse,
|
||||
|
@ -91,10 +124,11 @@ var apis = map[string]*generator{
|
|||
exampleOperationListResponse: api.ExampleOperationListResponse,
|
||||
|
||||
xmsEnum: []string{"EncryptionAtHost", "FipsValidatedModules", "SoftwareDefinedNetwork", "Visibility"},
|
||||
xmsSecretList: []string{"kubeconfig", "kubeadminPassword"},
|
||||
xmsSecretList: []string{"kubeconfig", "kubeadminPassword", "secretResources"},
|
||||
xmsIdentifiers: []string{},
|
||||
commonTypesVersion: "v3",
|
||||
systemData: true,
|
||||
clusterManager: true,
|
||||
installVersionList: true,
|
||||
kubeConfig: true,
|
||||
},
|
||||
|
|
|
@ -20,6 +20,10 @@ import (
|
|||
// n==4 action on resource expecting input payload
|
||||
// n==5 patch action on resource expecting input payload
|
||||
// n==6 list across subscription and location
|
||||
// n==7 action on child resource not expecting input payload
|
||||
// n==8 action on child resource expecting input payload
|
||||
// n==9 patch action on resource expecting input payload
|
||||
// n==10 list child resources belonging to a parent resource
|
||||
|
||||
func (g *generator) populateParameters(n int, typ, friendlyName string) (s []interface{}) {
|
||||
s = []interface{}{
|
||||
|
@ -27,17 +31,17 @@ func (g *generator) populateParameters(n int, typ, friendlyName string) (s []int
|
|||
Ref: "../../../../../common-types/resource-management/" + g.commonTypesVersion + "/types.json#/parameters/ApiVersionParameter",
|
||||
},
|
||||
}
|
||||
|
||||
if n > 0 {
|
||||
s = append(s, Reference{
|
||||
Ref: "../../../../../common-types/resource-management/" + g.commonTypesVersion + "/types.json#/parameters/SubscriptionIdParameter",
|
||||
})
|
||||
if n == 6 {
|
||||
s = append(s, Reference{
|
||||
Ref: "../../../../../common-types/resource-management/" + g.commonTypesVersion + "/types.json#/parameters/LocationParameter",
|
||||
})
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if n == 6 {
|
||||
s = append(s, Reference{
|
||||
Ref: "../../../../../common-types/resource-management/" + g.commonTypesVersion + "/types.json#/parameters/LocationParameter",
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
if n > 1 {
|
||||
|
@ -47,16 +51,36 @@ func (g *generator) populateParameters(n int, typ, friendlyName string) (s []int
|
|||
}
|
||||
|
||||
if n > 2 {
|
||||
temp := friendlyName
|
||||
if contains(proxyResources, temp) {
|
||||
temp = "OpenShift cluster"
|
||||
}
|
||||
s = append(s, Parameter{
|
||||
Name: "resourceName",
|
||||
In: "path",
|
||||
Description: "The name of the " + temp + " resource.",
|
||||
Required: true,
|
||||
Type: "string",
|
||||
})
|
||||
}
|
||||
|
||||
// gross. this is really hacky :/
|
||||
// this covers get,put,patch,delete by adding this
|
||||
// parameter as a required parameter for those operations
|
||||
// except when n==10, then its not a required parameter
|
||||
if n >= 7 && n != 10 {
|
||||
s = append(s, Parameter{
|
||||
Name: "childResourceName",
|
||||
In: "path",
|
||||
Description: "The name of the " + friendlyName + " resource.",
|
||||
Required: true,
|
||||
Type: "string",
|
||||
})
|
||||
}
|
||||
|
||||
if n > 3 {
|
||||
// TODO: refactor this entire function to make sense
|
||||
// so we can stop thinking about what int value builds a proper swagger parameter
|
||||
if n > 3 && n != 7 && n != 10 {
|
||||
s = append(s, Parameter{
|
||||
Name: "parameters",
|
||||
In: "body",
|
||||
|
@ -68,10 +92,9 @@ func (g *generator) populateParameters(n int, typ, friendlyName string) (s []int
|
|||
})
|
||||
}
|
||||
|
||||
if n > 4 {
|
||||
if n == 5 || n == 9 {
|
||||
s[len(s)-1].(Parameter).Schema.Ref += "Update"
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -105,6 +128,58 @@ func (g *generator) populateResponses(typ string, isDelete bool, statusCodes ...
|
|||
return
|
||||
}
|
||||
|
||||
// populateChildResourcePaths populates the paths for a child resource of a top level ARM resoure with list and CRUD operations defined for the path item
|
||||
func (g *generator) populateChildResourcePaths(ps Paths, resourceProviderNamespace string, resourceType string, childResourceType string, friendlyName string) {
|
||||
titleCaser := cases.Title(language.Und, cases.NoLower)
|
||||
ps["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/"+resourceProviderNamespace+"/"+resourceType+"/{resourceName}/"+childResourceType+"s"] = &PathItem{
|
||||
Get: &Operation{
|
||||
Tags: []string{titleCaser.String(childResourceType) + "s"},
|
||||
Summary: "Lists " + friendlyName + "s that belong to that Azure Red Hat OpenShift Cluster.",
|
||||
Description: "The operation returns properties of each " + friendlyName + ".",
|
||||
OperationID: titleCaser.String(childResourceType) + "s_List",
|
||||
Parameters: g.populateParameters(3, titleCaser.String(childResourceType), friendlyName),
|
||||
Responses: g.populateResponses(titleCaser.String(childResourceType)+"List", false, http.StatusOK),
|
||||
Pageable: &Pageable{
|
||||
NextLinkName: "nextLink",
|
||||
},
|
||||
},
|
||||
}
|
||||
ps["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/"+childResourceType+"/{childResourceName}"] = &PathItem{
|
||||
Get: &Operation{
|
||||
Tags: []string{titleCaser.String(childResourceType) + "s"},
|
||||
Summary: "Gets a " + friendlyName + " with the specified subscription, resource group and resource name.",
|
||||
Description: "The operation returns properties of a " + friendlyName + ".",
|
||||
OperationID: titleCaser.String(childResourceType) + "s_Get",
|
||||
Parameters: g.populateParameters(7, titleCaser.String(childResourceType), friendlyName),
|
||||
Responses: g.populateResponses(titleCaser.String(childResourceType), false, http.StatusOK),
|
||||
},
|
||||
Put: &Operation{
|
||||
Tags: []string{titleCaser.String(childResourceType) + "s"},
|
||||
Summary: "Creates or updates a " + friendlyName + " with the specified subscription, resource group and resource name.",
|
||||
Description: "The operation returns properties of a " + friendlyName + ".",
|
||||
OperationID: titleCaser.String(childResourceType) + "s_CreateOrUpdate",
|
||||
Parameters: g.populateParameters(8, titleCaser.String(childResourceType), friendlyName),
|
||||
Responses: g.populateResponses(titleCaser.String(childResourceType), false, http.StatusOK, http.StatusCreated),
|
||||
},
|
||||
Delete: &Operation{
|
||||
Tags: []string{titleCaser.String(childResourceType) + "s"},
|
||||
Summary: "Deletes a " + friendlyName + " with the specified subscription, resource group and resource name.",
|
||||
Description: "The operation returns nothing.",
|
||||
OperationID: titleCaser.String(childResourceType) + "s_Delete",
|
||||
Parameters: g.populateParameters(7, titleCaser.String(childResourceType), friendlyName),
|
||||
Responses: g.populateResponses(titleCaser.String(childResourceType), true, http.StatusOK, http.StatusNoContent),
|
||||
},
|
||||
Patch: &Operation{
|
||||
Tags: []string{titleCaser.String(childResourceType) + "s"},
|
||||
Summary: "Patches (create or update) a " + friendlyName + " with the specified subscription, resource group and resource name.",
|
||||
Description: "The operation returns properties of a " + friendlyName + ".",
|
||||
OperationID: titleCaser.String(childResourceType) + "s_Update",
|
||||
Parameters: g.populateParameters(9, titleCaser.String(childResourceType), friendlyName),
|
||||
Responses: g.populateResponses(titleCaser.String(childResourceType), false, http.StatusOK, http.StatusCreated),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// populateTopLevelPaths populates the paths for a top level ARM resource
|
||||
func (g *generator) populateTopLevelPaths(resourceProviderNamespace, resourceType, friendlyName string) (ps Paths) {
|
||||
titleCaser := cases.Title(language.Und, cases.NoLower)
|
||||
|
@ -185,7 +260,6 @@ func populateExamples(ps Paths) {
|
|||
if op == nil {
|
||||
continue
|
||||
}
|
||||
|
||||
op.Examples = map[string]Reference{
|
||||
op.Summary: {
|
||||
Ref: "./examples/" + op.OperationID + ".json",
|
||||
|
|
|
@ -12,8 +12,18 @@ import (
|
|||
"github.com/Azure/ARO-RP/pkg/util/stringutils"
|
||||
)
|
||||
|
||||
// resourceName represents the tracked resource, OpenShiftCluster
|
||||
var resourceName = "OpenShiftCluster"
|
||||
|
||||
// proxyResources represent the list of proxy resources - these are resources with operations, but do not exist in the Azure Portal
|
||||
// https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/proxy-api-reference.md
|
||||
var proxyResources = []string{
|
||||
"SyncSet",
|
||||
"SyncIdentityProvider",
|
||||
"MachinePool",
|
||||
"Secret",
|
||||
}
|
||||
|
||||
func Run(api, outputDir string) error {
|
||||
g, err := New(api)
|
||||
if err != nil {
|
||||
|
@ -51,6 +61,20 @@ func Run(api, outputDir string) error {
|
|||
},
|
||||
}
|
||||
|
||||
s.Paths["/providers/Microsoft.RedHatOpenShift/operations"] = &PathItem{
|
||||
Get: &Operation{
|
||||
Tags: []string{"Operations"},
|
||||
Summary: "Lists all of the available RP operations.",
|
||||
Description: "The operation returns the RP operations.",
|
||||
OperationID: "Operations_List",
|
||||
Parameters: g.populateParameters(0, "Operation", "Operation"),
|
||||
Responses: g.populateResponses("OperationList", false, http.StatusOK),
|
||||
Pageable: &Pageable{
|
||||
NextLinkName: "nextLink",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
s.Paths["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftClusters/{resourceName}/listCredentials"] = &PathItem{
|
||||
Post: &Operation{
|
||||
Tags: []string{"OpenShiftClusters"},
|
||||
|
@ -75,34 +99,28 @@ func Run(api, outputDir string) error {
|
|||
}
|
||||
}
|
||||
|
||||
s.Paths["/providers/Microsoft.RedHatOpenShift/operations"] = &PathItem{
|
||||
Get: &Operation{
|
||||
Tags: []string{"Operations"},
|
||||
Summary: "Lists all of the available RP operations.",
|
||||
Description: "The operation returns the RP operations.",
|
||||
OperationID: "Operations_List",
|
||||
Parameters: g.populateParameters(0, "Operation", "Operation"),
|
||||
Responses: g.populateResponses("OperationList", false, http.StatusOK),
|
||||
Pageable: &Pageable{
|
||||
NextLinkName: "nextLink",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
if g.installVersionList {
|
||||
s.Paths["/subscriptions/{subscriptionId}/providers/Microsoft.RedHatOpenShift/locations/{location}/listinstallversions"] = &PathItem{
|
||||
Get: &Operation{
|
||||
Tags: []string{"InstallVersions"},
|
||||
Summary: "Lists all OpenShift versions available to install in the specified location.",
|
||||
Description: "The operation returns the installable OpenShift versions as strings.",
|
||||
OperationID: "List_Install_Versions",
|
||||
OperationID: "InstallVersions_List",
|
||||
Parameters: g.populateParameters(6, "InstallVersions", "Install Versions"),
|
||||
Responses: g.populateResponses("InstallVersions", false, http.StatusOK),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
if g.clusterManager {
|
||||
g.populateChildResourcePaths(s.Paths, "Microsoft.RedHatOpenShift", "openShiftCluster", "syncSet", "SyncSet")
|
||||
g.populateChildResourcePaths(s.Paths, "Microsoft.RedHatOpenShift", "openShiftCluster", "machinePool", "MachinePool")
|
||||
g.populateChildResourcePaths(s.Paths, "Microsoft.RedHatOpenShift", "openShiftCluster", "syncIdentityProvider", "SyncIdentityProvider")
|
||||
g.populateChildResourcePaths(s.Paths, "Microsoft.RedHatOpenShift", "openShiftCluster", "secret", "Secret")
|
||||
}
|
||||
populateExamples(s.Paths)
|
||||
|
||||
// This begins to define definitions required for the paths, parameters, and responses defined above
|
||||
names := []string{"OpenShiftClusterList", "OpenShiftClusterCredentials"}
|
||||
if g.kubeConfig {
|
||||
names = append(names, "OpenShiftClusterAdminKubeconfig")
|
||||
|
@ -112,6 +130,12 @@ func Run(api, outputDir string) error {
|
|||
names = append(names, "InstallVersions")
|
||||
}
|
||||
|
||||
if g.clusterManager {
|
||||
// This needs to be the top level struct
|
||||
// in most cases, the "list" struct (a collection of resources)
|
||||
names = append(names, "SyncSetList", "MachinePoolList", "SyncIdentityProviderList", "SecretList")
|
||||
}
|
||||
|
||||
err = define(s.Definitions, api, g.xmsEnum, g.xmsSecretList, g.xmsIdentifiers, names...)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -123,7 +147,16 @@ func Run(api, outputDir string) error {
|
|||
return err
|
||||
}
|
||||
|
||||
for _, azureResource := range []string{resourceName} {
|
||||
// This begins the ARM / Azure Resources definition generation
|
||||
azureResources := []string{
|
||||
resourceName,
|
||||
}
|
||||
|
||||
if g.clusterManager {
|
||||
azureResources = append(azureResources, "SyncSet", "MachinePool", "SyncIdentityProvider", "Secret")
|
||||
}
|
||||
|
||||
for _, azureResource := range azureResources {
|
||||
def, err := deepCopy(s.Definitions[azureResource])
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -146,14 +179,22 @@ func Run(api, outputDir string) error {
|
|||
update.Properties = properties
|
||||
s.Definitions[azureResource+"Update"] = update
|
||||
|
||||
s.Definitions[azureResource].AllOf = []Schema{
|
||||
{
|
||||
Ref: "../../../../../common-types/resource-management/" + g.commonTypesVersion + "/types.json#/definitions/TrackedResource",
|
||||
},
|
||||
// If this resource is not a proxy resource mark as tracked resource
|
||||
// otherwise, its a proxy resource and we remove the proxyResource .Allof ref for the Update definition
|
||||
// in order to make azure-rest-specs-api validation happy
|
||||
if !contains(proxyResources, azureResource) {
|
||||
s.Definitions[azureResource].AllOf = []Schema{
|
||||
{
|
||||
Ref: "../../../../../common-types/resource-management/" + g.commonTypesVersion + "/types.json#/definitions/TrackedResource",
|
||||
},
|
||||
}
|
||||
} else {
|
||||
if def, ok := s.Definitions[azureResource+"Update"]; ok {
|
||||
def.AllOf = []Schema{}
|
||||
}
|
||||
}
|
||||
|
||||
properties = nil
|
||||
|
||||
for _, property := range s.Definitions[azureResource].Properties {
|
||||
if property.Name == "properties" {
|
||||
property.Schema.ClientFlatten = true
|
||||
|
@ -231,3 +272,15 @@ func removeNamedSchemas(list NameSchemas, remove string) NameSchemas {
|
|||
|
||||
return result
|
||||
}
|
||||
|
||||
// TODO: once we upgrade to go 1.18 we can use the slices.Contains function
|
||||
// until then, heres this helper func to check if the slice exists after we put it in a map
|
||||
func contains(slice []string, item string) bool {
|
||||
set := make(map[string]struct{}, len(slice))
|
||||
for _, s := range slice {
|
||||
set[s] = struct{}{}
|
||||
}
|
||||
|
||||
_, ok := set[item]
|
||||
return ok
|
||||
}
|
||||
|
|
|
@ -154,12 +154,17 @@ func (tw *typeWalker) schemaFromType(t types.Type, deps map[*types.Named]struct{
|
|||
}
|
||||
s.Properties = append(s.Properties, ns)
|
||||
}
|
||||
if field.Name() == "proxyResource" {
|
||||
s.AllOf = []Schema{
|
||||
{
|
||||
Ref: "../../../../../common-types/resource-management/v3/types.json#/definitions/ProxyResource",
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
default:
|
||||
panic(t)
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -173,7 +178,6 @@ func (tw *typeWalker) _define(definitions Definitions, t *types.Named) {
|
|||
if path != nil {
|
||||
s.Description = strings.Trim(path[len(path)-2].(*ast.GenDecl).Doc.Text(), "\n")
|
||||
s.Enum = tw.enums[t]
|
||||
|
||||
// Enum extensions allows non-breaking api changes
|
||||
// https://github.com/Azure/autorest/tree/master/docs/extensions#x-ms-enum
|
||||
c := strings.Split(t.String(), ".")
|
||||
|
@ -200,7 +204,6 @@ func (tw *typeWalker) _define(definitions Definitions, t *types.Named) {
|
|||
// define adds a Definition for the named type
|
||||
func (tw *typeWalker) define(definitions Definitions, name string) {
|
||||
o := tw.pkg.Types.Scope().Lookup(name)
|
||||
|
||||
tw._define(definitions, o.(*types.TypeName).Type().(*types.Named))
|
||||
}
|
||||
|
||||
|
@ -214,6 +217,5 @@ func define(definitions Definitions, pkgname string, xmsEnumList, xmsSecretList
|
|||
for _, name := range names {
|
||||
th.define(definitions, name)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -0,0 +1,66 @@
|
|||
package arm
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"regexp"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the Apache License 2.0.
|
||||
|
||||
// ArmResource represents a resource and its child resources.
|
||||
// Typically we would use the autorest package for this, but
|
||||
// It does not have support for subresources
|
||||
type ArmResource struct {
|
||||
SubscriptionID string
|
||||
ResourceGroup string
|
||||
Provider string
|
||||
ResourceName string
|
||||
ResourceType string
|
||||
SubResource SubResource
|
||||
}
|
||||
|
||||
// SubResource represents an ARM Proxy Resource
|
||||
// ARM supports up to 3 levels of nested resources
|
||||
// https://eng.ms/docs/products/arm/api_contracts/guidelines/rpc#rpc030-avoid-excessive-resource-type-nesting
|
||||
type SubResource struct {
|
||||
ResourceName string
|
||||
ResourceType string
|
||||
SubResource *SubResource
|
||||
}
|
||||
|
||||
// ParentResourcetoString returns a string of the parent object in form of azureResourceID
|
||||
func (r ArmResource) ParentResource() string {
|
||||
return fmt.Sprintf("/subscriptions/%s/resourceGroups/%s/providers/%s/%s/%s", r.SubscriptionID, r.ResourceGroup, r.Provider, r.ResourceType, r.ResourceName)
|
||||
}
|
||||
|
||||
// String function returns a string in form of azureResourceID
|
||||
func (r ArmResource) String() string {
|
||||
return fmt.Sprintf("/subscriptions/%s/resourceGroups/%s/providers/%s/%s/%s/%s/%s", r.SubscriptionID, r.ResourceGroup, r.Provider, r.ResourceType, r.ResourceName, r.SubResource.ResourceType, r.SubResource.ResourceName)
|
||||
}
|
||||
|
||||
// ParseArmResourceId take the resourceID of a child resource to an OpenShiftCluster
|
||||
// TODO refactor this function to support an additional layer of child resources if we ever get to that point, right now only supports 1 child resource
|
||||
func ParseArmResourceId(resourceId string) (*ArmResource, error) {
|
||||
const resourceIDPatternText = `(?i)subscriptions/(.+)/resourceGroups/(.+)/providers/(.+?)/(.+?)/(.+?)/(.+?)/(.+)`
|
||||
resourceIDPattern := regexp.MustCompile(resourceIDPatternText)
|
||||
match := resourceIDPattern.FindStringSubmatch(resourceId)
|
||||
|
||||
if len(match) != 8 || strings.Contains(match[7], "/") {
|
||||
return nil, fmt.Errorf("parsing failed for %s. Invalid resource Id format", resourceId)
|
||||
}
|
||||
|
||||
result := &ArmResource{
|
||||
SubscriptionID: match[1],
|
||||
ResourceGroup: match[2],
|
||||
Provider: match[3],
|
||||
ResourceType: match[4],
|
||||
ResourceName: match[5],
|
||||
SubResource: SubResource{
|
||||
ResourceType: match[6],
|
||||
ResourceName: match[7],
|
||||
},
|
||||
}
|
||||
return result, nil
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
package arm
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
"testing"
|
||||
)
|
||||
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the Apache License 2.0.
|
||||
|
||||
func TestArmResources(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
input string
|
||||
want *ArmResource
|
||||
err string
|
||||
}{
|
||||
{
|
||||
name: "happy path split",
|
||||
input: "/subscriptions/abc/resourcegroups/v4-eastus/providers/Microsoft.RedHatOpenShift/openshiftclusters/cluster1/syncSets/syncSet1",
|
||||
want: &ArmResource{
|
||||
SubscriptionID: "abc",
|
||||
ResourceGroup: "v4-eastus",
|
||||
Provider: "Microsoft.RedHatOpenShift",
|
||||
ResourceName: "cluster1",
|
||||
ResourceType: "openshiftclusters",
|
||||
SubResource: SubResource{
|
||||
ResourceName: "syncSet1",
|
||||
ResourceType: "syncSets",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "sad path - bad input - missing subresources",
|
||||
input: "/subscriptions/abc/resourcegroups/v4-eastus/providers/Microsoft.RedHatOpenShift/openshiftclusters/cluster1",
|
||||
err: "parsing failed for /subscriptions/abc/resourcegroups/v4-eastus/providers/Microsoft.RedHatOpenShift/openshiftclusters/cluster1. Invalid resource Id format",
|
||||
},
|
||||
{
|
||||
name: "sad path - bad input - missing cluster resource",
|
||||
input: "/subscriptions/abc/resourcegroups/v4-eastus/providers",
|
||||
err: "parsing failed for /subscriptions/abc/resourcegroups/v4-eastus/providers. Invalid resource Id format",
|
||||
},
|
||||
{
|
||||
name: "sad path - bad input - too many nested resource",
|
||||
input: "/subscriptions/abc/resourcegroups/v4-eastus/providers/Microsoft.RedHatOpenShift/openshiftclusters/cluster1/syncSets/syncset1/nextResource",
|
||||
err: "parsing failed for /subscriptions/abc/resourcegroups/v4-eastus/providers/Microsoft.RedHatOpenShift/openshiftclusters/cluster1/syncSets/syncset1/nextResource. Invalid resource Id format",
|
||||
},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
actual, err := ParseArmResourceId(test.input)
|
||||
if err != nil {
|
||||
if test.err != err.Error() {
|
||||
t.Fatalf("want %v, got %v", test.err, err)
|
||||
}
|
||||
}
|
||||
if !reflect.DeepEqual(actual, test.want) {
|
||||
t.Fatalf("want %v, got %v", test.want, actual)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -36,7 +36,7 @@ func (c *openShiftClustersClient) DeleteAndWait(ctx context.Context, resourceGro
|
|||
}
|
||||
|
||||
func (c *openShiftClustersClient) List(ctx context.Context) (clusters []mgmtredhatopenshift20220904.OpenShiftCluster, err error) {
|
||||
page, err := c.OpenShiftClustersClient.ListMethod(ctx)
|
||||
page, err := c.OpenShiftClustersClient.List(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
@ -224,7 +224,7 @@ def aro_list_admin_credentials(cmd, client, resource_group_name, resource_name,
|
|||
|
||||
|
||||
def aro_get_versions(client, location):
|
||||
return client.list.install_versions(location)
|
||||
return client.install_versions.list(location)
|
||||
|
||||
|
||||
def aro_update(cmd,
|
||||
|
|
|
@ -23,7 +23,7 @@ from azure.mgmt.core import ARMPipelineClient
|
|||
|
||||
from . import models
|
||||
from ._configuration import AzureRedHatOpenShiftClientConfiguration
|
||||
from .operations import ListOperations, OpenShiftClustersOperations, Operations
|
||||
from .operations import InstallVersionsOperations, MachinePoolsOperations, OpenShiftClustersOperations, Operations, SecretsOperations, SyncIdentityProvidersOperations, SyncSetsOperations
|
||||
|
||||
if TYPE_CHECKING:
|
||||
# pylint: disable=unused-import,ungrouped-imports
|
||||
|
@ -32,16 +32,27 @@ if TYPE_CHECKING:
|
|||
from azure.core.credentials import TokenCredential
|
||||
from azure.core.rest import HttpRequest, HttpResponse
|
||||
|
||||
class AzureRedHatOpenShiftClient(object):
|
||||
class AzureRedHatOpenShiftClient(object): # pylint: disable=too-many-instance-attributes
|
||||
"""Rest API for Azure Red Hat OpenShift 4.
|
||||
|
||||
:ivar operations: Operations operations
|
||||
:vartype operations: azure.mgmt.redhatopenshift.v2022_09_04.operations.Operations
|
||||
:ivar list: ListOperations operations
|
||||
:vartype list: azure.mgmt.redhatopenshift.v2022_09_04.operations.ListOperations
|
||||
:ivar install_versions: InstallVersionsOperations operations
|
||||
:vartype install_versions:
|
||||
azure.mgmt.redhatopenshift.v2022_09_04.operations.InstallVersionsOperations
|
||||
:ivar open_shift_clusters: OpenShiftClustersOperations operations
|
||||
:vartype open_shift_clusters:
|
||||
azure.mgmt.redhatopenshift.v2022_09_04.operations.OpenShiftClustersOperations
|
||||
:ivar machine_pools: MachinePoolsOperations operations
|
||||
:vartype machine_pools:
|
||||
azure.mgmt.redhatopenshift.v2022_09_04.operations.MachinePoolsOperations
|
||||
:ivar secrets: SecretsOperations operations
|
||||
:vartype secrets: azure.mgmt.redhatopenshift.v2022_09_04.operations.SecretsOperations
|
||||
:ivar sync_identity_providers: SyncIdentityProvidersOperations operations
|
||||
:vartype sync_identity_providers:
|
||||
azure.mgmt.redhatopenshift.v2022_09_04.operations.SyncIdentityProvidersOperations
|
||||
:ivar sync_sets: SyncSetsOperations operations
|
||||
:vartype sync_sets: azure.mgmt.redhatopenshift.v2022_09_04.operations.SyncSetsOperations
|
||||
:param credential: Credential needed for the client to connect to Azure.
|
||||
:type credential: ~azure.core.credentials.TokenCredential
|
||||
:param subscription_id: The ID of the target subscription.
|
||||
|
@ -71,8 +82,12 @@ class AzureRedHatOpenShiftClient(object):
|
|||
self._deserialize = Deserializer(client_models)
|
||||
self._serialize.client_side_validation = False
|
||||
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
|
||||
self.list = ListOperations(self._client, self._config, self._serialize, self._deserialize)
|
||||
self.install_versions = InstallVersionsOperations(self._client, self._config, self._serialize, self._deserialize)
|
||||
self.open_shift_clusters = OpenShiftClustersOperations(self._client, self._config, self._serialize, self._deserialize)
|
||||
self.machine_pools = MachinePoolsOperations(self._client, self._config, self._serialize, self._deserialize)
|
||||
self.secrets = SecretsOperations(self._client, self._config, self._serialize, self._deserialize)
|
||||
self.sync_identity_providers = SyncIdentityProvidersOperations(self._client, self._config, self._serialize, self._deserialize)
|
||||
self.sync_sets = SyncSetsOperations(self._client, self._config, self._serialize, self._deserialize)
|
||||
|
||||
|
||||
def _send_request(
|
||||
|
|
|
@ -21,6 +21,9 @@ try:
|
|||
from ._models_py3 import ConsoleProfile
|
||||
from ._models_py3 import Display
|
||||
from ._models_py3 import IngressProfile
|
||||
from ._models_py3 import MachinePool
|
||||
from ._models_py3 import MachinePoolList
|
||||
from ._models_py3 import MachinePoolUpdate
|
||||
from ._models_py3 import MasterProfile
|
||||
from ._models_py3 import NetworkProfile
|
||||
from ._models_py3 import OpenShiftCluster
|
||||
|
@ -30,8 +33,18 @@ try:
|
|||
from ._models_py3 import OpenShiftClusterUpdate
|
||||
from ._models_py3 import Operation
|
||||
from ._models_py3 import OperationList
|
||||
from ._models_py3 import ProxyResource
|
||||
from ._models_py3 import Resource
|
||||
from ._models_py3 import Secret
|
||||
from ._models_py3 import SecretList
|
||||
from ._models_py3 import SecretUpdate
|
||||
from ._models_py3 import ServicePrincipalProfile
|
||||
from ._models_py3 import SyncIdentityProvider
|
||||
from ._models_py3 import SyncIdentityProviderList
|
||||
from ._models_py3 import SyncIdentityProviderUpdate
|
||||
from ._models_py3 import SyncSet
|
||||
from ._models_py3 import SyncSetList
|
||||
from ._models_py3 import SyncSetUpdate
|
||||
from ._models_py3 import SystemData
|
||||
from ._models_py3 import TrackedResource
|
||||
from ._models_py3 import WorkerProfile
|
||||
|
@ -42,6 +55,9 @@ except (SyntaxError, ImportError):
|
|||
from ._models import ConsoleProfile # type: ignore
|
||||
from ._models import Display # type: ignore
|
||||
from ._models import IngressProfile # type: ignore
|
||||
from ._models import MachinePool # type: ignore
|
||||
from ._models import MachinePoolList # type: ignore
|
||||
from ._models import MachinePoolUpdate # type: ignore
|
||||
from ._models import MasterProfile # type: ignore
|
||||
from ._models import NetworkProfile # type: ignore
|
||||
from ._models import OpenShiftCluster # type: ignore
|
||||
|
@ -51,8 +67,18 @@ except (SyntaxError, ImportError):
|
|||
from ._models import OpenShiftClusterUpdate # type: ignore
|
||||
from ._models import Operation # type: ignore
|
||||
from ._models import OperationList # type: ignore
|
||||
from ._models import ProxyResource # type: ignore
|
||||
from ._models import Resource # type: ignore
|
||||
from ._models import Secret # type: ignore
|
||||
from ._models import SecretList # type: ignore
|
||||
from ._models import SecretUpdate # type: ignore
|
||||
from ._models import ServicePrincipalProfile # type: ignore
|
||||
from ._models import SyncIdentityProvider # type: ignore
|
||||
from ._models import SyncIdentityProviderList # type: ignore
|
||||
from ._models import SyncIdentityProviderUpdate # type: ignore
|
||||
from ._models import SyncSet # type: ignore
|
||||
from ._models import SyncSetList # type: ignore
|
||||
from ._models import SyncSetUpdate # type: ignore
|
||||
from ._models import SystemData # type: ignore
|
||||
from ._models import TrackedResource # type: ignore
|
||||
from ._models import WorkerProfile # type: ignore
|
||||
|
@ -72,6 +98,9 @@ __all__ = [
|
|||
'ConsoleProfile',
|
||||
'Display',
|
||||
'IngressProfile',
|
||||
'MachinePool',
|
||||
'MachinePoolList',
|
||||
'MachinePoolUpdate',
|
||||
'MasterProfile',
|
||||
'NetworkProfile',
|
||||
'OpenShiftCluster',
|
||||
|
@ -81,8 +110,18 @@ __all__ = [
|
|||
'OpenShiftClusterUpdate',
|
||||
'Operation',
|
||||
'OperationList',
|
||||
'ProxyResource',
|
||||
'Resource',
|
||||
'Secret',
|
||||
'SecretList',
|
||||
'SecretUpdate',
|
||||
'ServicePrincipalProfile',
|
||||
'SyncIdentityProvider',
|
||||
'SyncIdentityProviderList',
|
||||
'SyncIdentityProviderUpdate',
|
||||
'SyncSet',
|
||||
'SyncSetList',
|
||||
'SyncSetUpdate',
|
||||
'SystemData',
|
||||
'TrackedResource',
|
||||
'WorkerProfile',
|
||||
|
|
|
@ -249,6 +249,201 @@ class IngressProfile(msrest.serialization.Model):
|
|||
self.ip = kwargs.get('ip', None)
|
||||
|
||||
|
||||
class Resource(msrest.serialization.Model):
|
||||
"""Common fields that are returned in the response for all Azure Resource Manager resources.
|
||||
|
||||
Variables are only populated by the server, and will be ignored when sending a request.
|
||||
|
||||
:ivar id: Fully qualified resource ID for the resource. Ex -
|
||||
/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
|
||||
:vartype id: str
|
||||
:ivar name: The name of the resource.
|
||||
:vartype name: str
|
||||
:ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or
|
||||
"Microsoft.Storage/storageAccounts".
|
||||
:vartype type: str
|
||||
:ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy
|
||||
information.
|
||||
:vartype system_data: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SystemData
|
||||
"""
|
||||
|
||||
_validation = {
|
||||
'id': {'readonly': True},
|
||||
'name': {'readonly': True},
|
||||
'type': {'readonly': True},
|
||||
'system_data': {'readonly': True},
|
||||
}
|
||||
|
||||
_attribute_map = {
|
||||
'id': {'key': 'id', 'type': 'str'},
|
||||
'name': {'key': 'name', 'type': 'str'},
|
||||
'type': {'key': 'type', 'type': 'str'},
|
||||
'system_data': {'key': 'systemData', 'type': 'SystemData'},
|
||||
}
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
**kwargs
|
||||
):
|
||||
"""
|
||||
"""
|
||||
super(Resource, self).__init__(**kwargs)
|
||||
self.id = None
|
||||
self.name = None
|
||||
self.type = None
|
||||
self.system_data = None
|
||||
|
||||
|
||||
class ProxyResource(Resource):
|
||||
"""The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location.
|
||||
|
||||
Variables are only populated by the server, and will be ignored when sending a request.
|
||||
|
||||
:ivar id: Fully qualified resource ID for the resource. Ex -
|
||||
/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
|
||||
:vartype id: str
|
||||
:ivar name: The name of the resource.
|
||||
:vartype name: str
|
||||
:ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or
|
||||
"Microsoft.Storage/storageAccounts".
|
||||
:vartype type: str
|
||||
:ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy
|
||||
information.
|
||||
:vartype system_data: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SystemData
|
||||
"""
|
||||
|
||||
_validation = {
|
||||
'id': {'readonly': True},
|
||||
'name': {'readonly': True},
|
||||
'type': {'readonly': True},
|
||||
'system_data': {'readonly': True},
|
||||
}
|
||||
|
||||
_attribute_map = {
|
||||
'id': {'key': 'id', 'type': 'str'},
|
||||
'name': {'key': 'name', 'type': 'str'},
|
||||
'type': {'key': 'type', 'type': 'str'},
|
||||
'system_data': {'key': 'systemData', 'type': 'SystemData'},
|
||||
}
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
**kwargs
|
||||
):
|
||||
"""
|
||||
"""
|
||||
super(ProxyResource, self).__init__(**kwargs)
|
||||
|
||||
|
||||
class MachinePool(ProxyResource):
|
||||
"""MachinePool represents a MachinePool.
|
||||
|
||||
Variables are only populated by the server, and will be ignored when sending a request.
|
||||
|
||||
:ivar id: Fully qualified resource ID for the resource. Ex -
|
||||
/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
|
||||
:vartype id: str
|
||||
:ivar name: The name of the resource.
|
||||
:vartype name: str
|
||||
:ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or
|
||||
"Microsoft.Storage/storageAccounts".
|
||||
:vartype type: str
|
||||
:ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy
|
||||
information.
|
||||
:vartype system_data: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SystemData
|
||||
:ivar resources:
|
||||
:vartype resources: str
|
||||
"""
|
||||
|
||||
_validation = {
|
||||
'id': {'readonly': True},
|
||||
'name': {'readonly': True},
|
||||
'type': {'readonly': True},
|
||||
'system_data': {'readonly': True},
|
||||
}
|
||||
|
||||
_attribute_map = {
|
||||
'id': {'key': 'id', 'type': 'str'},
|
||||
'name': {'key': 'name', 'type': 'str'},
|
||||
'type': {'key': 'type', 'type': 'str'},
|
||||
'system_data': {'key': 'systemData', 'type': 'SystemData'},
|
||||
'resources': {'key': 'properties.resources', 'type': 'str'},
|
||||
}
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
**kwargs
|
||||
):
|
||||
"""
|
||||
:keyword resources:
|
||||
:paramtype resources: str
|
||||
"""
|
||||
super(MachinePool, self).__init__(**kwargs)
|
||||
self.resources = kwargs.get('resources', None)
|
||||
|
||||
|
||||
class MachinePoolList(msrest.serialization.Model):
|
||||
"""MachinePoolList represents a list of MachinePools.
|
||||
|
||||
:ivar value: The list of Machine Pools.
|
||||
:vartype value: list[~azure.mgmt.redhatopenshift.v2022_09_04.models.MachinePool]
|
||||
:ivar next_link: The link used to get the next page of operations.
|
||||
:vartype next_link: str
|
||||
"""
|
||||
|
||||
_attribute_map = {
|
||||
'value': {'key': 'value', 'type': '[MachinePool]'},
|
||||
'next_link': {'key': 'nextLink', 'type': 'str'},
|
||||
}
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
**kwargs
|
||||
):
|
||||
"""
|
||||
:keyword value: The list of Machine Pools.
|
||||
:paramtype value: list[~azure.mgmt.redhatopenshift.v2022_09_04.models.MachinePool]
|
||||
:keyword next_link: The link used to get the next page of operations.
|
||||
:paramtype next_link: str
|
||||
"""
|
||||
super(MachinePoolList, self).__init__(**kwargs)
|
||||
self.value = kwargs.get('value', None)
|
||||
self.next_link = kwargs.get('next_link', None)
|
||||
|
||||
|
||||
class MachinePoolUpdate(msrest.serialization.Model):
|
||||
"""MachinePool represents a MachinePool.
|
||||
|
||||
Variables are only populated by the server, and will be ignored when sending a request.
|
||||
|
||||
:ivar system_data: The system meta data relating to this resource.
|
||||
:vartype system_data: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SystemData
|
||||
:ivar resources:
|
||||
:vartype resources: str
|
||||
"""
|
||||
|
||||
_validation = {
|
||||
'system_data': {'readonly': True},
|
||||
}
|
||||
|
||||
_attribute_map = {
|
||||
'system_data': {'key': 'systemData', 'type': 'SystemData'},
|
||||
'resources': {'key': 'properties.resources', 'type': 'str'},
|
||||
}
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
**kwargs
|
||||
):
|
||||
"""
|
||||
:keyword resources:
|
||||
:paramtype resources: str
|
||||
"""
|
||||
super(MachinePoolUpdate, self).__init__(**kwargs)
|
||||
self.system_data = None
|
||||
self.resources = kwargs.get('resources', None)
|
||||
|
||||
|
||||
class MasterProfile(msrest.serialization.Model):
|
||||
"""MasterProfile represents a master profile.
|
||||
|
||||
|
@ -325,51 +520,6 @@ class NetworkProfile(msrest.serialization.Model):
|
|||
self.service_cidr = kwargs.get('service_cidr', None)
|
||||
|
||||
|
||||
class Resource(msrest.serialization.Model):
|
||||
"""Common fields that are returned in the response for all Azure Resource Manager resources.
|
||||
|
||||
Variables are only populated by the server, and will be ignored when sending a request.
|
||||
|
||||
:ivar id: Fully qualified resource ID for the resource. Ex -
|
||||
/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
|
||||
:vartype id: str
|
||||
:ivar name: The name of the resource.
|
||||
:vartype name: str
|
||||
:ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or
|
||||
"Microsoft.Storage/storageAccounts".
|
||||
:vartype type: str
|
||||
:ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy
|
||||
information.
|
||||
:vartype system_data: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SystemData
|
||||
"""
|
||||
|
||||
_validation = {
|
||||
'id': {'readonly': True},
|
||||
'name': {'readonly': True},
|
||||
'type': {'readonly': True},
|
||||
'system_data': {'readonly': True},
|
||||
}
|
||||
|
||||
_attribute_map = {
|
||||
'id': {'key': 'id', 'type': 'str'},
|
||||
'name': {'key': 'name', 'type': 'str'},
|
||||
'type': {'key': 'type', 'type': 'str'},
|
||||
'system_data': {'key': 'systemData', 'type': 'SystemData'},
|
||||
}
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
**kwargs
|
||||
):
|
||||
"""
|
||||
"""
|
||||
super(Resource, self).__init__(**kwargs)
|
||||
self.id = None
|
||||
self.name = None
|
||||
self.type = None
|
||||
self.system_data = None
|
||||
|
||||
|
||||
class TrackedResource(Resource):
|
||||
"""The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'.
|
||||
|
||||
|
@ -794,6 +944,115 @@ class OperationList(msrest.serialization.Model):
|
|||
self.next_link = kwargs.get('next_link', None)
|
||||
|
||||
|
||||
class Secret(ProxyResource):
|
||||
"""Secret represents a secret.
|
||||
|
||||
Variables are only populated by the server, and will be ignored when sending a request.
|
||||
|
||||
:ivar id: Fully qualified resource ID for the resource. Ex -
|
||||
/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
|
||||
:vartype id: str
|
||||
:ivar name: The name of the resource.
|
||||
:vartype name: str
|
||||
:ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or
|
||||
"Microsoft.Storage/storageAccounts".
|
||||
:vartype type: str
|
||||
:ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy
|
||||
information.
|
||||
:vartype system_data: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SystemData
|
||||
:ivar secret_resources: The Secrets Resources.
|
||||
:vartype secret_resources: str
|
||||
"""
|
||||
|
||||
_validation = {
|
||||
'id': {'readonly': True},
|
||||
'name': {'readonly': True},
|
||||
'type': {'readonly': True},
|
||||
'system_data': {'readonly': True},
|
||||
}
|
||||
|
||||
_attribute_map = {
|
||||
'id': {'key': 'id', 'type': 'str'},
|
||||
'name': {'key': 'name', 'type': 'str'},
|
||||
'type': {'key': 'type', 'type': 'str'},
|
||||
'system_data': {'key': 'systemData', 'type': 'SystemData'},
|
||||
'secret_resources': {'key': 'properties.secretResources', 'type': 'str'},
|
||||
}
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
**kwargs
|
||||
):
|
||||
"""
|
||||
:keyword secret_resources: The Secrets Resources.
|
||||
:paramtype secret_resources: str
|
||||
"""
|
||||
super(Secret, self).__init__(**kwargs)
|
||||
self.secret_resources = kwargs.get('secret_resources', None)
|
||||
|
||||
|
||||
class SecretList(msrest.serialization.Model):
|
||||
"""SecretList represents a list of Secrets.
|
||||
|
||||
:ivar value: The list of secrets.
|
||||
:vartype value: list[~azure.mgmt.redhatopenshift.v2022_09_04.models.Secret]
|
||||
:ivar next_link: The link used to get the next page of operations.
|
||||
:vartype next_link: str
|
||||
"""
|
||||
|
||||
_attribute_map = {
|
||||
'value': {'key': 'value', 'type': '[Secret]'},
|
||||
'next_link': {'key': 'nextLink', 'type': 'str'},
|
||||
}
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
**kwargs
|
||||
):
|
||||
"""
|
||||
:keyword value: The list of secrets.
|
||||
:paramtype value: list[~azure.mgmt.redhatopenshift.v2022_09_04.models.Secret]
|
||||
:keyword next_link: The link used to get the next page of operations.
|
||||
:paramtype next_link: str
|
||||
"""
|
||||
super(SecretList, self).__init__(**kwargs)
|
||||
self.value = kwargs.get('value', None)
|
||||
self.next_link = kwargs.get('next_link', None)
|
||||
|
||||
|
||||
class SecretUpdate(msrest.serialization.Model):
|
||||
"""Secret represents a secret.
|
||||
|
||||
Variables are only populated by the server, and will be ignored when sending a request.
|
||||
|
||||
:ivar system_data: The system meta data relating to this resource.
|
||||
:vartype system_data: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SystemData
|
||||
:ivar secret_resources: The Secrets Resources.
|
||||
:vartype secret_resources: str
|
||||
"""
|
||||
|
||||
_validation = {
|
||||
'system_data': {'readonly': True},
|
||||
}
|
||||
|
||||
_attribute_map = {
|
||||
'system_data': {'key': 'systemData', 'type': 'SystemData'},
|
||||
'secret_resources': {'key': 'properties.secretResources', 'type': 'str'},
|
||||
}
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
**kwargs
|
||||
):
|
||||
"""
|
||||
:keyword secret_resources: The Secrets Resources.
|
||||
:paramtype secret_resources: str
|
||||
"""
|
||||
super(SecretUpdate, self).__init__(**kwargs)
|
||||
self.system_data = None
|
||||
self.secret_resources = kwargs.get('secret_resources', None)
|
||||
|
||||
|
||||
class ServicePrincipalProfile(msrest.serialization.Model):
|
||||
"""ServicePrincipalProfile represents a service principal profile.
|
||||
|
||||
|
@ -823,6 +1082,224 @@ class ServicePrincipalProfile(msrest.serialization.Model):
|
|||
self.client_secret = kwargs.get('client_secret', None)
|
||||
|
||||
|
||||
class SyncIdentityProvider(ProxyResource):
|
||||
"""SyncIdentityProvider represents a SyncIdentityProvider.
|
||||
|
||||
Variables are only populated by the server, and will be ignored when sending a request.
|
||||
|
||||
:ivar id: Fully qualified resource ID for the resource. Ex -
|
||||
/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
|
||||
:vartype id: str
|
||||
:ivar name: The name of the resource.
|
||||
:vartype name: str
|
||||
:ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or
|
||||
"Microsoft.Storage/storageAccounts".
|
||||
:vartype type: str
|
||||
:ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy
|
||||
information.
|
||||
:vartype system_data: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SystemData
|
||||
:ivar resources:
|
||||
:vartype resources: str
|
||||
"""
|
||||
|
||||
_validation = {
|
||||
'id': {'readonly': True},
|
||||
'name': {'readonly': True},
|
||||
'type': {'readonly': True},
|
||||
'system_data': {'readonly': True},
|
||||
}
|
||||
|
||||
_attribute_map = {
|
||||
'id': {'key': 'id', 'type': 'str'},
|
||||
'name': {'key': 'name', 'type': 'str'},
|
||||
'type': {'key': 'type', 'type': 'str'},
|
||||
'system_data': {'key': 'systemData', 'type': 'SystemData'},
|
||||
'resources': {'key': 'properties.resources', 'type': 'str'},
|
||||
}
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
**kwargs
|
||||
):
|
||||
"""
|
||||
:keyword resources:
|
||||
:paramtype resources: str
|
||||
"""
|
||||
super(SyncIdentityProvider, self).__init__(**kwargs)
|
||||
self.resources = kwargs.get('resources', None)
|
||||
|
||||
|
||||
class SyncIdentityProviderList(msrest.serialization.Model):
|
||||
"""SyncSetList represents a list of SyncSets.
|
||||
|
||||
:ivar value: The list of sync identity providers.
|
||||
:vartype value: list[~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncIdentityProvider]
|
||||
:ivar next_link: The link used to get the next page of operations.
|
||||
:vartype next_link: str
|
||||
"""
|
||||
|
||||
_attribute_map = {
|
||||
'value': {'key': 'value', 'type': '[SyncIdentityProvider]'},
|
||||
'next_link': {'key': 'nextLink', 'type': 'str'},
|
||||
}
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
**kwargs
|
||||
):
|
||||
"""
|
||||
:keyword value: The list of sync identity providers.
|
||||
:paramtype value: list[~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncIdentityProvider]
|
||||
:keyword next_link: The link used to get the next page of operations.
|
||||
:paramtype next_link: str
|
||||
"""
|
||||
super(SyncIdentityProviderList, self).__init__(**kwargs)
|
||||
self.value = kwargs.get('value', None)
|
||||
self.next_link = kwargs.get('next_link', None)
|
||||
|
||||
|
||||
class SyncIdentityProviderUpdate(msrest.serialization.Model):
|
||||
"""SyncIdentityProvider represents a SyncIdentityProvider.
|
||||
|
||||
Variables are only populated by the server, and will be ignored when sending a request.
|
||||
|
||||
:ivar system_data: The system meta data relating to this resource.
|
||||
:vartype system_data: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SystemData
|
||||
:ivar resources:
|
||||
:vartype resources: str
|
||||
"""
|
||||
|
||||
_validation = {
|
||||
'system_data': {'readonly': True},
|
||||
}
|
||||
|
||||
_attribute_map = {
|
||||
'system_data': {'key': 'systemData', 'type': 'SystemData'},
|
||||
'resources': {'key': 'properties.resources', 'type': 'str'},
|
||||
}
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
**kwargs
|
||||
):
|
||||
"""
|
||||
:keyword resources:
|
||||
:paramtype resources: str
|
||||
"""
|
||||
super(SyncIdentityProviderUpdate, self).__init__(**kwargs)
|
||||
self.system_data = None
|
||||
self.resources = kwargs.get('resources', None)
|
||||
|
||||
|
||||
class SyncSet(ProxyResource):
|
||||
"""SyncSet represents a SyncSet for an Azure Red Hat OpenShift Cluster.
|
||||
|
||||
Variables are only populated by the server, and will be ignored when sending a request.
|
||||
|
||||
:ivar id: Fully qualified resource ID for the resource. Ex -
|
||||
/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
|
||||
:vartype id: str
|
||||
:ivar name: The name of the resource.
|
||||
:vartype name: str
|
||||
:ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or
|
||||
"Microsoft.Storage/storageAccounts".
|
||||
:vartype type: str
|
||||
:ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy
|
||||
information.
|
||||
:vartype system_data: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SystemData
|
||||
:ivar resources: Resources represents the SyncSets configuration.
|
||||
:vartype resources: str
|
||||
"""
|
||||
|
||||
_validation = {
|
||||
'id': {'readonly': True},
|
||||
'name': {'readonly': True},
|
||||
'type': {'readonly': True},
|
||||
'system_data': {'readonly': True},
|
||||
}
|
||||
|
||||
_attribute_map = {
|
||||
'id': {'key': 'id', 'type': 'str'},
|
||||
'name': {'key': 'name', 'type': 'str'},
|
||||
'type': {'key': 'type', 'type': 'str'},
|
||||
'system_data': {'key': 'systemData', 'type': 'SystemData'},
|
||||
'resources': {'key': 'properties.resources', 'type': 'str'},
|
||||
}
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
**kwargs
|
||||
):
|
||||
"""
|
||||
:keyword resources: Resources represents the SyncSets configuration.
|
||||
:paramtype resources: str
|
||||
"""
|
||||
super(SyncSet, self).__init__(**kwargs)
|
||||
self.resources = kwargs.get('resources', None)
|
||||
|
||||
|
||||
class SyncSetList(msrest.serialization.Model):
|
||||
"""SyncSetList represents a list of SyncSets.
|
||||
|
||||
:ivar value: The list of syncsets.
|
||||
:vartype value: list[~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncSet]
|
||||
:ivar next_link: The link used to get the next page of operations.
|
||||
:vartype next_link: str
|
||||
"""
|
||||
|
||||
_attribute_map = {
|
||||
'value': {'key': 'value', 'type': '[SyncSet]'},
|
||||
'next_link': {'key': 'nextLink', 'type': 'str'},
|
||||
}
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
**kwargs
|
||||
):
|
||||
"""
|
||||
:keyword value: The list of syncsets.
|
||||
:paramtype value: list[~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncSet]
|
||||
:keyword next_link: The link used to get the next page of operations.
|
||||
:paramtype next_link: str
|
||||
"""
|
||||
super(SyncSetList, self).__init__(**kwargs)
|
||||
self.value = kwargs.get('value', None)
|
||||
self.next_link = kwargs.get('next_link', None)
|
||||
|
||||
|
||||
class SyncSetUpdate(msrest.serialization.Model):
|
||||
"""SyncSet represents a SyncSet for an Azure Red Hat OpenShift Cluster.
|
||||
|
||||
Variables are only populated by the server, and will be ignored when sending a request.
|
||||
|
||||
:ivar system_data: The system meta data relating to this resource.
|
||||
:vartype system_data: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SystemData
|
||||
:ivar resources: Resources represents the SyncSets configuration.
|
||||
:vartype resources: str
|
||||
"""
|
||||
|
||||
_validation = {
|
||||
'system_data': {'readonly': True},
|
||||
}
|
||||
|
||||
_attribute_map = {
|
||||
'system_data': {'key': 'systemData', 'type': 'SystemData'},
|
||||
'resources': {'key': 'properties.resources', 'type': 'str'},
|
||||
}
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
**kwargs
|
||||
):
|
||||
"""
|
||||
:keyword resources: Resources represents the SyncSets configuration.
|
||||
:paramtype resources: str
|
||||
"""
|
||||
super(SyncSetUpdate, self).__init__(**kwargs)
|
||||
self.system_data = None
|
||||
self.resources = kwargs.get('resources', None)
|
||||
|
||||
|
||||
class SystemData(msrest.serialization.Model):
|
||||
"""Metadata pertaining to creation and last modification of the resource.
|
||||
|
||||
|
|
|
@ -280,6 +280,208 @@ class IngressProfile(msrest.serialization.Model):
|
|||
self.ip = ip
|
||||
|
||||
|
||||
class Resource(msrest.serialization.Model):
|
||||
"""Common fields that are returned in the response for all Azure Resource Manager resources.
|
||||
|
||||
Variables are only populated by the server, and will be ignored when sending a request.
|
||||
|
||||
:ivar id: Fully qualified resource ID for the resource. Ex -
|
||||
/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
|
||||
:vartype id: str
|
||||
:ivar name: The name of the resource.
|
||||
:vartype name: str
|
||||
:ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or
|
||||
"Microsoft.Storage/storageAccounts".
|
||||
:vartype type: str
|
||||
:ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy
|
||||
information.
|
||||
:vartype system_data: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SystemData
|
||||
"""
|
||||
|
||||
_validation = {
|
||||
'id': {'readonly': True},
|
||||
'name': {'readonly': True},
|
||||
'type': {'readonly': True},
|
||||
'system_data': {'readonly': True},
|
||||
}
|
||||
|
||||
_attribute_map = {
|
||||
'id': {'key': 'id', 'type': 'str'},
|
||||
'name': {'key': 'name', 'type': 'str'},
|
||||
'type': {'key': 'type', 'type': 'str'},
|
||||
'system_data': {'key': 'systemData', 'type': 'SystemData'},
|
||||
}
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
**kwargs
|
||||
):
|
||||
"""
|
||||
"""
|
||||
super(Resource, self).__init__(**kwargs)
|
||||
self.id = None
|
||||
self.name = None
|
||||
self.type = None
|
||||
self.system_data = None
|
||||
|
||||
|
||||
class ProxyResource(Resource):
|
||||
"""The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location.
|
||||
|
||||
Variables are only populated by the server, and will be ignored when sending a request.
|
||||
|
||||
:ivar id: Fully qualified resource ID for the resource. Ex -
|
||||
/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
|
||||
:vartype id: str
|
||||
:ivar name: The name of the resource.
|
||||
:vartype name: str
|
||||
:ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or
|
||||
"Microsoft.Storage/storageAccounts".
|
||||
:vartype type: str
|
||||
:ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy
|
||||
information.
|
||||
:vartype system_data: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SystemData
|
||||
"""
|
||||
|
||||
_validation = {
|
||||
'id': {'readonly': True},
|
||||
'name': {'readonly': True},
|
||||
'type': {'readonly': True},
|
||||
'system_data': {'readonly': True},
|
||||
}
|
||||
|
||||
_attribute_map = {
|
||||
'id': {'key': 'id', 'type': 'str'},
|
||||
'name': {'key': 'name', 'type': 'str'},
|
||||
'type': {'key': 'type', 'type': 'str'},
|
||||
'system_data': {'key': 'systemData', 'type': 'SystemData'},
|
||||
}
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
**kwargs
|
||||
):
|
||||
"""
|
||||
"""
|
||||
super(ProxyResource, self).__init__(**kwargs)
|
||||
|
||||
|
||||
class MachinePool(ProxyResource):
|
||||
"""MachinePool represents a MachinePool.
|
||||
|
||||
Variables are only populated by the server, and will be ignored when sending a request.
|
||||
|
||||
:ivar id: Fully qualified resource ID for the resource. Ex -
|
||||
/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
|
||||
:vartype id: str
|
||||
:ivar name: The name of the resource.
|
||||
:vartype name: str
|
||||
:ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or
|
||||
"Microsoft.Storage/storageAccounts".
|
||||
:vartype type: str
|
||||
:ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy
|
||||
information.
|
||||
:vartype system_data: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SystemData
|
||||
:ivar resources:
|
||||
:vartype resources: str
|
||||
"""
|
||||
|
||||
_validation = {
|
||||
'id': {'readonly': True},
|
||||
'name': {'readonly': True},
|
||||
'type': {'readonly': True},
|
||||
'system_data': {'readonly': True},
|
||||
}
|
||||
|
||||
_attribute_map = {
|
||||
'id': {'key': 'id', 'type': 'str'},
|
||||
'name': {'key': 'name', 'type': 'str'},
|
||||
'type': {'key': 'type', 'type': 'str'},
|
||||
'system_data': {'key': 'systemData', 'type': 'SystemData'},
|
||||
'resources': {'key': 'properties.resources', 'type': 'str'},
|
||||
}
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
resources: Optional[str] = None,
|
||||
**kwargs
|
||||
):
|
||||
"""
|
||||
:keyword resources:
|
||||
:paramtype resources: str
|
||||
"""
|
||||
super(MachinePool, self).__init__(**kwargs)
|
||||
self.resources = resources
|
||||
|
||||
|
||||
class MachinePoolList(msrest.serialization.Model):
|
||||
"""MachinePoolList represents a list of MachinePools.
|
||||
|
||||
:ivar value: The list of Machine Pools.
|
||||
:vartype value: list[~azure.mgmt.redhatopenshift.v2022_09_04.models.MachinePool]
|
||||
:ivar next_link: The link used to get the next page of operations.
|
||||
:vartype next_link: str
|
||||
"""
|
||||
|
||||
_attribute_map = {
|
||||
'value': {'key': 'value', 'type': '[MachinePool]'},
|
||||
'next_link': {'key': 'nextLink', 'type': 'str'},
|
||||
}
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
value: Optional[List["MachinePool"]] = None,
|
||||
next_link: Optional[str] = None,
|
||||
**kwargs
|
||||
):
|
||||
"""
|
||||
:keyword value: The list of Machine Pools.
|
||||
:paramtype value: list[~azure.mgmt.redhatopenshift.v2022_09_04.models.MachinePool]
|
||||
:keyword next_link: The link used to get the next page of operations.
|
||||
:paramtype next_link: str
|
||||
"""
|
||||
super(MachinePoolList, self).__init__(**kwargs)
|
||||
self.value = value
|
||||
self.next_link = next_link
|
||||
|
||||
|
||||
class MachinePoolUpdate(msrest.serialization.Model):
|
||||
"""MachinePool represents a MachinePool.
|
||||
|
||||
Variables are only populated by the server, and will be ignored when sending a request.
|
||||
|
||||
:ivar system_data: The system meta data relating to this resource.
|
||||
:vartype system_data: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SystemData
|
||||
:ivar resources:
|
||||
:vartype resources: str
|
||||
"""
|
||||
|
||||
_validation = {
|
||||
'system_data': {'readonly': True},
|
||||
}
|
||||
|
||||
_attribute_map = {
|
||||
'system_data': {'key': 'systemData', 'type': 'SystemData'},
|
||||
'resources': {'key': 'properties.resources', 'type': 'str'},
|
||||
}
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
resources: Optional[str] = None,
|
||||
**kwargs
|
||||
):
|
||||
"""
|
||||
:keyword resources:
|
||||
:paramtype resources: str
|
||||
"""
|
||||
super(MachinePoolUpdate, self).__init__(**kwargs)
|
||||
self.system_data = None
|
||||
self.resources = resources
|
||||
|
||||
|
||||
class MasterProfile(msrest.serialization.Model):
|
||||
"""MasterProfile represents a master profile.
|
||||
|
||||
|
@ -364,51 +566,6 @@ class NetworkProfile(msrest.serialization.Model):
|
|||
self.service_cidr = service_cidr
|
||||
|
||||
|
||||
class Resource(msrest.serialization.Model):
|
||||
"""Common fields that are returned in the response for all Azure Resource Manager resources.
|
||||
|
||||
Variables are only populated by the server, and will be ignored when sending a request.
|
||||
|
||||
:ivar id: Fully qualified resource ID for the resource. Ex -
|
||||
/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
|
||||
:vartype id: str
|
||||
:ivar name: The name of the resource.
|
||||
:vartype name: str
|
||||
:ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or
|
||||
"Microsoft.Storage/storageAccounts".
|
||||
:vartype type: str
|
||||
:ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy
|
||||
information.
|
||||
:vartype system_data: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SystemData
|
||||
"""
|
||||
|
||||
_validation = {
|
||||
'id': {'readonly': True},
|
||||
'name': {'readonly': True},
|
||||
'type': {'readonly': True},
|
||||
'system_data': {'readonly': True},
|
||||
}
|
||||
|
||||
_attribute_map = {
|
||||
'id': {'key': 'id', 'type': 'str'},
|
||||
'name': {'key': 'name', 'type': 'str'},
|
||||
'type': {'key': 'type', 'type': 'str'},
|
||||
'system_data': {'key': 'systemData', 'type': 'SystemData'},
|
||||
}
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
**kwargs
|
||||
):
|
||||
"""
|
||||
"""
|
||||
super(Resource, self).__init__(**kwargs)
|
||||
self.id = None
|
||||
self.name = None
|
||||
self.type = None
|
||||
self.system_data = None
|
||||
|
||||
|
||||
class TrackedResource(Resource):
|
||||
"""The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'.
|
||||
|
||||
|
@ -876,6 +1033,122 @@ class OperationList(msrest.serialization.Model):
|
|||
self.next_link = next_link
|
||||
|
||||
|
||||
class Secret(ProxyResource):
|
||||
"""Secret represents a secret.
|
||||
|
||||
Variables are only populated by the server, and will be ignored when sending a request.
|
||||
|
||||
:ivar id: Fully qualified resource ID for the resource. Ex -
|
||||
/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
|
||||
:vartype id: str
|
||||
:ivar name: The name of the resource.
|
||||
:vartype name: str
|
||||
:ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or
|
||||
"Microsoft.Storage/storageAccounts".
|
||||
:vartype type: str
|
||||
:ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy
|
||||
information.
|
||||
:vartype system_data: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SystemData
|
||||
:ivar secret_resources: The Secrets Resources.
|
||||
:vartype secret_resources: str
|
||||
"""
|
||||
|
||||
_validation = {
|
||||
'id': {'readonly': True},
|
||||
'name': {'readonly': True},
|
||||
'type': {'readonly': True},
|
||||
'system_data': {'readonly': True},
|
||||
}
|
||||
|
||||
_attribute_map = {
|
||||
'id': {'key': 'id', 'type': 'str'},
|
||||
'name': {'key': 'name', 'type': 'str'},
|
||||
'type': {'key': 'type', 'type': 'str'},
|
||||
'system_data': {'key': 'systemData', 'type': 'SystemData'},
|
||||
'secret_resources': {'key': 'properties.secretResources', 'type': 'str'},
|
||||
}
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
secret_resources: Optional[str] = None,
|
||||
**kwargs
|
||||
):
|
||||
"""
|
||||
:keyword secret_resources: The Secrets Resources.
|
||||
:paramtype secret_resources: str
|
||||
"""
|
||||
super(Secret, self).__init__(**kwargs)
|
||||
self.secret_resources = secret_resources
|
||||
|
||||
|
||||
class SecretList(msrest.serialization.Model):
|
||||
"""SecretList represents a list of Secrets.
|
||||
|
||||
:ivar value: The list of secrets.
|
||||
:vartype value: list[~azure.mgmt.redhatopenshift.v2022_09_04.models.Secret]
|
||||
:ivar next_link: The link used to get the next page of operations.
|
||||
:vartype next_link: str
|
||||
"""
|
||||
|
||||
_attribute_map = {
|
||||
'value': {'key': 'value', 'type': '[Secret]'},
|
||||
'next_link': {'key': 'nextLink', 'type': 'str'},
|
||||
}
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
value: Optional[List["Secret"]] = None,
|
||||
next_link: Optional[str] = None,
|
||||
**kwargs
|
||||
):
|
||||
"""
|
||||
:keyword value: The list of secrets.
|
||||
:paramtype value: list[~azure.mgmt.redhatopenshift.v2022_09_04.models.Secret]
|
||||
:keyword next_link: The link used to get the next page of operations.
|
||||
:paramtype next_link: str
|
||||
"""
|
||||
super(SecretList, self).__init__(**kwargs)
|
||||
self.value = value
|
||||
self.next_link = next_link
|
||||
|
||||
|
||||
class SecretUpdate(msrest.serialization.Model):
|
||||
"""Secret represents a secret.
|
||||
|
||||
Variables are only populated by the server, and will be ignored when sending a request.
|
||||
|
||||
:ivar system_data: The system meta data relating to this resource.
|
||||
:vartype system_data: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SystemData
|
||||
:ivar secret_resources: The Secrets Resources.
|
||||
:vartype secret_resources: str
|
||||
"""
|
||||
|
||||
_validation = {
|
||||
'system_data': {'readonly': True},
|
||||
}
|
||||
|
||||
_attribute_map = {
|
||||
'system_data': {'key': 'systemData', 'type': 'SystemData'},
|
||||
'secret_resources': {'key': 'properties.secretResources', 'type': 'str'},
|
||||
}
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
secret_resources: Optional[str] = None,
|
||||
**kwargs
|
||||
):
|
||||
"""
|
||||
:keyword secret_resources: The Secrets Resources.
|
||||
:paramtype secret_resources: str
|
||||
"""
|
||||
super(SecretUpdate, self).__init__(**kwargs)
|
||||
self.system_data = None
|
||||
self.secret_resources = secret_resources
|
||||
|
||||
|
||||
class ServicePrincipalProfile(msrest.serialization.Model):
|
||||
"""ServicePrincipalProfile represents a service principal profile.
|
||||
|
||||
|
@ -908,6 +1181,238 @@ class ServicePrincipalProfile(msrest.serialization.Model):
|
|||
self.client_secret = client_secret
|
||||
|
||||
|
||||
class SyncIdentityProvider(ProxyResource):
|
||||
"""SyncIdentityProvider represents a SyncIdentityProvider.
|
||||
|
||||
Variables are only populated by the server, and will be ignored when sending a request.
|
||||
|
||||
:ivar id: Fully qualified resource ID for the resource. Ex -
|
||||
/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
|
||||
:vartype id: str
|
||||
:ivar name: The name of the resource.
|
||||
:vartype name: str
|
||||
:ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or
|
||||
"Microsoft.Storage/storageAccounts".
|
||||
:vartype type: str
|
||||
:ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy
|
||||
information.
|
||||
:vartype system_data: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SystemData
|
||||
:ivar resources:
|
||||
:vartype resources: str
|
||||
"""
|
||||
|
||||
_validation = {
|
||||
'id': {'readonly': True},
|
||||
'name': {'readonly': True},
|
||||
'type': {'readonly': True},
|
||||
'system_data': {'readonly': True},
|
||||
}
|
||||
|
||||
_attribute_map = {
|
||||
'id': {'key': 'id', 'type': 'str'},
|
||||
'name': {'key': 'name', 'type': 'str'},
|
||||
'type': {'key': 'type', 'type': 'str'},
|
||||
'system_data': {'key': 'systemData', 'type': 'SystemData'},
|
||||
'resources': {'key': 'properties.resources', 'type': 'str'},
|
||||
}
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
resources: Optional[str] = None,
|
||||
**kwargs
|
||||
):
|
||||
"""
|
||||
:keyword resources:
|
||||
:paramtype resources: str
|
||||
"""
|
||||
super(SyncIdentityProvider, self).__init__(**kwargs)
|
||||
self.resources = resources
|
||||
|
||||
|
||||
class SyncIdentityProviderList(msrest.serialization.Model):
|
||||
"""SyncSetList represents a list of SyncSets.
|
||||
|
||||
:ivar value: The list of sync identity providers.
|
||||
:vartype value: list[~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncIdentityProvider]
|
||||
:ivar next_link: The link used to get the next page of operations.
|
||||
:vartype next_link: str
|
||||
"""
|
||||
|
||||
_attribute_map = {
|
||||
'value': {'key': 'value', 'type': '[SyncIdentityProvider]'},
|
||||
'next_link': {'key': 'nextLink', 'type': 'str'},
|
||||
}
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
value: Optional[List["SyncIdentityProvider"]] = None,
|
||||
next_link: Optional[str] = None,
|
||||
**kwargs
|
||||
):
|
||||
"""
|
||||
:keyword value: The list of sync identity providers.
|
||||
:paramtype value: list[~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncIdentityProvider]
|
||||
:keyword next_link: The link used to get the next page of operations.
|
||||
:paramtype next_link: str
|
||||
"""
|
||||
super(SyncIdentityProviderList, self).__init__(**kwargs)
|
||||
self.value = value
|
||||
self.next_link = next_link
|
||||
|
||||
|
||||
class SyncIdentityProviderUpdate(msrest.serialization.Model):
|
||||
"""SyncIdentityProvider represents a SyncIdentityProvider.
|
||||
|
||||
Variables are only populated by the server, and will be ignored when sending a request.
|
||||
|
||||
:ivar system_data: The system meta data relating to this resource.
|
||||
:vartype system_data: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SystemData
|
||||
:ivar resources:
|
||||
:vartype resources: str
|
||||
"""
|
||||
|
||||
_validation = {
|
||||
'system_data': {'readonly': True},
|
||||
}
|
||||
|
||||
_attribute_map = {
|
||||
'system_data': {'key': 'systemData', 'type': 'SystemData'},
|
||||
'resources': {'key': 'properties.resources', 'type': 'str'},
|
||||
}
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
resources: Optional[str] = None,
|
||||
**kwargs
|
||||
):
|
||||
"""
|
||||
:keyword resources:
|
||||
:paramtype resources: str
|
||||
"""
|
||||
super(SyncIdentityProviderUpdate, self).__init__(**kwargs)
|
||||
self.system_data = None
|
||||
self.resources = resources
|
||||
|
||||
|
||||
class SyncSet(ProxyResource):
|
||||
"""SyncSet represents a SyncSet for an Azure Red Hat OpenShift Cluster.
|
||||
|
||||
Variables are only populated by the server, and will be ignored when sending a request.
|
||||
|
||||
:ivar id: Fully qualified resource ID for the resource. Ex -
|
||||
/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
|
||||
:vartype id: str
|
||||
:ivar name: The name of the resource.
|
||||
:vartype name: str
|
||||
:ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or
|
||||
"Microsoft.Storage/storageAccounts".
|
||||
:vartype type: str
|
||||
:ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy
|
||||
information.
|
||||
:vartype system_data: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SystemData
|
||||
:ivar resources: Resources represents the SyncSets configuration.
|
||||
:vartype resources: str
|
||||
"""
|
||||
|
||||
_validation = {
|
||||
'id': {'readonly': True},
|
||||
'name': {'readonly': True},
|
||||
'type': {'readonly': True},
|
||||
'system_data': {'readonly': True},
|
||||
}
|
||||
|
||||
_attribute_map = {
|
||||
'id': {'key': 'id', 'type': 'str'},
|
||||
'name': {'key': 'name', 'type': 'str'},
|
||||
'type': {'key': 'type', 'type': 'str'},
|
||||
'system_data': {'key': 'systemData', 'type': 'SystemData'},
|
||||
'resources': {'key': 'properties.resources', 'type': 'str'},
|
||||
}
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
resources: Optional[str] = None,
|
||||
**kwargs
|
||||
):
|
||||
"""
|
||||
:keyword resources: Resources represents the SyncSets configuration.
|
||||
:paramtype resources: str
|
||||
"""
|
||||
super(SyncSet, self).__init__(**kwargs)
|
||||
self.resources = resources
|
||||
|
||||
|
||||
class SyncSetList(msrest.serialization.Model):
|
||||
"""SyncSetList represents a list of SyncSets.
|
||||
|
||||
:ivar value: The list of syncsets.
|
||||
:vartype value: list[~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncSet]
|
||||
:ivar next_link: The link used to get the next page of operations.
|
||||
:vartype next_link: str
|
||||
"""
|
||||
|
||||
_attribute_map = {
|
||||
'value': {'key': 'value', 'type': '[SyncSet]'},
|
||||
'next_link': {'key': 'nextLink', 'type': 'str'},
|
||||
}
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
value: Optional[List["SyncSet"]] = None,
|
||||
next_link: Optional[str] = None,
|
||||
**kwargs
|
||||
):
|
||||
"""
|
||||
:keyword value: The list of syncsets.
|
||||
:paramtype value: list[~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncSet]
|
||||
:keyword next_link: The link used to get the next page of operations.
|
||||
:paramtype next_link: str
|
||||
"""
|
||||
super(SyncSetList, self).__init__(**kwargs)
|
||||
self.value = value
|
||||
self.next_link = next_link
|
||||
|
||||
|
||||
class SyncSetUpdate(msrest.serialization.Model):
|
||||
"""SyncSet represents a SyncSet for an Azure Red Hat OpenShift Cluster.
|
||||
|
||||
Variables are only populated by the server, and will be ignored when sending a request.
|
||||
|
||||
:ivar system_data: The system meta data relating to this resource.
|
||||
:vartype system_data: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SystemData
|
||||
:ivar resources: Resources represents the SyncSets configuration.
|
||||
:vartype resources: str
|
||||
"""
|
||||
|
||||
_validation = {
|
||||
'system_data': {'readonly': True},
|
||||
}
|
||||
|
||||
_attribute_map = {
|
||||
'system_data': {'key': 'systemData', 'type': 'SystemData'},
|
||||
'resources': {'key': 'properties.resources', 'type': 'str'},
|
||||
}
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
resources: Optional[str] = None,
|
||||
**kwargs
|
||||
):
|
||||
"""
|
||||
:keyword resources: Resources represents the SyncSets configuration.
|
||||
:paramtype resources: str
|
||||
"""
|
||||
super(SyncSetUpdate, self).__init__(**kwargs)
|
||||
self.system_data = None
|
||||
self.resources = resources
|
||||
|
||||
|
||||
class SystemData(msrest.serialization.Model):
|
||||
"""Metadata pertaining to creation and last modification of the resource.
|
||||
|
||||
|
|
|
@ -15,11 +15,19 @@
|
|||
# --------------------------------------------------------------------------
|
||||
|
||||
from ._operations import Operations
|
||||
from ._list_operations import ListOperations
|
||||
from ._install_versions_operations import InstallVersionsOperations
|
||||
from ._open_shift_clusters_operations import OpenShiftClustersOperations
|
||||
from ._machine_pools_operations import MachinePoolsOperations
|
||||
from ._secrets_operations import SecretsOperations
|
||||
from ._sync_identity_providers_operations import SyncIdentityProvidersOperations
|
||||
from ._sync_sets_operations import SyncSetsOperations
|
||||
|
||||
__all__ = [
|
||||
'Operations',
|
||||
'ListOperations',
|
||||
'InstallVersionsOperations',
|
||||
'OpenShiftClustersOperations',
|
||||
'MachinePoolsOperations',
|
||||
'SecretsOperations',
|
||||
'SyncIdentityProvidersOperations',
|
||||
'SyncSetsOperations',
|
||||
]
|
||||
|
|
|
@ -38,7 +38,7 @@ _SERIALIZER = Serializer()
|
|||
_SERIALIZER.client_side_validation = False
|
||||
# fmt: off
|
||||
|
||||
def build_install_versions_request(
|
||||
def build_list_request(
|
||||
subscription_id, # type: str
|
||||
location, # type: str
|
||||
**kwargs # type: Any
|
||||
|
@ -73,8 +73,8 @@ def build_install_versions_request(
|
|||
)
|
||||
|
||||
# fmt: on
|
||||
class ListOperations(object):
|
||||
"""ListOperations operations.
|
||||
class InstallVersionsOperations(object):
|
||||
"""InstallVersionsOperations operations.
|
||||
|
||||
You should not instantiate this class directly. Instead, you should create a Client instance that
|
||||
instantiates it for you and attaches it as an attribute.
|
||||
|
@ -96,7 +96,7 @@ class ListOperations(object):
|
|||
self._config = config
|
||||
|
||||
@distributed_trace
|
||||
def install_versions(
|
||||
def list(
|
||||
self,
|
||||
location, # type: str
|
||||
**kwargs # type: Any
|
||||
|
@ -122,11 +122,11 @@ class ListOperations(object):
|
|||
api_version = kwargs.pop('api_version', "2022-09-04") # type: str
|
||||
|
||||
|
||||
request = build_install_versions_request(
|
||||
request = build_list_request(
|
||||
subscription_id=self._config.subscription_id,
|
||||
location=location,
|
||||
api_version=api_version,
|
||||
template_url=self.install_versions.metadata['url'],
|
||||
template_url=self.list.metadata['url'],
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
|
@ -149,5 +149,5 @@ class ListOperations(object):
|
|||
|
||||
return deserialized
|
||||
|
||||
install_versions.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.RedHatOpenShift/locations/{location}/listinstallversions"} # type: ignore
|
||||
list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.RedHatOpenShift/locations/{location}/listinstallversions"} # type: ignore
|
||||
|
|
@ -0,0 +1,626 @@
|
|||
# pylint: disable=too-many-lines
|
||||
# coding=utf-8
|
||||
# --------------------------------------------------------------------------
|
||||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
# --------------------------------------------------------------------------
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from msrest import Serializer
|
||||
|
||||
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
|
||||
from azure.core.paging import ItemPaged
|
||||
from azure.core.pipeline import PipelineResponse
|
||||
from azure.core.pipeline.transport import HttpResponse
|
||||
from azure.core.rest import HttpRequest
|
||||
from azure.core.tracing.decorator import distributed_trace
|
||||
from azure.mgmt.core.exceptions import ARMErrorFormat
|
||||
|
||||
from .. import models as _models
|
||||
from .._vendor import _convert_request, _format_url_section
|
||||
|
||||
if TYPE_CHECKING:
|
||||
# pylint: disable=unused-import,ungrouped-imports
|
||||
from typing import Any, Callable, Dict, Iterable, Optional, TypeVar
|
||||
T = TypeVar('T')
|
||||
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
|
||||
|
||||
_SERIALIZER = Serializer()
|
||||
_SERIALIZER.client_side_validation = False
|
||||
# fmt: off
|
||||
|
||||
def build_list_request(
|
||||
subscription_id, # type: str
|
||||
resource_group_name, # type: str
|
||||
resource_name, # type: str
|
||||
**kwargs # type: Any
|
||||
):
|
||||
# type: (...) -> HttpRequest
|
||||
api_version = kwargs.pop('api_version', "2022-09-04") # type: str
|
||||
|
||||
accept = "application/json"
|
||||
# Construct URL
|
||||
_url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftCluster/{resourceName}/machinePools") # pylint: disable=line-too-long
|
||||
path_format_arguments = {
|
||||
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1),
|
||||
"resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1),
|
||||
"resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'),
|
||||
}
|
||||
|
||||
_url = _format_url_section(_url, **path_format_arguments)
|
||||
|
||||
# Construct parameters
|
||||
_query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any]
|
||||
_query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str')
|
||||
|
||||
# Construct headers
|
||||
_header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any]
|
||||
_header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str')
|
||||
|
||||
return HttpRequest(
|
||||
method="GET",
|
||||
url=_url,
|
||||
params=_query_parameters,
|
||||
headers=_header_parameters,
|
||||
**kwargs
|
||||
)
|
||||
|
||||
|
||||
def build_get_request(
|
||||
subscription_id, # type: str
|
||||
resource_group_name, # type: str
|
||||
resource_name, # type: str
|
||||
child_resource_name, # type: str
|
||||
**kwargs # type: Any
|
||||
):
|
||||
# type: (...) -> HttpRequest
|
||||
api_version = kwargs.pop('api_version', "2022-09-04") # type: str
|
||||
|
||||
accept = "application/json"
|
||||
# Construct URL
|
||||
_url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/machinePool/{childResourceName}") # pylint: disable=line-too-long
|
||||
path_format_arguments = {
|
||||
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1),
|
||||
"resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1),
|
||||
"resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'),
|
||||
"childResourceName": _SERIALIZER.url("child_resource_name", child_resource_name, 'str'),
|
||||
}
|
||||
|
||||
_url = _format_url_section(_url, **path_format_arguments)
|
||||
|
||||
# Construct parameters
|
||||
_query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any]
|
||||
_query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str')
|
||||
|
||||
# Construct headers
|
||||
_header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any]
|
||||
_header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str')
|
||||
|
||||
return HttpRequest(
|
||||
method="GET",
|
||||
url=_url,
|
||||
params=_query_parameters,
|
||||
headers=_header_parameters,
|
||||
**kwargs
|
||||
)
|
||||
|
||||
|
||||
def build_create_or_update_request(
|
||||
subscription_id, # type: str
|
||||
resource_group_name, # type: str
|
||||
resource_name, # type: str
|
||||
child_resource_name, # type: str
|
||||
**kwargs # type: Any
|
||||
):
|
||||
# type: (...) -> HttpRequest
|
||||
api_version = kwargs.pop('api_version', "2022-09-04") # type: str
|
||||
content_type = kwargs.pop('content_type', None) # type: Optional[str]
|
||||
|
||||
accept = "application/json"
|
||||
# Construct URL
|
||||
_url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/machinePool/{childResourceName}") # pylint: disable=line-too-long
|
||||
path_format_arguments = {
|
||||
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1),
|
||||
"resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1),
|
||||
"resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'),
|
||||
"childResourceName": _SERIALIZER.url("child_resource_name", child_resource_name, 'str'),
|
||||
}
|
||||
|
||||
_url = _format_url_section(_url, **path_format_arguments)
|
||||
|
||||
# Construct parameters
|
||||
_query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any]
|
||||
_query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str')
|
||||
|
||||
# Construct headers
|
||||
_header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any]
|
||||
if content_type is not None:
|
||||
_header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str')
|
||||
_header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str')
|
||||
|
||||
return HttpRequest(
|
||||
method="PUT",
|
||||
url=_url,
|
||||
params=_query_parameters,
|
||||
headers=_header_parameters,
|
||||
**kwargs
|
||||
)
|
||||
|
||||
|
||||
def build_delete_request(
|
||||
subscription_id, # type: str
|
||||
resource_group_name, # type: str
|
||||
resource_name, # type: str
|
||||
child_resource_name, # type: str
|
||||
**kwargs # type: Any
|
||||
):
|
||||
# type: (...) -> HttpRequest
|
||||
api_version = kwargs.pop('api_version', "2022-09-04") # type: str
|
||||
|
||||
accept = "application/json"
|
||||
# Construct URL
|
||||
_url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/machinePool/{childResourceName}") # pylint: disable=line-too-long
|
||||
path_format_arguments = {
|
||||
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1),
|
||||
"resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1),
|
||||
"resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'),
|
||||
"childResourceName": _SERIALIZER.url("child_resource_name", child_resource_name, 'str'),
|
||||
}
|
||||
|
||||
_url = _format_url_section(_url, **path_format_arguments)
|
||||
|
||||
# Construct parameters
|
||||
_query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any]
|
||||
_query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str')
|
||||
|
||||
# Construct headers
|
||||
_header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any]
|
||||
_header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str')
|
||||
|
||||
return HttpRequest(
|
||||
method="DELETE",
|
||||
url=_url,
|
||||
params=_query_parameters,
|
||||
headers=_header_parameters,
|
||||
**kwargs
|
||||
)
|
||||
|
||||
|
||||
def build_update_request(
|
||||
subscription_id, # type: str
|
||||
resource_group_name, # type: str
|
||||
resource_name, # type: str
|
||||
child_resource_name, # type: str
|
||||
**kwargs # type: Any
|
||||
):
|
||||
# type: (...) -> HttpRequest
|
||||
api_version = kwargs.pop('api_version', "2022-09-04") # type: str
|
||||
content_type = kwargs.pop('content_type', None) # type: Optional[str]
|
||||
|
||||
accept = "application/json"
|
||||
# Construct URL
|
||||
_url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/machinePool/{childResourceName}") # pylint: disable=line-too-long
|
||||
path_format_arguments = {
|
||||
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1),
|
||||
"resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1),
|
||||
"resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'),
|
||||
"childResourceName": _SERIALIZER.url("child_resource_name", child_resource_name, 'str'),
|
||||
}
|
||||
|
||||
_url = _format_url_section(_url, **path_format_arguments)
|
||||
|
||||
# Construct parameters
|
||||
_query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any]
|
||||
_query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str')
|
||||
|
||||
# Construct headers
|
||||
_header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any]
|
||||
if content_type is not None:
|
||||
_header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str')
|
||||
_header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str')
|
||||
|
||||
return HttpRequest(
|
||||
method="PATCH",
|
||||
url=_url,
|
||||
params=_query_parameters,
|
||||
headers=_header_parameters,
|
||||
**kwargs
|
||||
)
|
||||
|
||||
# fmt: on
|
||||
class MachinePoolsOperations(object):
|
||||
"""MachinePoolsOperations operations.
|
||||
|
||||
You should not instantiate this class directly. Instead, you should create a Client instance that
|
||||
instantiates it for you and attaches it as an attribute.
|
||||
|
||||
:ivar models: Alias to model classes used in this operation group.
|
||||
:type models: ~azure.mgmt.redhatopenshift.v2022_09_04.models
|
||||
:param client: Client for service requests.
|
||||
:param config: Configuration of service client.
|
||||
:param serializer: An object model serializer.
|
||||
:param deserializer: An object model deserializer.
|
||||
"""
|
||||
|
||||
models = _models
|
||||
|
||||
def __init__(self, client, config, serializer, deserializer):
|
||||
self._client = client
|
||||
self._serialize = serializer
|
||||
self._deserialize = deserializer
|
||||
self._config = config
|
||||
|
||||
@distributed_trace
|
||||
def list(
|
||||
self,
|
||||
resource_group_name, # type: str
|
||||
resource_name, # type: str
|
||||
**kwargs # type: Any
|
||||
):
|
||||
# type: (...) -> Iterable["_models.MachinePoolList"]
|
||||
"""Lists MachinePools that belong to that Azure Red Hat OpenShift Cluster.
|
||||
|
||||
The operation returns properties of each MachinePool.
|
||||
|
||||
:param resource_group_name: The name of the resource group. The name is case insensitive.
|
||||
:type resource_group_name: str
|
||||
:param resource_name: The name of the OpenShift cluster resource.
|
||||
:type resource_name: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:return: An iterator like instance of either MachinePoolList or the result of cls(response)
|
||||
:rtype:
|
||||
~azure.core.paging.ItemPaged[~azure.mgmt.redhatopenshift.v2022_09_04.models.MachinePoolList]
|
||||
:raises: ~azure.core.exceptions.HttpResponseError
|
||||
"""
|
||||
api_version = kwargs.pop('api_version', "2022-09-04") # type: str
|
||||
|
||||
cls = kwargs.pop('cls', None) # type: ClsType["_models.MachinePoolList"]
|
||||
error_map = {
|
||||
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
|
||||
}
|
||||
error_map.update(kwargs.pop('error_map', {}))
|
||||
def prepare_request(next_link=None):
|
||||
if not next_link:
|
||||
|
||||
request = build_list_request(
|
||||
subscription_id=self._config.subscription_id,
|
||||
resource_group_name=resource_group_name,
|
||||
resource_name=resource_name,
|
||||
api_version=api_version,
|
||||
template_url=self.list.metadata['url'],
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
|
||||
else:
|
||||
|
||||
request = build_list_request(
|
||||
subscription_id=self._config.subscription_id,
|
||||
resource_group_name=resource_group_name,
|
||||
resource_name=resource_name,
|
||||
api_version=api_version,
|
||||
template_url=next_link,
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
request.method = "GET"
|
||||
return request
|
||||
|
||||
def extract_data(pipeline_response):
|
||||
deserialized = self._deserialize("MachinePoolList", pipeline_response)
|
||||
list_of_elem = deserialized.value
|
||||
if cls:
|
||||
list_of_elem = cls(list_of_elem)
|
||||
return deserialized.next_link or None, iter(list_of_elem)
|
||||
|
||||
def get_next(next_link=None):
|
||||
request = prepare_request(next_link)
|
||||
|
||||
pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access
|
||||
request,
|
||||
stream=False,
|
||||
**kwargs
|
||||
)
|
||||
response = pipeline_response.http_response
|
||||
|
||||
if response.status_code not in [200]:
|
||||
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
||||
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
|
||||
|
||||
return pipeline_response
|
||||
|
||||
|
||||
return ItemPaged(
|
||||
get_next, extract_data
|
||||
)
|
||||
list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftCluster/{resourceName}/machinePools"} # type: ignore
|
||||
|
||||
@distributed_trace
|
||||
def get(
|
||||
self,
|
||||
resource_group_name, # type: str
|
||||
resource_name, # type: str
|
||||
child_resource_name, # type: str
|
||||
**kwargs # type: Any
|
||||
):
|
||||
# type: (...) -> "_models.MachinePool"
|
||||
"""Gets a MachinePool with the specified subscription, resource group and resource name.
|
||||
|
||||
The operation returns properties of a MachinePool.
|
||||
|
||||
:param resource_group_name: The name of the resource group. The name is case insensitive.
|
||||
:type resource_group_name: str
|
||||
:param resource_name: The name of the OpenShift cluster resource.
|
||||
:type resource_name: str
|
||||
:param child_resource_name: The name of the MachinePool resource.
|
||||
:type child_resource_name: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:return: MachinePool, or the result of cls(response)
|
||||
:rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.MachinePool
|
||||
:raises: ~azure.core.exceptions.HttpResponseError
|
||||
"""
|
||||
cls = kwargs.pop('cls', None) # type: ClsType["_models.MachinePool"]
|
||||
error_map = {
|
||||
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
|
||||
}
|
||||
error_map.update(kwargs.pop('error_map', {}))
|
||||
|
||||
api_version = kwargs.pop('api_version', "2022-09-04") # type: str
|
||||
|
||||
|
||||
request = build_get_request(
|
||||
subscription_id=self._config.subscription_id,
|
||||
resource_group_name=resource_group_name,
|
||||
resource_name=resource_name,
|
||||
child_resource_name=child_resource_name,
|
||||
api_version=api_version,
|
||||
template_url=self.get.metadata['url'],
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
|
||||
pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access
|
||||
request,
|
||||
stream=False,
|
||||
**kwargs
|
||||
)
|
||||
response = pipeline_response.http_response
|
||||
|
||||
if response.status_code not in [200]:
|
||||
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
||||
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
|
||||
|
||||
deserialized = self._deserialize('MachinePool', pipeline_response)
|
||||
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, {})
|
||||
|
||||
return deserialized
|
||||
|
||||
get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/machinePool/{childResourceName}"} # type: ignore
|
||||
|
||||
|
||||
@distributed_trace
|
||||
def create_or_update(
|
||||
self,
|
||||
resource_group_name, # type: str
|
||||
resource_name, # type: str
|
||||
child_resource_name, # type: str
|
||||
parameters, # type: "_models.MachinePool"
|
||||
**kwargs # type: Any
|
||||
):
|
||||
# type: (...) -> "_models.MachinePool"
|
||||
"""Creates or updates a MachinePool with the specified subscription, resource group and resource
|
||||
name.
|
||||
|
||||
The operation returns properties of a MachinePool.
|
||||
|
||||
:param resource_group_name: The name of the resource group. The name is case insensitive.
|
||||
:type resource_group_name: str
|
||||
:param resource_name: The name of the OpenShift cluster resource.
|
||||
:type resource_name: str
|
||||
:param child_resource_name: The name of the MachinePool resource.
|
||||
:type child_resource_name: str
|
||||
:param parameters: The MachinePool resource.
|
||||
:type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.MachinePool
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:return: MachinePool, or the result of cls(response)
|
||||
:rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.MachinePool
|
||||
:raises: ~azure.core.exceptions.HttpResponseError
|
||||
"""
|
||||
cls = kwargs.pop('cls', None) # type: ClsType["_models.MachinePool"]
|
||||
error_map = {
|
||||
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
|
||||
}
|
||||
error_map.update(kwargs.pop('error_map', {}))
|
||||
|
||||
api_version = kwargs.pop('api_version', "2022-09-04") # type: str
|
||||
content_type = kwargs.pop('content_type', "application/json") # type: Optional[str]
|
||||
|
||||
_json = self._serialize.body(parameters, 'MachinePool')
|
||||
|
||||
request = build_create_or_update_request(
|
||||
subscription_id=self._config.subscription_id,
|
||||
resource_group_name=resource_group_name,
|
||||
resource_name=resource_name,
|
||||
child_resource_name=child_resource_name,
|
||||
api_version=api_version,
|
||||
content_type=content_type,
|
||||
json=_json,
|
||||
template_url=self.create_or_update.metadata['url'],
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
|
||||
pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access
|
||||
request,
|
||||
stream=False,
|
||||
**kwargs
|
||||
)
|
||||
response = pipeline_response.http_response
|
||||
|
||||
if response.status_code not in [200, 201]:
|
||||
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
||||
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
|
||||
|
||||
if response.status_code == 200:
|
||||
deserialized = self._deserialize('MachinePool', pipeline_response)
|
||||
|
||||
if response.status_code == 201:
|
||||
deserialized = self._deserialize('MachinePool', pipeline_response)
|
||||
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, {})
|
||||
|
||||
return deserialized
|
||||
|
||||
create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/machinePool/{childResourceName}"} # type: ignore
|
||||
|
||||
|
||||
@distributed_trace
|
||||
def delete( # pylint: disable=inconsistent-return-statements
|
||||
self,
|
||||
resource_group_name, # type: str
|
||||
resource_name, # type: str
|
||||
child_resource_name, # type: str
|
||||
**kwargs # type: Any
|
||||
):
|
||||
# type: (...) -> None
|
||||
"""Deletes a MachinePool with the specified subscription, resource group and resource name.
|
||||
|
||||
The operation returns nothing.
|
||||
|
||||
:param resource_group_name: The name of the resource group. The name is case insensitive.
|
||||
:type resource_group_name: str
|
||||
:param resource_name: The name of the OpenShift cluster resource.
|
||||
:type resource_name: str
|
||||
:param child_resource_name: The name of the MachinePool resource.
|
||||
:type child_resource_name: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:return: None, or the result of cls(response)
|
||||
:rtype: None
|
||||
:raises: ~azure.core.exceptions.HttpResponseError
|
||||
"""
|
||||
cls = kwargs.pop('cls', None) # type: ClsType[None]
|
||||
error_map = {
|
||||
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
|
||||
}
|
||||
error_map.update(kwargs.pop('error_map', {}))
|
||||
|
||||
api_version = kwargs.pop('api_version', "2022-09-04") # type: str
|
||||
|
||||
|
||||
request = build_delete_request(
|
||||
subscription_id=self._config.subscription_id,
|
||||
resource_group_name=resource_group_name,
|
||||
resource_name=resource_name,
|
||||
child_resource_name=child_resource_name,
|
||||
api_version=api_version,
|
||||
template_url=self.delete.metadata['url'],
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
|
||||
pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access
|
||||
request,
|
||||
stream=False,
|
||||
**kwargs
|
||||
)
|
||||
response = pipeline_response.http_response
|
||||
|
||||
if response.status_code not in [200, 204]:
|
||||
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
||||
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
|
||||
|
||||
if cls:
|
||||
return cls(pipeline_response, None, {})
|
||||
|
||||
delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/machinePool/{childResourceName}"} # type: ignore
|
||||
|
||||
|
||||
@distributed_trace
|
||||
def update(
|
||||
self,
|
||||
resource_group_name, # type: str
|
||||
resource_name, # type: str
|
||||
child_resource_name, # type: str
|
||||
parameters, # type: "_models.MachinePoolUpdate"
|
||||
**kwargs # type: Any
|
||||
):
|
||||
# type: (...) -> "_models.MachinePool"
|
||||
"""Patches (create or update) a MachinePool with the specified subscription, resource group and
|
||||
resource name.
|
||||
|
||||
The operation returns properties of a MachinePool.
|
||||
|
||||
:param resource_group_name: The name of the resource group. The name is case insensitive.
|
||||
:type resource_group_name: str
|
||||
:param resource_name: The name of the OpenShift cluster resource.
|
||||
:type resource_name: str
|
||||
:param child_resource_name: The name of the MachinePool resource.
|
||||
:type child_resource_name: str
|
||||
:param parameters: The MachinePool resource.
|
||||
:type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.MachinePoolUpdate
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:return: MachinePool, or the result of cls(response)
|
||||
:rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.MachinePool
|
||||
:raises: ~azure.core.exceptions.HttpResponseError
|
||||
"""
|
||||
cls = kwargs.pop('cls', None) # type: ClsType["_models.MachinePool"]
|
||||
error_map = {
|
||||
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
|
||||
}
|
||||
error_map.update(kwargs.pop('error_map', {}))
|
||||
|
||||
api_version = kwargs.pop('api_version', "2022-09-04") # type: str
|
||||
content_type = kwargs.pop('content_type', "application/json") # type: Optional[str]
|
||||
|
||||
_json = self._serialize.body(parameters, 'MachinePoolUpdate')
|
||||
|
||||
request = build_update_request(
|
||||
subscription_id=self._config.subscription_id,
|
||||
resource_group_name=resource_group_name,
|
||||
resource_name=resource_name,
|
||||
child_resource_name=child_resource_name,
|
||||
api_version=api_version,
|
||||
content_type=content_type,
|
||||
json=_json,
|
||||
template_url=self.update.metadata['url'],
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
|
||||
pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access
|
||||
request,
|
||||
stream=False,
|
||||
**kwargs
|
||||
)
|
||||
response = pipeline_response.http_response
|
||||
|
||||
if response.status_code not in [200, 201]:
|
||||
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
||||
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
|
||||
|
||||
if response.status_code == 200:
|
||||
deserialized = self._deserialize('MachinePool', pipeline_response)
|
||||
|
||||
if response.status_code == 201:
|
||||
deserialized = self._deserialize('MachinePool', pipeline_response)
|
||||
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, {})
|
||||
|
||||
return deserialized
|
||||
|
||||
update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/machinePool/{childResourceName}"} # type: ignore
|
||||
|
|
@ -0,0 +1,624 @@
|
|||
# pylint: disable=too-many-lines
|
||||
# coding=utf-8
|
||||
# --------------------------------------------------------------------------
|
||||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
# --------------------------------------------------------------------------
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from msrest import Serializer
|
||||
|
||||
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
|
||||
from azure.core.paging import ItemPaged
|
||||
from azure.core.pipeline import PipelineResponse
|
||||
from azure.core.pipeline.transport import HttpResponse
|
||||
from azure.core.rest import HttpRequest
|
||||
from azure.core.tracing.decorator import distributed_trace
|
||||
from azure.mgmt.core.exceptions import ARMErrorFormat
|
||||
|
||||
from .. import models as _models
|
||||
from .._vendor import _convert_request, _format_url_section
|
||||
|
||||
if TYPE_CHECKING:
|
||||
# pylint: disable=unused-import,ungrouped-imports
|
||||
from typing import Any, Callable, Dict, Iterable, Optional, TypeVar
|
||||
T = TypeVar('T')
|
||||
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
|
||||
|
||||
_SERIALIZER = Serializer()
|
||||
_SERIALIZER.client_side_validation = False
|
||||
# fmt: off
|
||||
|
||||
def build_list_request(
|
||||
subscription_id, # type: str
|
||||
resource_group_name, # type: str
|
||||
resource_name, # type: str
|
||||
**kwargs # type: Any
|
||||
):
|
||||
# type: (...) -> HttpRequest
|
||||
api_version = kwargs.pop('api_version', "2022-09-04") # type: str
|
||||
|
||||
accept = "application/json"
|
||||
# Construct URL
|
||||
_url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftCluster/{resourceName}/secrets") # pylint: disable=line-too-long
|
||||
path_format_arguments = {
|
||||
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1),
|
||||
"resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1),
|
||||
"resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'),
|
||||
}
|
||||
|
||||
_url = _format_url_section(_url, **path_format_arguments)
|
||||
|
||||
# Construct parameters
|
||||
_query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any]
|
||||
_query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str')
|
||||
|
||||
# Construct headers
|
||||
_header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any]
|
||||
_header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str')
|
||||
|
||||
return HttpRequest(
|
||||
method="GET",
|
||||
url=_url,
|
||||
params=_query_parameters,
|
||||
headers=_header_parameters,
|
||||
**kwargs
|
||||
)
|
||||
|
||||
|
||||
def build_get_request(
|
||||
subscription_id, # type: str
|
||||
resource_group_name, # type: str
|
||||
resource_name, # type: str
|
||||
child_resource_name, # type: str
|
||||
**kwargs # type: Any
|
||||
):
|
||||
# type: (...) -> HttpRequest
|
||||
api_version = kwargs.pop('api_version', "2022-09-04") # type: str
|
||||
|
||||
accept = "application/json"
|
||||
# Construct URL
|
||||
_url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/secret/{childResourceName}") # pylint: disable=line-too-long
|
||||
path_format_arguments = {
|
||||
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1),
|
||||
"resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1),
|
||||
"resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'),
|
||||
"childResourceName": _SERIALIZER.url("child_resource_name", child_resource_name, 'str'),
|
||||
}
|
||||
|
||||
_url = _format_url_section(_url, **path_format_arguments)
|
||||
|
||||
# Construct parameters
|
||||
_query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any]
|
||||
_query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str')
|
||||
|
||||
# Construct headers
|
||||
_header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any]
|
||||
_header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str')
|
||||
|
||||
return HttpRequest(
|
||||
method="GET",
|
||||
url=_url,
|
||||
params=_query_parameters,
|
||||
headers=_header_parameters,
|
||||
**kwargs
|
||||
)
|
||||
|
||||
|
||||
def build_create_or_update_request(
|
||||
subscription_id, # type: str
|
||||
resource_group_name, # type: str
|
||||
resource_name, # type: str
|
||||
child_resource_name, # type: str
|
||||
**kwargs # type: Any
|
||||
):
|
||||
# type: (...) -> HttpRequest
|
||||
api_version = kwargs.pop('api_version', "2022-09-04") # type: str
|
||||
content_type = kwargs.pop('content_type', None) # type: Optional[str]
|
||||
|
||||
accept = "application/json"
|
||||
# Construct URL
|
||||
_url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/secret/{childResourceName}") # pylint: disable=line-too-long
|
||||
path_format_arguments = {
|
||||
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1),
|
||||
"resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1),
|
||||
"resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'),
|
||||
"childResourceName": _SERIALIZER.url("child_resource_name", child_resource_name, 'str'),
|
||||
}
|
||||
|
||||
_url = _format_url_section(_url, **path_format_arguments)
|
||||
|
||||
# Construct parameters
|
||||
_query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any]
|
||||
_query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str')
|
||||
|
||||
# Construct headers
|
||||
_header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any]
|
||||
if content_type is not None:
|
||||
_header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str')
|
||||
_header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str')
|
||||
|
||||
return HttpRequest(
|
||||
method="PUT",
|
||||
url=_url,
|
||||
params=_query_parameters,
|
||||
headers=_header_parameters,
|
||||
**kwargs
|
||||
)
|
||||
|
||||
|
||||
def build_delete_request(
|
||||
subscription_id, # type: str
|
||||
resource_group_name, # type: str
|
||||
resource_name, # type: str
|
||||
child_resource_name, # type: str
|
||||
**kwargs # type: Any
|
||||
):
|
||||
# type: (...) -> HttpRequest
|
||||
api_version = kwargs.pop('api_version', "2022-09-04") # type: str
|
||||
|
||||
accept = "application/json"
|
||||
# Construct URL
|
||||
_url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/secret/{childResourceName}") # pylint: disable=line-too-long
|
||||
path_format_arguments = {
|
||||
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1),
|
||||
"resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1),
|
||||
"resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'),
|
||||
"childResourceName": _SERIALIZER.url("child_resource_name", child_resource_name, 'str'),
|
||||
}
|
||||
|
||||
_url = _format_url_section(_url, **path_format_arguments)
|
||||
|
||||
# Construct parameters
|
||||
_query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any]
|
||||
_query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str')
|
||||
|
||||
# Construct headers
|
||||
_header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any]
|
||||
_header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str')
|
||||
|
||||
return HttpRequest(
|
||||
method="DELETE",
|
||||
url=_url,
|
||||
params=_query_parameters,
|
||||
headers=_header_parameters,
|
||||
**kwargs
|
||||
)
|
||||
|
||||
|
||||
def build_update_request(
|
||||
subscription_id, # type: str
|
||||
resource_group_name, # type: str
|
||||
resource_name, # type: str
|
||||
child_resource_name, # type: str
|
||||
**kwargs # type: Any
|
||||
):
|
||||
# type: (...) -> HttpRequest
|
||||
api_version = kwargs.pop('api_version', "2022-09-04") # type: str
|
||||
content_type = kwargs.pop('content_type', None) # type: Optional[str]
|
||||
|
||||
accept = "application/json"
|
||||
# Construct URL
|
||||
_url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/secret/{childResourceName}") # pylint: disable=line-too-long
|
||||
path_format_arguments = {
|
||||
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1),
|
||||
"resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1),
|
||||
"resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'),
|
||||
"childResourceName": _SERIALIZER.url("child_resource_name", child_resource_name, 'str'),
|
||||
}
|
||||
|
||||
_url = _format_url_section(_url, **path_format_arguments)
|
||||
|
||||
# Construct parameters
|
||||
_query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any]
|
||||
_query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str')
|
||||
|
||||
# Construct headers
|
||||
_header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any]
|
||||
if content_type is not None:
|
||||
_header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str')
|
||||
_header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str')
|
||||
|
||||
return HttpRequest(
|
||||
method="PATCH",
|
||||
url=_url,
|
||||
params=_query_parameters,
|
||||
headers=_header_parameters,
|
||||
**kwargs
|
||||
)
|
||||
|
||||
# fmt: on
|
||||
class SecretsOperations(object):
|
||||
"""SecretsOperations operations.
|
||||
|
||||
You should not instantiate this class directly. Instead, you should create a Client instance that
|
||||
instantiates it for you and attaches it as an attribute.
|
||||
|
||||
:ivar models: Alias to model classes used in this operation group.
|
||||
:type models: ~azure.mgmt.redhatopenshift.v2022_09_04.models
|
||||
:param client: Client for service requests.
|
||||
:param config: Configuration of service client.
|
||||
:param serializer: An object model serializer.
|
||||
:param deserializer: An object model deserializer.
|
||||
"""
|
||||
|
||||
models = _models
|
||||
|
||||
def __init__(self, client, config, serializer, deserializer):
|
||||
self._client = client
|
||||
self._serialize = serializer
|
||||
self._deserialize = deserializer
|
||||
self._config = config
|
||||
|
||||
@distributed_trace
|
||||
def list(
|
||||
self,
|
||||
resource_group_name, # type: str
|
||||
resource_name, # type: str
|
||||
**kwargs # type: Any
|
||||
):
|
||||
# type: (...) -> Iterable["_models.SecretList"]
|
||||
"""Lists Secrets that belong to that Azure Red Hat OpenShift Cluster.
|
||||
|
||||
The operation returns properties of each Secret.
|
||||
|
||||
:param resource_group_name: The name of the resource group. The name is case insensitive.
|
||||
:type resource_group_name: str
|
||||
:param resource_name: The name of the OpenShift cluster resource.
|
||||
:type resource_name: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:return: An iterator like instance of either SecretList or the result of cls(response)
|
||||
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.redhatopenshift.v2022_09_04.models.SecretList]
|
||||
:raises: ~azure.core.exceptions.HttpResponseError
|
||||
"""
|
||||
api_version = kwargs.pop('api_version', "2022-09-04") # type: str
|
||||
|
||||
cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretList"]
|
||||
error_map = {
|
||||
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
|
||||
}
|
||||
error_map.update(kwargs.pop('error_map', {}))
|
||||
def prepare_request(next_link=None):
|
||||
if not next_link:
|
||||
|
||||
request = build_list_request(
|
||||
subscription_id=self._config.subscription_id,
|
||||
resource_group_name=resource_group_name,
|
||||
resource_name=resource_name,
|
||||
api_version=api_version,
|
||||
template_url=self.list.metadata['url'],
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
|
||||
else:
|
||||
|
||||
request = build_list_request(
|
||||
subscription_id=self._config.subscription_id,
|
||||
resource_group_name=resource_group_name,
|
||||
resource_name=resource_name,
|
||||
api_version=api_version,
|
||||
template_url=next_link,
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
request.method = "GET"
|
||||
return request
|
||||
|
||||
def extract_data(pipeline_response):
|
||||
deserialized = self._deserialize("SecretList", pipeline_response)
|
||||
list_of_elem = deserialized.value
|
||||
if cls:
|
||||
list_of_elem = cls(list_of_elem)
|
||||
return deserialized.next_link or None, iter(list_of_elem)
|
||||
|
||||
def get_next(next_link=None):
|
||||
request = prepare_request(next_link)
|
||||
|
||||
pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access
|
||||
request,
|
||||
stream=False,
|
||||
**kwargs
|
||||
)
|
||||
response = pipeline_response.http_response
|
||||
|
||||
if response.status_code not in [200]:
|
||||
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
||||
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
|
||||
|
||||
return pipeline_response
|
||||
|
||||
|
||||
return ItemPaged(
|
||||
get_next, extract_data
|
||||
)
|
||||
list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftCluster/{resourceName}/secrets"} # type: ignore
|
||||
|
||||
@distributed_trace
|
||||
def get(
|
||||
self,
|
||||
resource_group_name, # type: str
|
||||
resource_name, # type: str
|
||||
child_resource_name, # type: str
|
||||
**kwargs # type: Any
|
||||
):
|
||||
# type: (...) -> "_models.Secret"
|
||||
"""Gets a Secret with the specified subscription, resource group and resource name.
|
||||
|
||||
The operation returns properties of a Secret.
|
||||
|
||||
:param resource_group_name: The name of the resource group. The name is case insensitive.
|
||||
:type resource_group_name: str
|
||||
:param resource_name: The name of the OpenShift cluster resource.
|
||||
:type resource_name: str
|
||||
:param child_resource_name: The name of the Secret resource.
|
||||
:type child_resource_name: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:return: Secret, or the result of cls(response)
|
||||
:rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.Secret
|
||||
:raises: ~azure.core.exceptions.HttpResponseError
|
||||
"""
|
||||
cls = kwargs.pop('cls', None) # type: ClsType["_models.Secret"]
|
||||
error_map = {
|
||||
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
|
||||
}
|
||||
error_map.update(kwargs.pop('error_map', {}))
|
||||
|
||||
api_version = kwargs.pop('api_version', "2022-09-04") # type: str
|
||||
|
||||
|
||||
request = build_get_request(
|
||||
subscription_id=self._config.subscription_id,
|
||||
resource_group_name=resource_group_name,
|
||||
resource_name=resource_name,
|
||||
child_resource_name=child_resource_name,
|
||||
api_version=api_version,
|
||||
template_url=self.get.metadata['url'],
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
|
||||
pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access
|
||||
request,
|
||||
stream=False,
|
||||
**kwargs
|
||||
)
|
||||
response = pipeline_response.http_response
|
||||
|
||||
if response.status_code not in [200]:
|
||||
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
||||
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
|
||||
|
||||
deserialized = self._deserialize('Secret', pipeline_response)
|
||||
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, {})
|
||||
|
||||
return deserialized
|
||||
|
||||
get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/secret/{childResourceName}"} # type: ignore
|
||||
|
||||
|
||||
@distributed_trace
|
||||
def create_or_update(
|
||||
self,
|
||||
resource_group_name, # type: str
|
||||
resource_name, # type: str
|
||||
child_resource_name, # type: str
|
||||
parameters, # type: "_models.Secret"
|
||||
**kwargs # type: Any
|
||||
):
|
||||
# type: (...) -> "_models.Secret"
|
||||
"""Creates or updates a Secret with the specified subscription, resource group and resource name.
|
||||
|
||||
The operation returns properties of a Secret.
|
||||
|
||||
:param resource_group_name: The name of the resource group. The name is case insensitive.
|
||||
:type resource_group_name: str
|
||||
:param resource_name: The name of the OpenShift cluster resource.
|
||||
:type resource_name: str
|
||||
:param child_resource_name: The name of the Secret resource.
|
||||
:type child_resource_name: str
|
||||
:param parameters: The Secret resource.
|
||||
:type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.Secret
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:return: Secret, or the result of cls(response)
|
||||
:rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.Secret
|
||||
:raises: ~azure.core.exceptions.HttpResponseError
|
||||
"""
|
||||
cls = kwargs.pop('cls', None) # type: ClsType["_models.Secret"]
|
||||
error_map = {
|
||||
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
|
||||
}
|
||||
error_map.update(kwargs.pop('error_map', {}))
|
||||
|
||||
api_version = kwargs.pop('api_version', "2022-09-04") # type: str
|
||||
content_type = kwargs.pop('content_type', "application/json") # type: Optional[str]
|
||||
|
||||
_json = self._serialize.body(parameters, 'Secret')
|
||||
|
||||
request = build_create_or_update_request(
|
||||
subscription_id=self._config.subscription_id,
|
||||
resource_group_name=resource_group_name,
|
||||
resource_name=resource_name,
|
||||
child_resource_name=child_resource_name,
|
||||
api_version=api_version,
|
||||
content_type=content_type,
|
||||
json=_json,
|
||||
template_url=self.create_or_update.metadata['url'],
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
|
||||
pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access
|
||||
request,
|
||||
stream=False,
|
||||
**kwargs
|
||||
)
|
||||
response = pipeline_response.http_response
|
||||
|
||||
if response.status_code not in [200, 201]:
|
||||
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
||||
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
|
||||
|
||||
if response.status_code == 200:
|
||||
deserialized = self._deserialize('Secret', pipeline_response)
|
||||
|
||||
if response.status_code == 201:
|
||||
deserialized = self._deserialize('Secret', pipeline_response)
|
||||
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, {})
|
||||
|
||||
return deserialized
|
||||
|
||||
create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/secret/{childResourceName}"} # type: ignore
|
||||
|
||||
|
||||
@distributed_trace
|
||||
def delete( # pylint: disable=inconsistent-return-statements
|
||||
self,
|
||||
resource_group_name, # type: str
|
||||
resource_name, # type: str
|
||||
child_resource_name, # type: str
|
||||
**kwargs # type: Any
|
||||
):
|
||||
# type: (...) -> None
|
||||
"""Deletes a Secret with the specified subscription, resource group and resource name.
|
||||
|
||||
The operation returns nothing.
|
||||
|
||||
:param resource_group_name: The name of the resource group. The name is case insensitive.
|
||||
:type resource_group_name: str
|
||||
:param resource_name: The name of the OpenShift cluster resource.
|
||||
:type resource_name: str
|
||||
:param child_resource_name: The name of the Secret resource.
|
||||
:type child_resource_name: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:return: None, or the result of cls(response)
|
||||
:rtype: None
|
||||
:raises: ~azure.core.exceptions.HttpResponseError
|
||||
"""
|
||||
cls = kwargs.pop('cls', None) # type: ClsType[None]
|
||||
error_map = {
|
||||
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
|
||||
}
|
||||
error_map.update(kwargs.pop('error_map', {}))
|
||||
|
||||
api_version = kwargs.pop('api_version', "2022-09-04") # type: str
|
||||
|
||||
|
||||
request = build_delete_request(
|
||||
subscription_id=self._config.subscription_id,
|
||||
resource_group_name=resource_group_name,
|
||||
resource_name=resource_name,
|
||||
child_resource_name=child_resource_name,
|
||||
api_version=api_version,
|
||||
template_url=self.delete.metadata['url'],
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
|
||||
pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access
|
||||
request,
|
||||
stream=False,
|
||||
**kwargs
|
||||
)
|
||||
response = pipeline_response.http_response
|
||||
|
||||
if response.status_code not in [200, 204]:
|
||||
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
||||
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
|
||||
|
||||
if cls:
|
||||
return cls(pipeline_response, None, {})
|
||||
|
||||
delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/secret/{childResourceName}"} # type: ignore
|
||||
|
||||
|
||||
@distributed_trace
|
||||
def update(
|
||||
self,
|
||||
resource_group_name, # type: str
|
||||
resource_name, # type: str
|
||||
child_resource_name, # type: str
|
||||
parameters, # type: "_models.SecretUpdate"
|
||||
**kwargs # type: Any
|
||||
):
|
||||
# type: (...) -> "_models.Secret"
|
||||
"""Patches (create or update) a Secret with the specified subscription, resource group and
|
||||
resource name.
|
||||
|
||||
The operation returns properties of a Secret.
|
||||
|
||||
:param resource_group_name: The name of the resource group. The name is case insensitive.
|
||||
:type resource_group_name: str
|
||||
:param resource_name: The name of the OpenShift cluster resource.
|
||||
:type resource_name: str
|
||||
:param child_resource_name: The name of the Secret resource.
|
||||
:type child_resource_name: str
|
||||
:param parameters: The Secret resource.
|
||||
:type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SecretUpdate
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:return: Secret, or the result of cls(response)
|
||||
:rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.Secret
|
||||
:raises: ~azure.core.exceptions.HttpResponseError
|
||||
"""
|
||||
cls = kwargs.pop('cls', None) # type: ClsType["_models.Secret"]
|
||||
error_map = {
|
||||
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
|
||||
}
|
||||
error_map.update(kwargs.pop('error_map', {}))
|
||||
|
||||
api_version = kwargs.pop('api_version', "2022-09-04") # type: str
|
||||
content_type = kwargs.pop('content_type', "application/json") # type: Optional[str]
|
||||
|
||||
_json = self._serialize.body(parameters, 'SecretUpdate')
|
||||
|
||||
request = build_update_request(
|
||||
subscription_id=self._config.subscription_id,
|
||||
resource_group_name=resource_group_name,
|
||||
resource_name=resource_name,
|
||||
child_resource_name=child_resource_name,
|
||||
api_version=api_version,
|
||||
content_type=content_type,
|
||||
json=_json,
|
||||
template_url=self.update.metadata['url'],
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
|
||||
pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access
|
||||
request,
|
||||
stream=False,
|
||||
**kwargs
|
||||
)
|
||||
response = pipeline_response.http_response
|
||||
|
||||
if response.status_code not in [200, 201]:
|
||||
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
||||
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
|
||||
|
||||
if response.status_code == 200:
|
||||
deserialized = self._deserialize('Secret', pipeline_response)
|
||||
|
||||
if response.status_code == 201:
|
||||
deserialized = self._deserialize('Secret', pipeline_response)
|
||||
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, {})
|
||||
|
||||
return deserialized
|
||||
|
||||
update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/secret/{childResourceName}"} # type: ignore
|
||||
|
|
@ -0,0 +1,628 @@
|
|||
# pylint: disable=too-many-lines
|
||||
# coding=utf-8
|
||||
# --------------------------------------------------------------------------
|
||||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
# --------------------------------------------------------------------------
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from msrest import Serializer
|
||||
|
||||
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
|
||||
from azure.core.paging import ItemPaged
|
||||
from azure.core.pipeline import PipelineResponse
|
||||
from azure.core.pipeline.transport import HttpResponse
|
||||
from azure.core.rest import HttpRequest
|
||||
from azure.core.tracing.decorator import distributed_trace
|
||||
from azure.mgmt.core.exceptions import ARMErrorFormat
|
||||
|
||||
from .. import models as _models
|
||||
from .._vendor import _convert_request, _format_url_section
|
||||
|
||||
if TYPE_CHECKING:
|
||||
# pylint: disable=unused-import,ungrouped-imports
|
||||
from typing import Any, Callable, Dict, Iterable, Optional, TypeVar
|
||||
T = TypeVar('T')
|
||||
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
|
||||
|
||||
_SERIALIZER = Serializer()
|
||||
_SERIALIZER.client_side_validation = False
|
||||
# fmt: off
|
||||
|
||||
def build_list_request(
|
||||
subscription_id, # type: str
|
||||
resource_group_name, # type: str
|
||||
resource_name, # type: str
|
||||
**kwargs # type: Any
|
||||
):
|
||||
# type: (...) -> HttpRequest
|
||||
api_version = kwargs.pop('api_version', "2022-09-04") # type: str
|
||||
|
||||
accept = "application/json"
|
||||
# Construct URL
|
||||
_url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftCluster/{resourceName}/syncIdentityProviders") # pylint: disable=line-too-long
|
||||
path_format_arguments = {
|
||||
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1),
|
||||
"resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1),
|
||||
"resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'),
|
||||
}
|
||||
|
||||
_url = _format_url_section(_url, **path_format_arguments)
|
||||
|
||||
# Construct parameters
|
||||
_query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any]
|
||||
_query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str')
|
||||
|
||||
# Construct headers
|
||||
_header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any]
|
||||
_header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str')
|
||||
|
||||
return HttpRequest(
|
||||
method="GET",
|
||||
url=_url,
|
||||
params=_query_parameters,
|
||||
headers=_header_parameters,
|
||||
**kwargs
|
||||
)
|
||||
|
||||
|
||||
def build_get_request(
|
||||
subscription_id, # type: str
|
||||
resource_group_name, # type: str
|
||||
resource_name, # type: str
|
||||
child_resource_name, # type: str
|
||||
**kwargs # type: Any
|
||||
):
|
||||
# type: (...) -> HttpRequest
|
||||
api_version = kwargs.pop('api_version', "2022-09-04") # type: str
|
||||
|
||||
accept = "application/json"
|
||||
# Construct URL
|
||||
_url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/syncIdentityProvider/{childResourceName}") # pylint: disable=line-too-long
|
||||
path_format_arguments = {
|
||||
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1),
|
||||
"resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1),
|
||||
"resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'),
|
||||
"childResourceName": _SERIALIZER.url("child_resource_name", child_resource_name, 'str'),
|
||||
}
|
||||
|
||||
_url = _format_url_section(_url, **path_format_arguments)
|
||||
|
||||
# Construct parameters
|
||||
_query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any]
|
||||
_query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str')
|
||||
|
||||
# Construct headers
|
||||
_header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any]
|
||||
_header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str')
|
||||
|
||||
return HttpRequest(
|
||||
method="GET",
|
||||
url=_url,
|
||||
params=_query_parameters,
|
||||
headers=_header_parameters,
|
||||
**kwargs
|
||||
)
|
||||
|
||||
|
||||
def build_create_or_update_request(
|
||||
subscription_id, # type: str
|
||||
resource_group_name, # type: str
|
||||
resource_name, # type: str
|
||||
child_resource_name, # type: str
|
||||
**kwargs # type: Any
|
||||
):
|
||||
# type: (...) -> HttpRequest
|
||||
api_version = kwargs.pop('api_version', "2022-09-04") # type: str
|
||||
content_type = kwargs.pop('content_type', None) # type: Optional[str]
|
||||
|
||||
accept = "application/json"
|
||||
# Construct URL
|
||||
_url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/syncIdentityProvider/{childResourceName}") # pylint: disable=line-too-long
|
||||
path_format_arguments = {
|
||||
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1),
|
||||
"resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1),
|
||||
"resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'),
|
||||
"childResourceName": _SERIALIZER.url("child_resource_name", child_resource_name, 'str'),
|
||||
}
|
||||
|
||||
_url = _format_url_section(_url, **path_format_arguments)
|
||||
|
||||
# Construct parameters
|
||||
_query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any]
|
||||
_query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str')
|
||||
|
||||
# Construct headers
|
||||
_header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any]
|
||||
if content_type is not None:
|
||||
_header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str')
|
||||
_header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str')
|
||||
|
||||
return HttpRequest(
|
||||
method="PUT",
|
||||
url=_url,
|
||||
params=_query_parameters,
|
||||
headers=_header_parameters,
|
||||
**kwargs
|
||||
)
|
||||
|
||||
|
||||
def build_delete_request(
|
||||
subscription_id, # type: str
|
||||
resource_group_name, # type: str
|
||||
resource_name, # type: str
|
||||
child_resource_name, # type: str
|
||||
**kwargs # type: Any
|
||||
):
|
||||
# type: (...) -> HttpRequest
|
||||
api_version = kwargs.pop('api_version', "2022-09-04") # type: str
|
||||
|
||||
accept = "application/json"
|
||||
# Construct URL
|
||||
_url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/syncIdentityProvider/{childResourceName}") # pylint: disable=line-too-long
|
||||
path_format_arguments = {
|
||||
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1),
|
||||
"resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1),
|
||||
"resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'),
|
||||
"childResourceName": _SERIALIZER.url("child_resource_name", child_resource_name, 'str'),
|
||||
}
|
||||
|
||||
_url = _format_url_section(_url, **path_format_arguments)
|
||||
|
||||
# Construct parameters
|
||||
_query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any]
|
||||
_query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str')
|
||||
|
||||
# Construct headers
|
||||
_header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any]
|
||||
_header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str')
|
||||
|
||||
return HttpRequest(
|
||||
method="DELETE",
|
||||
url=_url,
|
||||
params=_query_parameters,
|
||||
headers=_header_parameters,
|
||||
**kwargs
|
||||
)
|
||||
|
||||
|
||||
def build_update_request(
|
||||
subscription_id, # type: str
|
||||
resource_group_name, # type: str
|
||||
resource_name, # type: str
|
||||
child_resource_name, # type: str
|
||||
**kwargs # type: Any
|
||||
):
|
||||
# type: (...) -> HttpRequest
|
||||
api_version = kwargs.pop('api_version', "2022-09-04") # type: str
|
||||
content_type = kwargs.pop('content_type', None) # type: Optional[str]
|
||||
|
||||
accept = "application/json"
|
||||
# Construct URL
|
||||
_url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/syncIdentityProvider/{childResourceName}") # pylint: disable=line-too-long
|
||||
path_format_arguments = {
|
||||
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1),
|
||||
"resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1),
|
||||
"resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'),
|
||||
"childResourceName": _SERIALIZER.url("child_resource_name", child_resource_name, 'str'),
|
||||
}
|
||||
|
||||
_url = _format_url_section(_url, **path_format_arguments)
|
||||
|
||||
# Construct parameters
|
||||
_query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any]
|
||||
_query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str')
|
||||
|
||||
# Construct headers
|
||||
_header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any]
|
||||
if content_type is not None:
|
||||
_header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str')
|
||||
_header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str')
|
||||
|
||||
return HttpRequest(
|
||||
method="PATCH",
|
||||
url=_url,
|
||||
params=_query_parameters,
|
||||
headers=_header_parameters,
|
||||
**kwargs
|
||||
)
|
||||
|
||||
# fmt: on
|
||||
class SyncIdentityProvidersOperations(object):
|
||||
"""SyncIdentityProvidersOperations operations.
|
||||
|
||||
You should not instantiate this class directly. Instead, you should create a Client instance that
|
||||
instantiates it for you and attaches it as an attribute.
|
||||
|
||||
:ivar models: Alias to model classes used in this operation group.
|
||||
:type models: ~azure.mgmt.redhatopenshift.v2022_09_04.models
|
||||
:param client: Client for service requests.
|
||||
:param config: Configuration of service client.
|
||||
:param serializer: An object model serializer.
|
||||
:param deserializer: An object model deserializer.
|
||||
"""
|
||||
|
||||
models = _models
|
||||
|
||||
def __init__(self, client, config, serializer, deserializer):
|
||||
self._client = client
|
||||
self._serialize = serializer
|
||||
self._deserialize = deserializer
|
||||
self._config = config
|
||||
|
||||
@distributed_trace
|
||||
def list(
|
||||
self,
|
||||
resource_group_name, # type: str
|
||||
resource_name, # type: str
|
||||
**kwargs # type: Any
|
||||
):
|
||||
# type: (...) -> Iterable["_models.SyncIdentityProviderList"]
|
||||
"""Lists SyncIdentityProviders that belong to that Azure Red Hat OpenShift Cluster.
|
||||
|
||||
The operation returns properties of each SyncIdentityProvider.
|
||||
|
||||
:param resource_group_name: The name of the resource group. The name is case insensitive.
|
||||
:type resource_group_name: str
|
||||
:param resource_name: The name of the OpenShift cluster resource.
|
||||
:type resource_name: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:return: An iterator like instance of either SyncIdentityProviderList or the result of
|
||||
cls(response)
|
||||
:rtype:
|
||||
~azure.core.paging.ItemPaged[~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncIdentityProviderList]
|
||||
:raises: ~azure.core.exceptions.HttpResponseError
|
||||
"""
|
||||
api_version = kwargs.pop('api_version', "2022-09-04") # type: str
|
||||
|
||||
cls = kwargs.pop('cls', None) # type: ClsType["_models.SyncIdentityProviderList"]
|
||||
error_map = {
|
||||
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
|
||||
}
|
||||
error_map.update(kwargs.pop('error_map', {}))
|
||||
def prepare_request(next_link=None):
|
||||
if not next_link:
|
||||
|
||||
request = build_list_request(
|
||||
subscription_id=self._config.subscription_id,
|
||||
resource_group_name=resource_group_name,
|
||||
resource_name=resource_name,
|
||||
api_version=api_version,
|
||||
template_url=self.list.metadata['url'],
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
|
||||
else:
|
||||
|
||||
request = build_list_request(
|
||||
subscription_id=self._config.subscription_id,
|
||||
resource_group_name=resource_group_name,
|
||||
resource_name=resource_name,
|
||||
api_version=api_version,
|
||||
template_url=next_link,
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
request.method = "GET"
|
||||
return request
|
||||
|
||||
def extract_data(pipeline_response):
|
||||
deserialized = self._deserialize("SyncIdentityProviderList", pipeline_response)
|
||||
list_of_elem = deserialized.value
|
||||
if cls:
|
||||
list_of_elem = cls(list_of_elem)
|
||||
return deserialized.next_link or None, iter(list_of_elem)
|
||||
|
||||
def get_next(next_link=None):
|
||||
request = prepare_request(next_link)
|
||||
|
||||
pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access
|
||||
request,
|
||||
stream=False,
|
||||
**kwargs
|
||||
)
|
||||
response = pipeline_response.http_response
|
||||
|
||||
if response.status_code not in [200]:
|
||||
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
||||
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
|
||||
|
||||
return pipeline_response
|
||||
|
||||
|
||||
return ItemPaged(
|
||||
get_next, extract_data
|
||||
)
|
||||
list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftCluster/{resourceName}/syncIdentityProviders"} # type: ignore
|
||||
|
||||
@distributed_trace
|
||||
def get(
|
||||
self,
|
||||
resource_group_name, # type: str
|
||||
resource_name, # type: str
|
||||
child_resource_name, # type: str
|
||||
**kwargs # type: Any
|
||||
):
|
||||
# type: (...) -> "_models.SyncIdentityProvider"
|
||||
"""Gets a SyncIdentityProvider with the specified subscription, resource group and resource name.
|
||||
|
||||
The operation returns properties of a SyncIdentityProvider.
|
||||
|
||||
:param resource_group_name: The name of the resource group. The name is case insensitive.
|
||||
:type resource_group_name: str
|
||||
:param resource_name: The name of the OpenShift cluster resource.
|
||||
:type resource_name: str
|
||||
:param child_resource_name: The name of the SyncIdentityProvider resource.
|
||||
:type child_resource_name: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:return: SyncIdentityProvider, or the result of cls(response)
|
||||
:rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncIdentityProvider
|
||||
:raises: ~azure.core.exceptions.HttpResponseError
|
||||
"""
|
||||
cls = kwargs.pop('cls', None) # type: ClsType["_models.SyncIdentityProvider"]
|
||||
error_map = {
|
||||
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
|
||||
}
|
||||
error_map.update(kwargs.pop('error_map', {}))
|
||||
|
||||
api_version = kwargs.pop('api_version', "2022-09-04") # type: str
|
||||
|
||||
|
||||
request = build_get_request(
|
||||
subscription_id=self._config.subscription_id,
|
||||
resource_group_name=resource_group_name,
|
||||
resource_name=resource_name,
|
||||
child_resource_name=child_resource_name,
|
||||
api_version=api_version,
|
||||
template_url=self.get.metadata['url'],
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
|
||||
pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access
|
||||
request,
|
||||
stream=False,
|
||||
**kwargs
|
||||
)
|
||||
response = pipeline_response.http_response
|
||||
|
||||
if response.status_code not in [200]:
|
||||
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
||||
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
|
||||
|
||||
deserialized = self._deserialize('SyncIdentityProvider', pipeline_response)
|
||||
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, {})
|
||||
|
||||
return deserialized
|
||||
|
||||
get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/syncIdentityProvider/{childResourceName}"} # type: ignore
|
||||
|
||||
|
||||
@distributed_trace
|
||||
def create_or_update(
|
||||
self,
|
||||
resource_group_name, # type: str
|
||||
resource_name, # type: str
|
||||
child_resource_name, # type: str
|
||||
parameters, # type: "_models.SyncIdentityProvider"
|
||||
**kwargs # type: Any
|
||||
):
|
||||
# type: (...) -> "_models.SyncIdentityProvider"
|
||||
"""Creates or updates a SyncIdentityProvider with the specified subscription, resource group and
|
||||
resource name.
|
||||
|
||||
The operation returns properties of a SyncIdentityProvider.
|
||||
|
||||
:param resource_group_name: The name of the resource group. The name is case insensitive.
|
||||
:type resource_group_name: str
|
||||
:param resource_name: The name of the OpenShift cluster resource.
|
||||
:type resource_name: str
|
||||
:param child_resource_name: The name of the SyncIdentityProvider resource.
|
||||
:type child_resource_name: str
|
||||
:param parameters: The SyncIdentityProvider resource.
|
||||
:type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncIdentityProvider
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:return: SyncIdentityProvider, or the result of cls(response)
|
||||
:rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncIdentityProvider
|
||||
:raises: ~azure.core.exceptions.HttpResponseError
|
||||
"""
|
||||
cls = kwargs.pop('cls', None) # type: ClsType["_models.SyncIdentityProvider"]
|
||||
error_map = {
|
||||
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
|
||||
}
|
||||
error_map.update(kwargs.pop('error_map', {}))
|
||||
|
||||
api_version = kwargs.pop('api_version', "2022-09-04") # type: str
|
||||
content_type = kwargs.pop('content_type', "application/json") # type: Optional[str]
|
||||
|
||||
_json = self._serialize.body(parameters, 'SyncIdentityProvider')
|
||||
|
||||
request = build_create_or_update_request(
|
||||
subscription_id=self._config.subscription_id,
|
||||
resource_group_name=resource_group_name,
|
||||
resource_name=resource_name,
|
||||
child_resource_name=child_resource_name,
|
||||
api_version=api_version,
|
||||
content_type=content_type,
|
||||
json=_json,
|
||||
template_url=self.create_or_update.metadata['url'],
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
|
||||
pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access
|
||||
request,
|
||||
stream=False,
|
||||
**kwargs
|
||||
)
|
||||
response = pipeline_response.http_response
|
||||
|
||||
if response.status_code not in [200, 201]:
|
||||
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
||||
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
|
||||
|
||||
if response.status_code == 200:
|
||||
deserialized = self._deserialize('SyncIdentityProvider', pipeline_response)
|
||||
|
||||
if response.status_code == 201:
|
||||
deserialized = self._deserialize('SyncIdentityProvider', pipeline_response)
|
||||
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, {})
|
||||
|
||||
return deserialized
|
||||
|
||||
create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/syncIdentityProvider/{childResourceName}"} # type: ignore
|
||||
|
||||
|
||||
@distributed_trace
|
||||
def delete( # pylint: disable=inconsistent-return-statements
|
||||
self,
|
||||
resource_group_name, # type: str
|
||||
resource_name, # type: str
|
||||
child_resource_name, # type: str
|
||||
**kwargs # type: Any
|
||||
):
|
||||
# type: (...) -> None
|
||||
"""Deletes a SyncIdentityProvider with the specified subscription, resource group and resource
|
||||
name.
|
||||
|
||||
The operation returns nothing.
|
||||
|
||||
:param resource_group_name: The name of the resource group. The name is case insensitive.
|
||||
:type resource_group_name: str
|
||||
:param resource_name: The name of the OpenShift cluster resource.
|
||||
:type resource_name: str
|
||||
:param child_resource_name: The name of the SyncIdentityProvider resource.
|
||||
:type child_resource_name: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:return: None, or the result of cls(response)
|
||||
:rtype: None
|
||||
:raises: ~azure.core.exceptions.HttpResponseError
|
||||
"""
|
||||
cls = kwargs.pop('cls', None) # type: ClsType[None]
|
||||
error_map = {
|
||||
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
|
||||
}
|
||||
error_map.update(kwargs.pop('error_map', {}))
|
||||
|
||||
api_version = kwargs.pop('api_version', "2022-09-04") # type: str
|
||||
|
||||
|
||||
request = build_delete_request(
|
||||
subscription_id=self._config.subscription_id,
|
||||
resource_group_name=resource_group_name,
|
||||
resource_name=resource_name,
|
||||
child_resource_name=child_resource_name,
|
||||
api_version=api_version,
|
||||
template_url=self.delete.metadata['url'],
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
|
||||
pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access
|
||||
request,
|
||||
stream=False,
|
||||
**kwargs
|
||||
)
|
||||
response = pipeline_response.http_response
|
||||
|
||||
if response.status_code not in [200, 204]:
|
||||
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
||||
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
|
||||
|
||||
if cls:
|
||||
return cls(pipeline_response, None, {})
|
||||
|
||||
delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/syncIdentityProvider/{childResourceName}"} # type: ignore
|
||||
|
||||
|
||||
@distributed_trace
|
||||
def update(
|
||||
self,
|
||||
resource_group_name, # type: str
|
||||
resource_name, # type: str
|
||||
child_resource_name, # type: str
|
||||
parameters, # type: "_models.SyncIdentityProviderUpdate"
|
||||
**kwargs # type: Any
|
||||
):
|
||||
# type: (...) -> "_models.SyncIdentityProvider"
|
||||
"""Patches (create or update) a SyncIdentityProvider with the specified subscription, resource
|
||||
group and resource name.
|
||||
|
||||
The operation returns properties of a SyncIdentityProvider.
|
||||
|
||||
:param resource_group_name: The name of the resource group. The name is case insensitive.
|
||||
:type resource_group_name: str
|
||||
:param resource_name: The name of the OpenShift cluster resource.
|
||||
:type resource_name: str
|
||||
:param child_resource_name: The name of the SyncIdentityProvider resource.
|
||||
:type child_resource_name: str
|
||||
:param parameters: The SyncIdentityProvider resource.
|
||||
:type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncIdentityProviderUpdate
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:return: SyncIdentityProvider, or the result of cls(response)
|
||||
:rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncIdentityProvider
|
||||
:raises: ~azure.core.exceptions.HttpResponseError
|
||||
"""
|
||||
cls = kwargs.pop('cls', None) # type: ClsType["_models.SyncIdentityProvider"]
|
||||
error_map = {
|
||||
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
|
||||
}
|
||||
error_map.update(kwargs.pop('error_map', {}))
|
||||
|
||||
api_version = kwargs.pop('api_version', "2022-09-04") # type: str
|
||||
content_type = kwargs.pop('content_type', "application/json") # type: Optional[str]
|
||||
|
||||
_json = self._serialize.body(parameters, 'SyncIdentityProviderUpdate')
|
||||
|
||||
request = build_update_request(
|
||||
subscription_id=self._config.subscription_id,
|
||||
resource_group_name=resource_group_name,
|
||||
resource_name=resource_name,
|
||||
child_resource_name=child_resource_name,
|
||||
api_version=api_version,
|
||||
content_type=content_type,
|
||||
json=_json,
|
||||
template_url=self.update.metadata['url'],
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
|
||||
pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access
|
||||
request,
|
||||
stream=False,
|
||||
**kwargs
|
||||
)
|
||||
response = pipeline_response.http_response
|
||||
|
||||
if response.status_code not in [200, 201]:
|
||||
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
||||
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
|
||||
|
||||
if response.status_code == 200:
|
||||
deserialized = self._deserialize('SyncIdentityProvider', pipeline_response)
|
||||
|
||||
if response.status_code == 201:
|
||||
deserialized = self._deserialize('SyncIdentityProvider', pipeline_response)
|
||||
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, {})
|
||||
|
||||
return deserialized
|
||||
|
||||
update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/syncIdentityProvider/{childResourceName}"} # type: ignore
|
||||
|
|
@ -0,0 +1,625 @@
|
|||
# pylint: disable=too-many-lines
|
||||
# coding=utf-8
|
||||
# --------------------------------------------------------------------------
|
||||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
# --------------------------------------------------------------------------
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from msrest import Serializer
|
||||
|
||||
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
|
||||
from azure.core.paging import ItemPaged
|
||||
from azure.core.pipeline import PipelineResponse
|
||||
from azure.core.pipeline.transport import HttpResponse
|
||||
from azure.core.rest import HttpRequest
|
||||
from azure.core.tracing.decorator import distributed_trace
|
||||
from azure.mgmt.core.exceptions import ARMErrorFormat
|
||||
|
||||
from .. import models as _models
|
||||
from .._vendor import _convert_request, _format_url_section
|
||||
|
||||
if TYPE_CHECKING:
|
||||
# pylint: disable=unused-import,ungrouped-imports
|
||||
from typing import Any, Callable, Dict, Iterable, Optional, TypeVar
|
||||
T = TypeVar('T')
|
||||
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
|
||||
|
||||
_SERIALIZER = Serializer()
|
||||
_SERIALIZER.client_side_validation = False
|
||||
# fmt: off
|
||||
|
||||
def build_list_request(
|
||||
subscription_id, # type: str
|
||||
resource_group_name, # type: str
|
||||
resource_name, # type: str
|
||||
**kwargs # type: Any
|
||||
):
|
||||
# type: (...) -> HttpRequest
|
||||
api_version = kwargs.pop('api_version', "2022-09-04") # type: str
|
||||
|
||||
accept = "application/json"
|
||||
# Construct URL
|
||||
_url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftCluster/{resourceName}/syncSets") # pylint: disable=line-too-long
|
||||
path_format_arguments = {
|
||||
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1),
|
||||
"resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1),
|
||||
"resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'),
|
||||
}
|
||||
|
||||
_url = _format_url_section(_url, **path_format_arguments)
|
||||
|
||||
# Construct parameters
|
||||
_query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any]
|
||||
_query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str')
|
||||
|
||||
# Construct headers
|
||||
_header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any]
|
||||
_header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str')
|
||||
|
||||
return HttpRequest(
|
||||
method="GET",
|
||||
url=_url,
|
||||
params=_query_parameters,
|
||||
headers=_header_parameters,
|
||||
**kwargs
|
||||
)
|
||||
|
||||
|
||||
def build_get_request(
|
||||
subscription_id, # type: str
|
||||
resource_group_name, # type: str
|
||||
resource_name, # type: str
|
||||
child_resource_name, # type: str
|
||||
**kwargs # type: Any
|
||||
):
|
||||
# type: (...) -> HttpRequest
|
||||
api_version = kwargs.pop('api_version', "2022-09-04") # type: str
|
||||
|
||||
accept = "application/json"
|
||||
# Construct URL
|
||||
_url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/syncSet/{childResourceName}") # pylint: disable=line-too-long
|
||||
path_format_arguments = {
|
||||
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1),
|
||||
"resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1),
|
||||
"resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'),
|
||||
"childResourceName": _SERIALIZER.url("child_resource_name", child_resource_name, 'str'),
|
||||
}
|
||||
|
||||
_url = _format_url_section(_url, **path_format_arguments)
|
||||
|
||||
# Construct parameters
|
||||
_query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any]
|
||||
_query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str')
|
||||
|
||||
# Construct headers
|
||||
_header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any]
|
||||
_header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str')
|
||||
|
||||
return HttpRequest(
|
||||
method="GET",
|
||||
url=_url,
|
||||
params=_query_parameters,
|
||||
headers=_header_parameters,
|
||||
**kwargs
|
||||
)
|
||||
|
||||
|
||||
def build_create_or_update_request(
|
||||
subscription_id, # type: str
|
||||
resource_group_name, # type: str
|
||||
resource_name, # type: str
|
||||
child_resource_name, # type: str
|
||||
**kwargs # type: Any
|
||||
):
|
||||
# type: (...) -> HttpRequest
|
||||
api_version = kwargs.pop('api_version', "2022-09-04") # type: str
|
||||
content_type = kwargs.pop('content_type', None) # type: Optional[str]
|
||||
|
||||
accept = "application/json"
|
||||
# Construct URL
|
||||
_url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/syncSet/{childResourceName}") # pylint: disable=line-too-long
|
||||
path_format_arguments = {
|
||||
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1),
|
||||
"resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1),
|
||||
"resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'),
|
||||
"childResourceName": _SERIALIZER.url("child_resource_name", child_resource_name, 'str'),
|
||||
}
|
||||
|
||||
_url = _format_url_section(_url, **path_format_arguments)
|
||||
|
||||
# Construct parameters
|
||||
_query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any]
|
||||
_query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str')
|
||||
|
||||
# Construct headers
|
||||
_header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any]
|
||||
if content_type is not None:
|
||||
_header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str')
|
||||
_header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str')
|
||||
|
||||
return HttpRequest(
|
||||
method="PUT",
|
||||
url=_url,
|
||||
params=_query_parameters,
|
||||
headers=_header_parameters,
|
||||
**kwargs
|
||||
)
|
||||
|
||||
|
||||
def build_delete_request(
|
||||
subscription_id, # type: str
|
||||
resource_group_name, # type: str
|
||||
resource_name, # type: str
|
||||
child_resource_name, # type: str
|
||||
**kwargs # type: Any
|
||||
):
|
||||
# type: (...) -> HttpRequest
|
||||
api_version = kwargs.pop('api_version', "2022-09-04") # type: str
|
||||
|
||||
accept = "application/json"
|
||||
# Construct URL
|
||||
_url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/syncSet/{childResourceName}") # pylint: disable=line-too-long
|
||||
path_format_arguments = {
|
||||
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1),
|
||||
"resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1),
|
||||
"resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'),
|
||||
"childResourceName": _SERIALIZER.url("child_resource_name", child_resource_name, 'str'),
|
||||
}
|
||||
|
||||
_url = _format_url_section(_url, **path_format_arguments)
|
||||
|
||||
# Construct parameters
|
||||
_query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any]
|
||||
_query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str')
|
||||
|
||||
# Construct headers
|
||||
_header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any]
|
||||
_header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str')
|
||||
|
||||
return HttpRequest(
|
||||
method="DELETE",
|
||||
url=_url,
|
||||
params=_query_parameters,
|
||||
headers=_header_parameters,
|
||||
**kwargs
|
||||
)
|
||||
|
||||
|
||||
def build_update_request(
|
||||
subscription_id, # type: str
|
||||
resource_group_name, # type: str
|
||||
resource_name, # type: str
|
||||
child_resource_name, # type: str
|
||||
**kwargs # type: Any
|
||||
):
|
||||
# type: (...) -> HttpRequest
|
||||
api_version = kwargs.pop('api_version', "2022-09-04") # type: str
|
||||
content_type = kwargs.pop('content_type', None) # type: Optional[str]
|
||||
|
||||
accept = "application/json"
|
||||
# Construct URL
|
||||
_url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/syncSet/{childResourceName}") # pylint: disable=line-too-long
|
||||
path_format_arguments = {
|
||||
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1),
|
||||
"resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1),
|
||||
"resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'),
|
||||
"childResourceName": _SERIALIZER.url("child_resource_name", child_resource_name, 'str'),
|
||||
}
|
||||
|
||||
_url = _format_url_section(_url, **path_format_arguments)
|
||||
|
||||
# Construct parameters
|
||||
_query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any]
|
||||
_query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str')
|
||||
|
||||
# Construct headers
|
||||
_header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any]
|
||||
if content_type is not None:
|
||||
_header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str')
|
||||
_header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str')
|
||||
|
||||
return HttpRequest(
|
||||
method="PATCH",
|
||||
url=_url,
|
||||
params=_query_parameters,
|
||||
headers=_header_parameters,
|
||||
**kwargs
|
||||
)
|
||||
|
||||
# fmt: on
|
||||
class SyncSetsOperations(object):
|
||||
"""SyncSetsOperations operations.
|
||||
|
||||
You should not instantiate this class directly. Instead, you should create a Client instance that
|
||||
instantiates it for you and attaches it as an attribute.
|
||||
|
||||
:ivar models: Alias to model classes used in this operation group.
|
||||
:type models: ~azure.mgmt.redhatopenshift.v2022_09_04.models
|
||||
:param client: Client for service requests.
|
||||
:param config: Configuration of service client.
|
||||
:param serializer: An object model serializer.
|
||||
:param deserializer: An object model deserializer.
|
||||
"""
|
||||
|
||||
models = _models
|
||||
|
||||
def __init__(self, client, config, serializer, deserializer):
|
||||
self._client = client
|
||||
self._serialize = serializer
|
||||
self._deserialize = deserializer
|
||||
self._config = config
|
||||
|
||||
@distributed_trace
|
||||
def list(
|
||||
self,
|
||||
resource_group_name, # type: str
|
||||
resource_name, # type: str
|
||||
**kwargs # type: Any
|
||||
):
|
||||
# type: (...) -> Iterable["_models.SyncSetList"]
|
||||
"""Lists SyncSets that belong to that Azure Red Hat OpenShift Cluster.
|
||||
|
||||
The operation returns properties of each SyncSet.
|
||||
|
||||
:param resource_group_name: The name of the resource group. The name is case insensitive.
|
||||
:type resource_group_name: str
|
||||
:param resource_name: The name of the OpenShift cluster resource.
|
||||
:type resource_name: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:return: An iterator like instance of either SyncSetList or the result of cls(response)
|
||||
:rtype:
|
||||
~azure.core.paging.ItemPaged[~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncSetList]
|
||||
:raises: ~azure.core.exceptions.HttpResponseError
|
||||
"""
|
||||
api_version = kwargs.pop('api_version', "2022-09-04") # type: str
|
||||
|
||||
cls = kwargs.pop('cls', None) # type: ClsType["_models.SyncSetList"]
|
||||
error_map = {
|
||||
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
|
||||
}
|
||||
error_map.update(kwargs.pop('error_map', {}))
|
||||
def prepare_request(next_link=None):
|
||||
if not next_link:
|
||||
|
||||
request = build_list_request(
|
||||
subscription_id=self._config.subscription_id,
|
||||
resource_group_name=resource_group_name,
|
||||
resource_name=resource_name,
|
||||
api_version=api_version,
|
||||
template_url=self.list.metadata['url'],
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
|
||||
else:
|
||||
|
||||
request = build_list_request(
|
||||
subscription_id=self._config.subscription_id,
|
||||
resource_group_name=resource_group_name,
|
||||
resource_name=resource_name,
|
||||
api_version=api_version,
|
||||
template_url=next_link,
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
request.method = "GET"
|
||||
return request
|
||||
|
||||
def extract_data(pipeline_response):
|
||||
deserialized = self._deserialize("SyncSetList", pipeline_response)
|
||||
list_of_elem = deserialized.value
|
||||
if cls:
|
||||
list_of_elem = cls(list_of_elem)
|
||||
return deserialized.next_link or None, iter(list_of_elem)
|
||||
|
||||
def get_next(next_link=None):
|
||||
request = prepare_request(next_link)
|
||||
|
||||
pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access
|
||||
request,
|
||||
stream=False,
|
||||
**kwargs
|
||||
)
|
||||
response = pipeline_response.http_response
|
||||
|
||||
if response.status_code not in [200]:
|
||||
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
||||
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
|
||||
|
||||
return pipeline_response
|
||||
|
||||
|
||||
return ItemPaged(
|
||||
get_next, extract_data
|
||||
)
|
||||
list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftCluster/{resourceName}/syncSets"} # type: ignore
|
||||
|
||||
@distributed_trace
|
||||
def get(
|
||||
self,
|
||||
resource_group_name, # type: str
|
||||
resource_name, # type: str
|
||||
child_resource_name, # type: str
|
||||
**kwargs # type: Any
|
||||
):
|
||||
# type: (...) -> "_models.SyncSet"
|
||||
"""Gets a SyncSet with the specified subscription, resource group and resource name.
|
||||
|
||||
The operation returns properties of a SyncSet.
|
||||
|
||||
:param resource_group_name: The name of the resource group. The name is case insensitive.
|
||||
:type resource_group_name: str
|
||||
:param resource_name: The name of the OpenShift cluster resource.
|
||||
:type resource_name: str
|
||||
:param child_resource_name: The name of the SyncSet resource.
|
||||
:type child_resource_name: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:return: SyncSet, or the result of cls(response)
|
||||
:rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncSet
|
||||
:raises: ~azure.core.exceptions.HttpResponseError
|
||||
"""
|
||||
cls = kwargs.pop('cls', None) # type: ClsType["_models.SyncSet"]
|
||||
error_map = {
|
||||
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
|
||||
}
|
||||
error_map.update(kwargs.pop('error_map', {}))
|
||||
|
||||
api_version = kwargs.pop('api_version', "2022-09-04") # type: str
|
||||
|
||||
|
||||
request = build_get_request(
|
||||
subscription_id=self._config.subscription_id,
|
||||
resource_group_name=resource_group_name,
|
||||
resource_name=resource_name,
|
||||
child_resource_name=child_resource_name,
|
||||
api_version=api_version,
|
||||
template_url=self.get.metadata['url'],
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
|
||||
pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access
|
||||
request,
|
||||
stream=False,
|
||||
**kwargs
|
||||
)
|
||||
response = pipeline_response.http_response
|
||||
|
||||
if response.status_code not in [200]:
|
||||
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
||||
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
|
||||
|
||||
deserialized = self._deserialize('SyncSet', pipeline_response)
|
||||
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, {})
|
||||
|
||||
return deserialized
|
||||
|
||||
get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/syncSet/{childResourceName}"} # type: ignore
|
||||
|
||||
|
||||
@distributed_trace
|
||||
def create_or_update(
|
||||
self,
|
||||
resource_group_name, # type: str
|
||||
resource_name, # type: str
|
||||
child_resource_name, # type: str
|
||||
parameters, # type: "_models.SyncSet"
|
||||
**kwargs # type: Any
|
||||
):
|
||||
# type: (...) -> "_models.SyncSet"
|
||||
"""Creates or updates a SyncSet with the specified subscription, resource group and resource name.
|
||||
|
||||
The operation returns properties of a SyncSet.
|
||||
|
||||
:param resource_group_name: The name of the resource group. The name is case insensitive.
|
||||
:type resource_group_name: str
|
||||
:param resource_name: The name of the OpenShift cluster resource.
|
||||
:type resource_name: str
|
||||
:param child_resource_name: The name of the SyncSet resource.
|
||||
:type child_resource_name: str
|
||||
:param parameters: The SyncSet resource.
|
||||
:type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncSet
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:return: SyncSet, or the result of cls(response)
|
||||
:rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncSet
|
||||
:raises: ~azure.core.exceptions.HttpResponseError
|
||||
"""
|
||||
cls = kwargs.pop('cls', None) # type: ClsType["_models.SyncSet"]
|
||||
error_map = {
|
||||
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
|
||||
}
|
||||
error_map.update(kwargs.pop('error_map', {}))
|
||||
|
||||
api_version = kwargs.pop('api_version', "2022-09-04") # type: str
|
||||
content_type = kwargs.pop('content_type', "application/json") # type: Optional[str]
|
||||
|
||||
_json = self._serialize.body(parameters, 'SyncSet')
|
||||
|
||||
request = build_create_or_update_request(
|
||||
subscription_id=self._config.subscription_id,
|
||||
resource_group_name=resource_group_name,
|
||||
resource_name=resource_name,
|
||||
child_resource_name=child_resource_name,
|
||||
api_version=api_version,
|
||||
content_type=content_type,
|
||||
json=_json,
|
||||
template_url=self.create_or_update.metadata['url'],
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
|
||||
pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access
|
||||
request,
|
||||
stream=False,
|
||||
**kwargs
|
||||
)
|
||||
response = pipeline_response.http_response
|
||||
|
||||
if response.status_code not in [200, 201]:
|
||||
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
||||
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
|
||||
|
||||
if response.status_code == 200:
|
||||
deserialized = self._deserialize('SyncSet', pipeline_response)
|
||||
|
||||
if response.status_code == 201:
|
||||
deserialized = self._deserialize('SyncSet', pipeline_response)
|
||||
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, {})
|
||||
|
||||
return deserialized
|
||||
|
||||
create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/syncSet/{childResourceName}"} # type: ignore
|
||||
|
||||
|
||||
@distributed_trace
|
||||
def delete( # pylint: disable=inconsistent-return-statements
|
||||
self,
|
||||
resource_group_name, # type: str
|
||||
resource_name, # type: str
|
||||
child_resource_name, # type: str
|
||||
**kwargs # type: Any
|
||||
):
|
||||
# type: (...) -> None
|
||||
"""Deletes a SyncSet with the specified subscription, resource group and resource name.
|
||||
|
||||
The operation returns nothing.
|
||||
|
||||
:param resource_group_name: The name of the resource group. The name is case insensitive.
|
||||
:type resource_group_name: str
|
||||
:param resource_name: The name of the OpenShift cluster resource.
|
||||
:type resource_name: str
|
||||
:param child_resource_name: The name of the SyncSet resource.
|
||||
:type child_resource_name: str
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:return: None, or the result of cls(response)
|
||||
:rtype: None
|
||||
:raises: ~azure.core.exceptions.HttpResponseError
|
||||
"""
|
||||
cls = kwargs.pop('cls', None) # type: ClsType[None]
|
||||
error_map = {
|
||||
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
|
||||
}
|
||||
error_map.update(kwargs.pop('error_map', {}))
|
||||
|
||||
api_version = kwargs.pop('api_version', "2022-09-04") # type: str
|
||||
|
||||
|
||||
request = build_delete_request(
|
||||
subscription_id=self._config.subscription_id,
|
||||
resource_group_name=resource_group_name,
|
||||
resource_name=resource_name,
|
||||
child_resource_name=child_resource_name,
|
||||
api_version=api_version,
|
||||
template_url=self.delete.metadata['url'],
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
|
||||
pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access
|
||||
request,
|
||||
stream=False,
|
||||
**kwargs
|
||||
)
|
||||
response = pipeline_response.http_response
|
||||
|
||||
if response.status_code not in [200, 204]:
|
||||
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
||||
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
|
||||
|
||||
if cls:
|
||||
return cls(pipeline_response, None, {})
|
||||
|
||||
delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/syncSet/{childResourceName}"} # type: ignore
|
||||
|
||||
|
||||
@distributed_trace
|
||||
def update(
|
||||
self,
|
||||
resource_group_name, # type: str
|
||||
resource_name, # type: str
|
||||
child_resource_name, # type: str
|
||||
parameters, # type: "_models.SyncSetUpdate"
|
||||
**kwargs # type: Any
|
||||
):
|
||||
# type: (...) -> "_models.SyncSet"
|
||||
"""Patches (create or update) a SyncSet with the specified subscription, resource group and
|
||||
resource name.
|
||||
|
||||
The operation returns properties of a SyncSet.
|
||||
|
||||
:param resource_group_name: The name of the resource group. The name is case insensitive.
|
||||
:type resource_group_name: str
|
||||
:param resource_name: The name of the OpenShift cluster resource.
|
||||
:type resource_name: str
|
||||
:param child_resource_name: The name of the SyncSet resource.
|
||||
:type child_resource_name: str
|
||||
:param parameters: The SyncSet resource.
|
||||
:type parameters: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncSetUpdate
|
||||
:keyword callable cls: A custom type or function that will be passed the direct response
|
||||
:return: SyncSet, or the result of cls(response)
|
||||
:rtype: ~azure.mgmt.redhatopenshift.v2022_09_04.models.SyncSet
|
||||
:raises: ~azure.core.exceptions.HttpResponseError
|
||||
"""
|
||||
cls = kwargs.pop('cls', None) # type: ClsType["_models.SyncSet"]
|
||||
error_map = {
|
||||
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
|
||||
}
|
||||
error_map.update(kwargs.pop('error_map', {}))
|
||||
|
||||
api_version = kwargs.pop('api_version', "2022-09-04") # type: str
|
||||
content_type = kwargs.pop('content_type', "application/json") # type: Optional[str]
|
||||
|
||||
_json = self._serialize.body(parameters, 'SyncSetUpdate')
|
||||
|
||||
request = build_update_request(
|
||||
subscription_id=self._config.subscription_id,
|
||||
resource_group_name=resource_group_name,
|
||||
resource_name=resource_name,
|
||||
child_resource_name=child_resource_name,
|
||||
api_version=api_version,
|
||||
content_type=content_type,
|
||||
json=_json,
|
||||
template_url=self.update.metadata['url'],
|
||||
)
|
||||
request = _convert_request(request)
|
||||
request.url = self._client.format_url(request.url)
|
||||
|
||||
pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access
|
||||
request,
|
||||
stream=False,
|
||||
**kwargs
|
||||
)
|
||||
response = pipeline_response.http_response
|
||||
|
||||
if response.status_code not in [200, 201]:
|
||||
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
||||
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
|
||||
|
||||
if response.status_code == 200:
|
||||
deserialized = self._deserialize('SyncSet', pipeline_response)
|
||||
|
||||
if response.status_code == 201:
|
||||
deserialized = self._deserialize('SyncSet', pipeline_response)
|
||||
|
||||
if cls:
|
||||
return cls(pipeline_response, deserialized, {})
|
||||
|
||||
return deserialized
|
||||
|
||||
update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/syncSet/{childResourceName}"} # type: ignore
|
||||
|
|
@ -71,7 +71,7 @@
|
|||
"provisioningState": "Succeeded",
|
||||
"clusterProfile": {
|
||||
"domain": "cluster.location.aroapp.io",
|
||||
"version": "4.3.0",
|
||||
"version": "4.11.0",
|
||||
"resourceGroupId": "/subscriptions/subscriptionId/resourceGroups/clusterResourceGroup"
|
||||
},
|
||||
"consoleProfile": {
|
||||
|
@ -133,7 +133,7 @@
|
|||
"provisioningState": "Succeeded",
|
||||
"clusterProfile": {
|
||||
"domain": "cluster.location.aroapp.io",
|
||||
"version": "4.3.0",
|
||||
"version": "4.11.0",
|
||||
"resourceGroupId": "/subscriptions/subscriptionId/resourceGroups/clusterResourceGroup"
|
||||
},
|
||||
"consoleProfile": {
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
"provisioningState": "Succeeded",
|
||||
"clusterProfile": {
|
||||
"domain": "cluster.location.aroapp.io",
|
||||
"version": "4.3.0",
|
||||
"version": "4.11.0",
|
||||
"resourceGroupId": "/subscriptions/subscriptionId/resourceGroups/clusterResourceGroup"
|
||||
},
|
||||
"consoleProfile": {
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
"provisioningState": "Succeeded",
|
||||
"clusterProfile": {
|
||||
"domain": "cluster.location.aroapp.io",
|
||||
"version": "4.3.0",
|
||||
"version": "4.11.0",
|
||||
"resourceGroupId": "/subscriptions/subscriptionId/resourceGroups/clusterResourceGroup"
|
||||
},
|
||||
"consoleProfile": {
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
"provisioningState": "Succeeded",
|
||||
"clusterProfile": {
|
||||
"domain": "cluster.location.aroapp.io",
|
||||
"version": "4.3.0",
|
||||
"version": "4.11.0",
|
||||
"resourceGroupId": "/subscriptions/subscriptionId/resourceGroups/clusterResourceGroup"
|
||||
},
|
||||
"consoleProfile": {
|
||||
|
|
|
@ -70,7 +70,7 @@
|
|||
"provisioningState": "Succeeded",
|
||||
"clusterProfile": {
|
||||
"domain": "cluster.location.aroapp.io",
|
||||
"version": "4.3.0",
|
||||
"version": "4.11.0",
|
||||
"resourceGroupId": "/subscriptions/subscriptionId/resourceGroups/clusterResourceGroup"
|
||||
},
|
||||
"consoleProfile": {
|
||||
|
@ -132,7 +132,7 @@
|
|||
"provisioningState": "Succeeded",
|
||||
"clusterProfile": {
|
||||
"domain": "cluster.location.aroapp.io",
|
||||
"version": "4.3.0",
|
||||
"version": "4.11.0",
|
||||
"resourceGroupId": "/subscriptions/subscriptionId/resourceGroups/clusterResourceGroup"
|
||||
},
|
||||
"consoleProfile": {
|
||||
|
|
|
@ -63,7 +63,7 @@
|
|||
"provisioningState": "Succeeded",
|
||||
"clusterProfile": {
|
||||
"domain": "cluster.location.aroapp.io",
|
||||
"version": "4.3.0",
|
||||
"version": "4.11.0",
|
||||
"resourceGroupId": "/subscriptions/subscriptionId/resourceGroups/clusterResourceGroup"
|
||||
},
|
||||
"consoleProfile": {
|
||||
|
@ -117,7 +117,7 @@
|
|||
"provisioningState": "Succeeded",
|
||||
"clusterProfile": {
|
||||
"domain": "cluster.location.aroapp.io",
|
||||
"version": "4.3.0",
|
||||
"version": "4.11.0",
|
||||
"resourceGroupId": "/subscriptions/subscriptionId/resourceGroups/clusterResourceGroup"
|
||||
},
|
||||
"consoleProfile": {
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
"provisioningState": "Succeeded",
|
||||
"clusterProfile": {
|
||||
"domain": "cluster.location.aroapp.io",
|
||||
"version": "4.3.0",
|
||||
"version": "4.11.0",
|
||||
"resourceGroupId": "/subscriptions/subscriptionId/resourceGroups/clusterResourceGroup"
|
||||
},
|
||||
"consoleProfile": {
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
"provisioningState": "Succeeded",
|
||||
"clusterProfile": {
|
||||
"domain": "cluster.location.aroapp.io",
|
||||
"version": "4.3.0",
|
||||
"version": "4.11.0",
|
||||
"resourceGroupId": "/subscriptions/subscriptionId/resourceGroups/clusterResourceGroup"
|
||||
},
|
||||
"consoleProfile": {
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
"provisioningState": "Succeeded",
|
||||
"clusterProfile": {
|
||||
"domain": "cluster.location.aroapp.io",
|
||||
"version": "4.3.0",
|
||||
"version": "4.11.0",
|
||||
"resourceGroupId": "/subscriptions/subscriptionId/resourceGroups/clusterResourceGroup"
|
||||
},
|
||||
"consoleProfile": {
|
||||
|
|
|
@ -62,7 +62,7 @@
|
|||
"provisioningState": "Succeeded",
|
||||
"clusterProfile": {
|
||||
"domain": "cluster.location.aroapp.io",
|
||||
"version": "4.3.0",
|
||||
"version": "4.11.0",
|
||||
"resourceGroupId": "/subscriptions/subscriptionId/resourceGroups/clusterResourceGroup"
|
||||
},
|
||||
"consoleProfile": {
|
||||
|
@ -116,7 +116,7 @@
|
|||
"provisioningState": "Succeeded",
|
||||
"clusterProfile": {
|
||||
"domain": "cluster.location.aroapp.io",
|
||||
"version": "4.3.0",
|
||||
"version": "4.11.0",
|
||||
"resourceGroupId": "/subscriptions/subscriptionId/resourceGroups/clusterResourceGroup"
|
||||
},
|
||||
"consoleProfile": {
|
||||
|
|
|
@ -73,7 +73,7 @@
|
|||
"provisioningState": "Succeeded",
|
||||
"clusterProfile": {
|
||||
"domain": "cluster.location.aroapp.io",
|
||||
"version": "4.3.0",
|
||||
"version": "4.11.0",
|
||||
"resourceGroupId": "/subscriptions/subscriptionId/resourceGroups/clusterResourceGroup"
|
||||
},
|
||||
"consoleProfile": {
|
||||
|
@ -135,7 +135,7 @@
|
|||
"provisioningState": "Succeeded",
|
||||
"clusterProfile": {
|
||||
"domain": "cluster.location.aroapp.io",
|
||||
"version": "4.3.0",
|
||||
"version": "4.11.0",
|
||||
"resourceGroupId": "/subscriptions/subscriptionId/resourceGroups/clusterResourceGroup"
|
||||
},
|
||||
"consoleProfile": {
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
"provisioningState": "Succeeded",
|
||||
"clusterProfile": {
|
||||
"domain": "cluster.location.aroapp.io",
|
||||
"version": "4.3.0",
|
||||
"version": "4.11.0",
|
||||
"resourceGroupId": "/subscriptions/subscriptionId/resourceGroups/clusterResourceGroup"
|
||||
},
|
||||
"consoleProfile": {
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
"provisioningState": "Succeeded",
|
||||
"clusterProfile": {
|
||||
"domain": "cluster.location.aroapp.io",
|
||||
"version": "4.3.0",
|
||||
"version": "4.11.0",
|
||||
"resourceGroupId": "/subscriptions/subscriptionId/resourceGroups/clusterResourceGroup"
|
||||
},
|
||||
"consoleProfile": {
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
"provisioningState": "Succeeded",
|
||||
"clusterProfile": {
|
||||
"domain": "cluster.location.aroapp.io",
|
||||
"version": "4.3.0",
|
||||
"version": "4.11.0",
|
||||
"resourceGroupId": "/subscriptions/subscriptionId/resourceGroups/clusterResourceGroup"
|
||||
},
|
||||
"consoleProfile": {
|
||||
|
|
|
@ -72,7 +72,7 @@
|
|||
"provisioningState": "Succeeded",
|
||||
"clusterProfile": {
|
||||
"domain": "cluster.location.aroapp.io",
|
||||
"version": "4.3.0",
|
||||
"version": "4.11.0",
|
||||
"resourceGroupId": "/subscriptions/subscriptionId/resourceGroups/clusterResourceGroup"
|
||||
},
|
||||
"consoleProfile": {
|
||||
|
@ -134,7 +134,7 @@
|
|||
"provisioningState": "Succeeded",
|
||||
"clusterProfile": {
|
||||
"domain": "cluster.location.aroapp.io",
|
||||
"version": "4.3.0",
|
||||
"version": "4.11.0",
|
||||
"resourceGroupId": "/subscriptions/subscriptionId/resourceGroups/clusterResourceGroup"
|
||||
},
|
||||
"consoleProfile": {
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
{
|
||||
"parameters": {
|
||||
"api-version": "2022-09-04",
|
||||
"subscriptionId": "subscriptionId",
|
||||
"resourceGroupName": "resourceGroup",
|
||||
"resourceName": "resourceName",
|
||||
"childResourceName": "childResourceName",
|
||||
"parameters": {
|
||||
"properties": {
|
||||
"resources": "ewogICAgImFwaVZlcnNpb24iOiAiaGl2ZS5vcGVuc2hpZnQuaW8vdjEiLAogICAgImtpbmQiOiAiTWFjaGluZVBvb2wiLAogICAgIm1ldGFkYXRhIjogewogICAgICAgICJuYW1lIjogInRlc3QtY2x1c3Rlci13b3JrZXIiLAogICAgICAgICJuYW1lc3BhY2UiOiAiYXJvLWY2MGFlOGEyLWJjYTEtNDk4Ny05MDU2LVhYWFhYWFhYWFhYWCIKICAgIH0sCiAgICAic3BlYyI6IHsKICAgICAgICAiY2x1c3RlckRlcGxveW1lbnRSZWYiOiB7CiAgICAgICAgICAgICJuYW1lIjogInRlc3QtY2x1c3RlciIKICAgICAgICB9LAogICAgICAgICJuYW1lIjogIndvcmtlciIsCiAgICAgICAgInBsYXRmb3JtIjogewogICAgICAgICAgICAiYXdzIjogewogICAgICAgICAgICAgICAgInJvb3RWb2x1bWUiOiB7CiAgICAgICAgICAgICAgICAgICAgImlvcHMiOiAwLAogICAgICAgICAgICAgICAgICAgICJzaXplIjogMzAwLAogICAgICAgICAgICAgICAgICAgICJ0eXBlIjogImdwMyIKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAidHlwZSI6ICJtNS54bGFyZ2UiLAogICAgICAgICAgICAgICAgInpvbmVzIjogWwogICAgICAgICAgICAgICAgICAgICJ1cy1lYXN0LTFhIgogICAgICAgICAgICAgICAgXQogICAgICAgICAgICB9CiAgICAgICAgfSwKICAgICAgICAicmVwbGljYXMiOiAyCiAgICB9LAogICAgInN0YXR1cyI6IHsKICAgICAgICAiY29uZGl0aW9ucyI6IFsKICAgICAgICBdCiAgICB9Cn0K"
|
||||
}
|
||||
}
|
||||
},
|
||||
"responses": {
|
||||
"200": {
|
||||
"body": {
|
||||
"properties": {
|
||||
"resources": "eyAKICAiYXBpVmVyc2lvbiI6ICJoaXZlLm9wZW5zaGlmdC5pby92MSIsCiAgImtpbmQiOiAiU3luY1NldCIsCiAgIm1ldGFkYXRhIjogewogICAgIm5hbWUiOiAic2FtcGxlIiwKICAgICJuYW1lc3BhY2UiOiAiYXJvLWY2MGFlOGEyLWJjYTEtNDk4Ny05MDU2LWYyZjZhMTgzN2NhYSIKICB9LAogICJzcGVjIjogewogICAgImNsdXN0ZXJEZXBsb3ltZW50UmVmcyI6IFtdLAogICAgInJlc291cmNlcyI6IFsKICAgICAgewogICAgICAgICJhcGlWZXJzaW9uIjogInYxIiwKICAgICAgICAia2luZCI6ICJDb25maWdNYXAiLAogICAgICAgICJtZXRhZGF0YSI6IHsKICAgICAgICAgICJuYW1lIjogIm15Y29uZmlnbWFwIgogICAgICAgIH0KICAgICAgfQogICAgXQogIH0KfQo="
|
||||
}
|
||||
}
|
||||
},
|
||||
"201": {
|
||||
"body": {
|
||||
"properties": {
|
||||
"resources": "eyAKICAiYXBpVmVyc2lvbiI6ICJoaXZlLm9wZW5zaGlmdC5pby92MSIsCiAgImtpbmQiOiAiU3luY1NldCIsCiAgIm1ldGFkYXRhIjogewogICAgIm5hbWUiOiAic2FtcGxlIiwKICAgICJuYW1lc3BhY2UiOiAiYXJvLWY2MGFlOGEyLWJjYTEtNDk4Ny05MDU2LWYyZjZhMTgzN2NhYSIKICB9LAogICJzcGVjIjogewogICAgImNsdXN0ZXJEZXBsb3ltZW50UmVmcyI6IFtdLAogICAgInJlc291cmNlcyI6IFsKICAgICAgewogICAgICAgICJhcGlWZXJzaW9uIjogInYxIiwKICAgICAgICAia2luZCI6ICJDb25maWdNYXAiLAogICAgICAgICJtZXRhZGF0YSI6IHsKICAgICAgICAgICJuYW1lIjogIm15Y29uZmlnbWFwIgogICAgICAgIH0KICAgICAgfQogICAgXQogIH0KfQo="
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"parameters": {
|
||||
"api-version": "2022-09-04",
|
||||
"subscriptionId": "subscriptionId",
|
||||
"resourceGroupName": "resourceGroup",
|
||||
"resourceName": "resourceName",
|
||||
"childResourceName": "childResourceName"
|
||||
},
|
||||
"responses": {
|
||||
"200": {},
|
||||
"204": {}
|
||||
}
|
||||
}
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче