diff --git a/profiles/latest/apimanagement/mgmt/apimanagement/models.go b/profiles/latest/apimanagement/mgmt/apimanagement/models.go index 7b772d32fb4f..e33ff9e73565 100644 --- a/profiles/latest/apimanagement/mgmt/apimanagement/models.go +++ b/profiles/latest/apimanagement/mgmt/apimanagement/models.go @@ -657,6 +657,8 @@ type SchemaCollectionIterator = original.SchemaCollectionIterator type SchemaCollectionPage = original.SchemaCollectionPage type SchemaContract = original.SchemaContract type SchemaContractProperties = original.SchemaContractProperties +type SchemaCreateOrUpdateContract = original.SchemaCreateOrUpdateContract +type SchemaCreateOrUpdateProperties = original.SchemaCreateOrUpdateProperties type SchemaDocumentProperties = original.SchemaDocumentProperties type ServiceApplyNetworkConfigurationParameters = original.ServiceApplyNetworkConfigurationParameters type ServiceApplyNetworkConfigurationUpdatesFuture = original.ServiceApplyNetworkConfigurationUpdatesFuture diff --git a/profiles/preview/apimanagement/mgmt/apimanagement/models.go b/profiles/preview/apimanagement/mgmt/apimanagement/models.go index 406a9ca75889..53fd339803b5 100644 --- a/profiles/preview/apimanagement/mgmt/apimanagement/models.go +++ b/profiles/preview/apimanagement/mgmt/apimanagement/models.go @@ -657,6 +657,8 @@ type SchemaCollectionIterator = original.SchemaCollectionIterator type SchemaCollectionPage = original.SchemaCollectionPage type SchemaContract = original.SchemaContract type SchemaContractProperties = original.SchemaContractProperties +type SchemaCreateOrUpdateContract = original.SchemaCreateOrUpdateContract +type SchemaCreateOrUpdateProperties = original.SchemaCreateOrUpdateProperties type SchemaDocumentProperties = original.SchemaDocumentProperties type ServiceApplyNetworkConfigurationParameters = original.ServiceApplyNetworkConfigurationParameters type ServiceApplyNetworkConfigurationUpdatesFuture = original.ServiceApplyNetworkConfigurationUpdatesFuture diff --git a/services/apimanagement/mgmt/2019-01-01/apimanagement/apimanagementapi/interfaces.go b/services/apimanagement/mgmt/2019-01-01/apimanagement/apimanagementapi/interfaces.go index 0a0d51b15f16..b6ff993e6b07 100644 --- a/services/apimanagement/mgmt/2019-01-01/apimanagement/apimanagementapi/interfaces.go +++ b/services/apimanagement/mgmt/2019-01-01/apimanagement/apimanagementapi/interfaces.go @@ -125,7 +125,7 @@ var _ APIPolicyClientAPI = (*apimanagement.APIPolicyClient)(nil) // APISchemaClientAPI contains the set of methods on the APISchemaClient type. type APISchemaClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, apiid string, schemaID string, parameters apimanagement.SchemaContract, ifMatch string) (result apimanagement.SchemaContract, err error) + CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, apiid string, schemaID string, parameters apimanagement.SchemaCreateOrUpdateContract, ifMatch string) (result apimanagement.SchemaContract, err error) Delete(ctx context.Context, resourceGroupName string, serviceName string, apiid string, schemaID string, ifMatch string, force *bool) (result autorest.Response, err error) Get(ctx context.Context, resourceGroupName string, serviceName string, apiid string, schemaID string) (result apimanagement.SchemaContract, err error) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, apiid string, schemaID string) (result autorest.Response, err error) diff --git a/services/apimanagement/mgmt/2019-01-01/apimanagement/apischema.go b/services/apimanagement/mgmt/2019-01-01/apimanagement/apischema.go index 5bfe51657630..80c1e637f50e 100644 --- a/services/apimanagement/mgmt/2019-01-01/apimanagement/apischema.go +++ b/services/apimanagement/mgmt/2019-01-01/apimanagement/apischema.go @@ -50,7 +50,7 @@ func NewAPISchemaClientWithBaseURI(baseURI string, subscriptionID string) APISch // schemaID - schema identifier within an API. Must be unique in the current API Management service instance. // parameters - the schema contents to apply. // ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity. -func (client APISchemaClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, apiid string, schemaID string, parameters SchemaContract, ifMatch string) (result SchemaContract, err error) { +func (client APISchemaClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, apiid string, schemaID string, parameters SchemaCreateOrUpdateContract, ifMatch string) (result SchemaContract, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/APISchemaClient.CreateOrUpdate") defer func() { @@ -75,8 +75,8 @@ func (client APISchemaClient) CreateOrUpdate(ctx context.Context, resourceGroupN {Target: "schemaID", Name: validation.MinLength, Rule: 1, Chain: nil}, {Target: "schemaID", Name: validation.Pattern, Rule: `^[^*#&+:<>?]+$`, Chain: nil}}}, {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.SchemaContractProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.SchemaContractProperties.ContentType", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + Constraints: []validation.Constraint{{Target: "parameters.SchemaCreateOrUpdateProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.SchemaCreateOrUpdateProperties.ContentType", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { return result, validation.NewError("apimanagement.APISchemaClient", "CreateOrUpdate", err.Error()) } @@ -102,7 +102,7 @@ func (client APISchemaClient) CreateOrUpdate(ctx context.Context, resourceGroupN } // CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client APISchemaClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, schemaID string, parameters SchemaContract, ifMatch string) (*http.Request, error) { +func (client APISchemaClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, apiid string, schemaID string, parameters SchemaCreateOrUpdateContract, ifMatch string) (*http.Request, error) { pathParameters := map[string]interface{}{ "apiId": autorest.Encode("path", apiid), "resourceGroupName": autorest.Encode("path", resourceGroupName), diff --git a/services/apimanagement/mgmt/2019-01-01/apimanagement/models.go b/services/apimanagement/mgmt/2019-01-01/apimanagement/models.go index 0f7ca8e875b1..2e5e3a7543e1 100644 --- a/services/apimanagement/mgmt/2019-01-01/apimanagement/models.go +++ b/services/apimanagement/mgmt/2019-01-01/apimanagement/models.go @@ -9263,26 +9263,106 @@ func (sc *SchemaContract) UnmarshalJSON(body []byte) error { // SchemaContractProperties schema contract Properties. type SchemaContractProperties struct { - // ContentType - Must be a valid a media type used in a Content-Type header as defined in the RFC 2616. Media type of the schema document (e.g. application/json, application/xml). + // ContentType - Must be a valid a media type used in a Content-Type header as defined in the RFC 2616. Media type of the schema document (e.g. application/json, application/xml).
- `Swagger` Schema use `application/vnd.ms-azure-apim.swagger.definitions+json`
- `WSDL` Schema use `application/vnd.ms-azure-apim.xsd+xml`
- `OpenApi` Schema use `application/vnd.oai.openapi.components+json`
- `WADL Schema` use `application/vnd.ms-azure-apim.wadl.grammars+xml`. ContentType *string `json:"contentType,omitempty"` - // SchemaDocumentProperties - Properties of the Schema Document. + // Document - Properties of the Schema Document. + Document interface{} `json:"document,omitempty"` +} + +// SchemaCreateOrUpdateContract schema Contract details. +type SchemaCreateOrUpdateContract struct { + // SchemaCreateOrUpdateProperties - Properties of the Schema. + *SchemaCreateOrUpdateProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type for API Management resource. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for SchemaCreateOrUpdateContract. +func (scouc SchemaCreateOrUpdateContract) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if scouc.SchemaCreateOrUpdateProperties != nil { + objectMap["properties"] = scouc.SchemaCreateOrUpdateProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for SchemaCreateOrUpdateContract struct. +func (scouc *SchemaCreateOrUpdateContract) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var schemaCreateOrUpdateProperties SchemaCreateOrUpdateProperties + err = json.Unmarshal(*v, &schemaCreateOrUpdateProperties) + if err != nil { + return err + } + scouc.SchemaCreateOrUpdateProperties = &schemaCreateOrUpdateProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + scouc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + scouc.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + scouc.Type = &typeVar + } + } + } + + return nil +} + +// SchemaCreateOrUpdateProperties API Schema create or update contract Properties. +type SchemaCreateOrUpdateProperties struct { + // ContentType - Must be a valid a media type used in a Content-Type header as defined in the RFC 2616. Media type of the schema document (e.g. application/json, application/xml).
- `Swagger` Schema use `application/vnd.ms-azure-apim.swagger.definitions+json`
- `WSDL` Schema use `application/vnd.ms-azure-apim.xsd+xml`
- `OpenApi` Schema use `application/vnd.oai.openapi.components+json`
- `WADL Schema` use `application/vnd.ms-azure-apim.wadl.grammars+xml`. + ContentType *string `json:"contentType,omitempty"` + // SchemaDocumentProperties - Create or update Properties of the Schema Document. *SchemaDocumentProperties `json:"document,omitempty"` } -// MarshalJSON is the custom marshaler for SchemaContractProperties. -func (scp SchemaContractProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for SchemaCreateOrUpdateProperties. +func (scoup SchemaCreateOrUpdateProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if scp.ContentType != nil { - objectMap["contentType"] = scp.ContentType + if scoup.ContentType != nil { + objectMap["contentType"] = scoup.ContentType } - if scp.SchemaDocumentProperties != nil { - objectMap["document"] = scp.SchemaDocumentProperties + if scoup.SchemaDocumentProperties != nil { + objectMap["document"] = scoup.SchemaDocumentProperties } return json.Marshal(objectMap) } -// UnmarshalJSON is the custom unmarshaler for SchemaContractProperties struct. -func (scp *SchemaContractProperties) UnmarshalJSON(body []byte) error { +// UnmarshalJSON is the custom unmarshaler for SchemaCreateOrUpdateProperties struct. +func (scoup *SchemaCreateOrUpdateProperties) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage err := json.Unmarshal(body, &m) if err != nil { @@ -9297,7 +9377,7 @@ func (scp *SchemaContractProperties) UnmarshalJSON(body []byte) error { if err != nil { return err } - scp.ContentType = &contentType + scoup.ContentType = &contentType } case "document": if v != nil { @@ -9306,7 +9386,7 @@ func (scp *SchemaContractProperties) UnmarshalJSON(body []byte) error { if err != nil { return err } - scp.SchemaDocumentProperties = &schemaDocumentProperties + scoup.SchemaDocumentProperties = &schemaDocumentProperties } } } @@ -9959,7 +10039,7 @@ func (future *ServiceRestoreFuture) Result(client ServiceClient) (sr ServiceReso type ServiceSkuProperties struct { // Name - Name of the Sku. Possible values include: 'SkuTypeDeveloper', 'SkuTypeStandard', 'SkuTypePremium', 'SkuTypeBasic', 'SkuTypeConsumption' Name SkuType `json:"name,omitempty"` - // Capacity - Capacity of the SKU (number of deployed units of the SKU). The default value is 1. + // Capacity - Capacity of the SKU (number of deployed units of the SKU). Capacity *int32 `json:"capacity,omitempty"` }