diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index faff99195d97e..05410ed7d23ba 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -437,7 +437,7 @@ com.azure.resourcemanager:azure-resourcemanager-sphere;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-chaos;1.0.0;1.1.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-defendereasm;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-hdinsight-containers;1.0.0-beta.1;1.0.0-beta.2 -com.azure.resourcemanager:azure-resourcemanager-apicenter;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-apicenter;1.0.0-beta.1;1.0.0 com.azure.resourcemanager:azure-resourcemanager-hybridconnectivity;1.0.0;1.1.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-playwrighttesting;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-recoveryservicesdatareplication;1.0.0-beta.1;1.0.0-beta.2 diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/CHANGELOG.md b/sdk/apicenter/azure-resourcemanager-apicenter/CHANGELOG.md index a05146efbc307..62595be363918 100644 --- a/sdk/apicenter/azure-resourcemanager-apicenter/CHANGELOG.md +++ b/sdk/apicenter/azure-resourcemanager-apicenter/CHANGELOG.md @@ -1,14 +1,277 @@ # Release History -## 1.0.0-beta.2 (Unreleased) +## 1.0.0 (2024-02-22) -### Features Added +- Azure Resource Manager ApiCenter client library for Java. This package contains Microsoft Azure SDK for ApiCenter Management SDK. Azure API Center Resource Provider. Package tag package-2024-03. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). ### Breaking Changes -### Bugs Fixed +* `models.ServiceCollection` was removed + +#### `models.Service` was modified + +* `provisioningState()` was removed + +#### `models.ServiceUpdate` was modified + +* `provisioningState()` was removed + +### Features Added + +* `models.ApiDefinition$DefinitionStages` was added + +* `models.Api` was added + +* `models.MetadataSchema$Update` was added + +* `models.WorkspaceProperties` was added + +* `models.MetadataSchema$UpdateStages` was added + +* `models.Deployments` was added + +* `models.Environment$DefinitionStages` was added + +* `models.Api$Definition` was added + +* `models.ApiSpecExportResult` was added + +* `models.Deployment$DefinitionStages` was added + +* `models.ExternalDocumentation` was added + +* `models.ApiKind` was added + +* `models.DeploymentsCreateOrUpdateResponse` was added + +* `models.ApiVersion$DefinitionStages` was added + +* `models.MetadataSchemaExportRequest` was added + +* `models.Environment$Definition` was added + +* `models.ApiVersions` was added + +* `models.Deployment` was added + +* `models.Environment$Update` was added + +* `models.ServiceProperties` was added + +* `models.WorkspacesGetHeaders` was added + +* `models.ApiDefinition$Definition` was added + +* `models.ApiSpecImportSourceFormat` was added + +* `models.ApiSpecImportRequest` was added + +* `models.DeploymentProperties` was added + +* `models.DeploymentListResult` was added + +* `models.ApiVersion$UpdateStages` was added + +* `models.MetadataSchema$DefinitionStages` was added + +* `models.MetadataSchemasCreateOrUpdateHeaders` was added + +* `models.ApiDefinition$UpdateStages` was added + +* `models.MetadataSchema$Definition` was added + +* `models.MetadataSchemaExportResult` was added + +* `models.ApiSpecExportResultFormat` was added + +* `models.EnvironmentProperties` was added + +* `models.ApiVersion$Definition` was added + +* `models.ApiProperties` was added + +* `models.ApiListResult` was added + +* `models.MetadataSchemasGetHeaders` was added + +* `models.EnvironmentsCreateOrUpdateHeaders` was added + +* `models.ApiDefinitions` was added + +* `models.ApiDefinitionsGetResponse` was added + +* `models.Apis` was added + +* `models.ApiDefinitionProperties` was added + +* `models.Contact` was added + +* `models.Environment` was added + +* `models.Api$UpdateStages` was added + +* `models.EnvironmentKind` was added + +* `models.ApiVersionsGetHeaders` was added + +* `models.WorkspacesGetResponse` was added + +* `models.Workspace$Update` was added + +* `models.EnvironmentsGetResponse` was added + +* `models.EnvironmentsGetHeaders` was added + +* `models.Workspace$Definition` was added + +* `models.DeploymentsGetHeaders` was added + +* `models.MetadataSchemaProperties` was added + +* `models.ApiVersion` was added + +* `models.DeploymentServer` was added + +* `models.MetadataSchemas` was added + +* `models.EnvironmentServerType` was added + +* `models.Api$Update` was added + +* `models.ApisGetResponse` was added + +* `models.Workspace` was added + +* `models.DeploymentsCreateOrUpdateHeaders` was added + +* `models.ApiVersionListResult` was added + +* `models.ApiDefinitionsGetHeaders` was added + +* `models.ApiDefinitionsCreateOrUpdateHeaders` was added + +* `models.MetadataSchemasCreateOrUpdateResponse` was added + +* `models.ApiVersionsGetResponse` was added + +* `models.EnvironmentServer` was added + +* `models.ApiDefinition` was added + +* `models.ApiDefinitionsCreateOrUpdateResponse` was added + +* `models.Deployment$UpdateStages` was added + +* `models.Deployment$Definition` was added + +* `models.Environment$UpdateStages` was added + +* `models.WorkspacesCreateOrUpdateResponse` was added + +* `models.Api$DefinitionStages` was added + +* `models.MetadataSchemaExportFormat` was added + +* `models.Workspace$DefinitionStages` was added + +* `models.License` was added + +* `models.MetadataSchema` was added + +* `models.ApisCreateOrUpdateHeaders` was added + +* `models.Environments` was added + +* `models.EnvironmentsCreateOrUpdateResponse` was added + +* `models.TermsOfService` was added + +* `models.Onboarding` was added + +* `models.ApiVersionProperties` was added + +* `models.Workspaces` was added + +* `models.WorkspaceListResult` was added + +* `models.LifecycleStage` was added + +* `models.Workspace$UpdateStages` was added + +* `models.ApisGetHeaders` was added + +* `models.ApiDefinitionPropertiesSpecification` was added + +* `models.ApiVersionsCreateOrUpdateHeaders` was added + +* `models.Deployment$Update` was added + +* `models.MetadataAssignmentEntity` was added + +* `models.EnvironmentListResult` was added + +* `models.ApisCreateOrUpdateResponse` was added + +* `models.WorkspacesCreateOrUpdateHeaders` was added + +* `models.MetadataSchemaListResult` was added + +* `models.ApiVersionsCreateOrUpdateResponse` was added + +* `models.ServiceListResult` was added + +* `models.DeploymentState` was added + +* `models.MetadataSchemasGetResponse` was added + +* `models.ApiVersion$Update` was added + +* `models.DeploymentsGetResponse` was added + +* `models.MetadataAssignment` was added + +* `models.ApiSpecImportRequestSpecification` was added + +* `models.ApiDefinitionListResult` was added + +* `models.ApiDefinition$Update` was added + +#### `ApiCenterManager` was modified + +* `environments()` was added +* `apis()` was added +* `apiVersions()` was added +* `workspaces()` was added +* `apiDefinitions()` was added +* `deployments()` was added +* `metadataSchemas()` was added + +#### `models.Service$Definition` was modified + +* `withProperties(models.ServiceProperties)` was added + +#### `models.Service` was modified + +* `exportMetadataSchema(models.MetadataSchemaExportRequest)` was added +* `properties()` was added +* `exportMetadataSchema(models.MetadataSchemaExportRequest,com.azure.core.util.Context)` was added + +#### `models.Services` was modified + +* `exportMetadataSchema(java.lang.String,java.lang.String,models.MetadataSchemaExportRequest,com.azure.core.util.Context)` was added +* `exportMetadataSchema(java.lang.String,java.lang.String,models.MetadataSchemaExportRequest)` was added + +#### `models.ServiceUpdate` was modified + +* `tags()` was added +* `identity()` was added +* `withTags(java.util.Map)` was added +* `withIdentity(models.ManagedServiceIdentity)` was added + +#### `models.Service$Update` was modified -### Other Changes +* `withTags(java.util.Map)` was added +* `withIdentity(models.ManagedServiceIdentity)` was added ## 1.0.0-beta.1 (2023-08-25) diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/README.md b/sdk/apicenter/azure-resourcemanager-apicenter/README.md index f7ca9adbede7f..20a0c6f8f0543 100644 --- a/sdk/apicenter/azure-resourcemanager-apicenter/README.md +++ b/sdk/apicenter/azure-resourcemanager-apicenter/README.md @@ -2,7 +2,7 @@ Azure Resource Manager ApiCenter client library for Java. -This package contains Microsoft Azure SDK for ApiCenter Management SDK. Azure API Center Resource Provider. Package tag package-2023-07-01-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). +This package contains Microsoft Azure SDK for ApiCenter Management SDK. Azure API Center Resource Provider. Package tag package-2024-03. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). ## We'd love to hear your feedback @@ -32,7 +32,7 @@ Various documentation is available to help you get started com.azure.resourcemanager azure-resourcemanager-apicenter - 1.0.0-beta.1 + 1.0.0 ``` [//]: # ({x-version-update-end}) @@ -45,7 +45,7 @@ Azure Management Libraries require a `TokenCredential` implementation for authen ### Authentication -By default, Azure Active Directory token authentication depends on correct configuration of the following environment variables. +By default, Microsoft Entra ID token authentication depends on correct configuration of the following environment variables. - `AZURE_CLIENT_ID` for Azure client ID. - `AZURE_TENANT_ID` for Azure tenant ID. @@ -94,7 +94,7 @@ This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For m [survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS [docs]: https://azure.github.io/azure-sdk-for-java/ -[jdk]: https://docs.microsoft.com/java/azure/jdk/ +[jdk]: https://learn.microsoft.com/azure/developer/java/fundamentals/ [azure_subscription]: https://azure.microsoft.com/free/ [azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity [azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/core/azure-core-http-netty diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/SAMPLE.md b/sdk/apicenter/azure-resourcemanager-apicenter/SAMPLE.md index 003b7d4c062cc..c1aba175844b1 100644 --- a/sdk/apicenter/azure-resourcemanager-apicenter/SAMPLE.md +++ b/sdk/apicenter/azure-resourcemanager-apicenter/SAMPLE.md @@ -1,6 +1,56 @@ # Code snippets and samples +## ApiDefinitions + +- [CreateOrUpdate](#apidefinitions_createorupdate) +- [Delete](#apidefinitions_delete) +- [ExportSpecification](#apidefinitions_exportspecification) +- [Get](#apidefinitions_get) +- [Head](#apidefinitions_head) +- [ImportSpecification](#apidefinitions_importspecification) +- [List](#apidefinitions_list) + +## ApiVersions + +- [CreateOrUpdate](#apiversions_createorupdate) +- [Delete](#apiversions_delete) +- [Get](#apiversions_get) +- [Head](#apiversions_head) +- [List](#apiversions_list) + +## Apis + +- [CreateOrUpdate](#apis_createorupdate) +- [Delete](#apis_delete) +- [Get](#apis_get) +- [Head](#apis_head) +- [List](#apis_list) + +## Deployments + +- [CreateOrUpdate](#deployments_createorupdate) +- [Delete](#deployments_delete) +- [Get](#deployments_get) +- [Head](#deployments_head) +- [List](#deployments_list) + +## Environments + +- [CreateOrUpdate](#environments_createorupdate) +- [Delete](#environments_delete) +- [Get](#environments_get) +- [Head](#environments_head) +- [List](#environments_list) + +## MetadataSchemas + +- [CreateOrUpdate](#metadataschemas_createorupdate) +- [Delete](#metadataschemas_delete) +- [Get](#metadataschemas_get) +- [Head](#metadataschemas_head) +- [List](#metadataschemas_list) + ## Operations - [List](#operations_list) @@ -9,24 +59,770 @@ - [CreateOrUpdate](#services_createorupdate) - [Delete](#services_delete) +- [ExportMetadataSchema](#services_exportmetadataschema) - [GetByResourceGroup](#services_getbyresourcegroup) - [List](#services_list) - [ListByResourceGroup](#services_listbyresourcegroup) - [Update](#services_update) + +## Workspaces + +- [CreateOrUpdate](#workspaces_createorupdate) +- [Delete](#workspaces_delete) +- [Get](#workspaces_get) +- [Head](#workspaces_head) +- [List](#workspaces_list) +### ApiDefinitions_CreateOrUpdate + +```java +/** + * Samples for ApiDefinitions CreateOrUpdate. + */ +public final class ApiDefinitionsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/ + * ApiDefinitions_CreateOrUpdate.json + */ + /** + * Sample code: ApiDefinitions_CreateOrUpdate. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void apiDefinitionsCreateOrUpdate(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { + manager.apiDefinitions().define("openapi") + .withExistingVersion("contoso-resources", "contoso", "default", "openapi", "2023-01-01").create(); + } +} +``` + +### ApiDefinitions_Delete + +```java +/** + * Samples for ApiDefinitions Delete. + */ +public final class ApiDefinitionsDeleteSamples { + /* + * x-ms-original-file: + * specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/ApiDefinitions_Delete. + * json + */ + /** + * Sample code: ApiDefinitions_Delete. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void apiDefinitionsDelete(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { + manager.apiDefinitions().deleteWithResponse("contoso-resources", "contoso", "default", "echo-api", "2023-01-01", + "openapi", com.azure.core.util.Context.NONE); + } +} +``` + +### ApiDefinitions_ExportSpecification + +```java +/** + * Samples for ApiDefinitions ExportSpecification. + */ +public final class ApiDefinitionsExportSpecificationSamples { + /* + * x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/ + * ApiDefinitions_ExportSpecification.json + */ + /** + * Sample code: ApiDefinitions_ExportSpecification. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void apiDefinitionsExportSpecification(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { + manager.apiDefinitions().exportSpecification("contoso-resources", "contoso", "default", "echo-api", + "2023-01-01", "openapi", com.azure.core.util.Context.NONE); + } +} +``` + +### ApiDefinitions_Get + +```java +/** + * Samples for ApiDefinitions Get. + */ +public final class ApiDefinitionsGetSamples { + /* + * x-ms-original-file: + * specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/ApiDefinitions_Get.json + */ + /** + * Sample code: ApiDefinitions_Get. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void apiDefinitionsGet(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { + manager.apiDefinitions().getWithResponse("contoso-resources", "contoso", "default", "echo-api", "2023-01-01", + "openapi", com.azure.core.util.Context.NONE); + } +} +``` + +### ApiDefinitions_Head + +```java +/** + * Samples for ApiDefinitions Head. + */ +public final class ApiDefinitionsHeadSamples { + /* + * x-ms-original-file: + * specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/ApiDefinitions_Head.json + */ + /** + * Sample code: ApiDefinitions_Head. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void apiDefinitionsHead(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { + manager.apiDefinitions().headWithResponse("contoso-resources", "contoso", "default", "echo-api", "2023-01-01", + "openapi", com.azure.core.util.Context.NONE); + } +} +``` + +### ApiDefinitions_ImportSpecification + +```java + +/** + * Samples for ApiDefinitions ImportSpecification. + */ +public final class ApiDefinitionsImportSpecificationSamples { + /* + * x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/ + * ApiDefinitions_ImportSpecification.json + */ + /** + * Sample code: ApiDefinitions_ImportSpecification. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void apiDefinitionsImportSpecification(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { + manager.apiDefinitions().importSpecification("contoso-resources", "contoso", "default", "echo-api", + "2023-01-01", "openapi", null, com.azure.core.util.Context.NONE); + } +} +``` + +### ApiDefinitions_List + +```java +/** + * Samples for ApiDefinitions List. + */ +public final class ApiDefinitionsListSamples { + /* + * x-ms-original-file: + * specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/ApiDefinitions_List.json + */ + /** + * Sample code: ApiDefinitions_ListByApiVersion. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void apiDefinitionsListByApiVersion(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { + manager.apiDefinitions().list("contoso-resources", "contoso", "default", "echo-api", "2023-01-01", null, + com.azure.core.util.Context.NONE); + } +} +``` + +### ApiVersions_CreateOrUpdate + +```java +/** + * Samples for ApiVersions CreateOrUpdate. + */ +public final class ApiVersionsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/ + * ApiVersions_CreateOrUpdate.json + */ + /** + * Sample code: ApiVersions_CreateOrUpdate. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void apiVersionsCreateOrUpdate(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { + manager.apiVersions().define("2023-01-01") + .withExistingApi("contoso-resources", "contoso", "default", "echo-api").create(); + } +} +``` + +### ApiVersions_Delete + +```java +/** + * Samples for ApiVersions Delete. + */ +public final class ApiVersionsDeleteSamples { + /* + * x-ms-original-file: + * specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/ApiVersions_Delete.json + */ + /** + * Sample code: ApiVersions_Delete. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void apiVersionsDelete(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { + manager.apiVersions().deleteWithResponse("contoso-resources", "contoso", "default", "echo-api", "2023-01-01", + com.azure.core.util.Context.NONE); + } +} +``` + +### ApiVersions_Get + +```java +/** + * Samples for ApiVersions Get. + */ +public final class ApiVersionsGetSamples { + /* + * x-ms-original-file: + * specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/ApiVersions_Get.json + */ + /** + * Sample code: ApiVersions_Get. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void apiVersionsGet(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { + manager.apiVersions().getWithResponse("contoso-resources", "contoso", "default", "echo-api", "2023-01-01", + com.azure.core.util.Context.NONE); + } +} +``` + +### ApiVersions_Head + +```java +/** + * Samples for ApiVersions Head. + */ +public final class ApiVersionsHeadSamples { + /* + * x-ms-original-file: + * specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/ApiVersions_Head.json + */ + /** + * Sample code: ApiVersions_Head. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void apiVersionsHead(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { + manager.apiVersions().headWithResponse("contoso-resources", "contoso", "default", "echo-api", "2023-01-01", + com.azure.core.util.Context.NONE); + } +} +``` + +### ApiVersions_List + +```java +/** + * Samples for ApiVersions List. + */ +public final class ApiVersionsListSamples { + /* + * x-ms-original-file: + * specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/ApiVersions_List.json + */ + /** + * Sample code: ApiVersions_ListByApi. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void apiVersionsListByApi(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { + manager.apiVersions().list("contoso-resources", "contoso", "default", "echo-api", null, + com.azure.core.util.Context.NONE); + } +} +``` + +### Apis_CreateOrUpdate + +```java +/** + * Samples for Apis CreateOrUpdate. + */ +public final class ApisCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Apis_CreateOrUpdate.json + */ + /** + * Sample code: Apis_CreateOrUpdate. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void apisCreateOrUpdate(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { + manager.apis().define("echo-api").withExistingWorkspace("contoso-resources", "contoso", "default").create(); + } +} +``` + +### Apis_Delete + +```java +/** + * Samples for Apis Delete. + */ +public final class ApisDeleteSamples { + /* + * x-ms-original-file: + * specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Apis_Delete.json + */ + /** + * Sample code: Apis_Delete. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void apisDelete(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { + manager.apis().deleteWithResponse("contoso-resources", "contoso", "default", "echo-api", + com.azure.core.util.Context.NONE); + } +} +``` + +### Apis_Get + +```java +/** + * Samples for Apis Get. + */ +public final class ApisGetSamples { + /* + * x-ms-original-file: + * specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Apis_Get.json + */ + /** + * Sample code: Apis_Get. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void apisGet(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { + manager.apis().getWithResponse("contoso-resources", "contoso", "default", "echo-api", + com.azure.core.util.Context.NONE); + } +} +``` + +### Apis_Head + +```java +/** + * Samples for Apis Head. + */ +public final class ApisHeadSamples { + /* + * x-ms-original-file: + * specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Apis_Head.json + */ + /** + * Sample code: Apis_Head. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void apisHead(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { + manager.apis().headWithResponse("contoso-resources", "contoso", "default", "echo-api", + com.azure.core.util.Context.NONE); + } +} +``` + +### Apis_List + +```java +/** + * Samples for Apis List. + */ +public final class ApisListSamples { + /* + * x-ms-original-file: + * specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Apis_List.json + */ + /** + * Sample code: Apis_ListByWorkspace. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void apisListByWorkspace(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { + manager.apis().list("contoso-resources", "contoso", "default", null, com.azure.core.util.Context.NONE); + } +} +``` + +### Deployments_CreateOrUpdate + +```java +/** + * Samples for Deployments CreateOrUpdate. + */ +public final class DeploymentsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/ + * Deployments_CreateOrUpdate.json + */ + /** + * Sample code: Deployments_CreateOrUpdate. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void deploymentsCreateOrUpdate(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { + manager.deployments().define("production") + .withExistingApi("contoso-resources", "contoso", "default", "echo-api").create(); + } +} +``` + +### Deployments_Delete + +```java +/** + * Samples for Deployments Delete. + */ +public final class DeploymentsDeleteSamples { + /* + * x-ms-original-file: + * specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Deployments_Delete.json + */ + /** + * Sample code: Deployments_Delete. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void deploymentsDelete(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { + manager.deployments().deleteWithResponse("contoso-resources", "contoso", "default", "echo-api", "production", + com.azure.core.util.Context.NONE); + } +} +``` + +### Deployments_Get + +```java +/** + * Samples for Deployments Get. + */ +public final class DeploymentsGetSamples { + /* + * x-ms-original-file: + * specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Deployments_Get.json + */ + /** + * Sample code: Deployments_Get. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void deploymentsGet(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { + manager.deployments().getWithResponse("contoso-resources", "contoso", "default", "echo-api", "production", + com.azure.core.util.Context.NONE); + } +} +``` + +### Deployments_Head + +```java +/** + * Samples for Deployments Head. + */ +public final class DeploymentsHeadSamples { + /* + * x-ms-original-file: + * specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Deployments_Head.json + */ + /** + * Sample code: Deployments_Head. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void deploymentsHead(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { + manager.deployments().headWithResponse("contoso-resources", "contoso", "default", "echo-api", "production", + com.azure.core.util.Context.NONE); + } +} +``` + +### Deployments_List + +```java +/** + * Samples for Deployments List. + */ +public final class DeploymentsListSamples { + /* + * x-ms-original-file: + * specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Deployments_List.json + */ + /** + * Sample code: Deployments_ListByApi. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void deploymentsListByApi(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { + manager.deployments().list("contoso-resources", "contoso", "default", "echo-api", null, + com.azure.core.util.Context.NONE); + } +} +``` + +### Environments_CreateOrUpdate + +```java +/** + * Samples for Environments CreateOrUpdate. + */ +public final class EnvironmentsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/ + * Environments_CreateOrUpdate.json + */ + /** + * Sample code: Environments_CreateOrUpdate. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void environmentsCreateOrUpdate(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { + manager.environments().define("public").withExistingWorkspace("contoso-resources", "contoso", "default") + .create(); + } +} +``` + +### Environments_Delete + +```java +/** + * Samples for Environments Delete. + */ +public final class EnvironmentsDeleteSamples { + /* + * x-ms-original-file: + * specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Environments_Delete.json + */ + /** + * Sample code: Environments_Delete. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void environmentsDelete(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { + manager.environments().deleteWithResponse("contoso-resources", "contoso", "default", "public", + com.azure.core.util.Context.NONE); + } +} +``` + +### Environments_Get + +```java +/** + * Samples for Environments Get. + */ +public final class EnvironmentsGetSamples { + /* + * x-ms-original-file: + * specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Environments_Get.json + */ + /** + * Sample code: Environments_Get. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void environmentsGet(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { + manager.environments().getWithResponse("contoso-resources", "contoso", "default", "public", + com.azure.core.util.Context.NONE); + } +} +``` + +### Environments_Head + +```java +/** + * Samples for Environments Head. + */ +public final class EnvironmentsHeadSamples { + /* + * x-ms-original-file: + * specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Environments_Head.json + */ + /** + * Sample code: Environments_Head. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void environmentsHead(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { + manager.environments().headWithResponse("contoso-resources", "contoso", "default", "public", + com.azure.core.util.Context.NONE); + } +} +``` + +### Environments_List + +```java +/** + * Samples for Environments List. + */ +public final class EnvironmentsListSamples { + /* + * x-ms-original-file: + * specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Environments_List.json + */ + /** + * Sample code: Environments_ListByWorkspace. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void environmentsListByWorkspace(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { + manager.environments().list("contoso-resources", "contoso", "default", null, com.azure.core.util.Context.NONE); + } +} +``` + +### MetadataSchemas_CreateOrUpdate + +```java +/** + * Samples for MetadataSchemas CreateOrUpdate. + */ +public final class MetadataSchemasCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/ + * MetadataSchemas_CreateOrUpdate.json + */ + /** + * Sample code: MetadataSchemas_CreateOrUpdate. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void metadataSchemasCreateOrUpdate(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { + manager.metadataSchemas().define("author").withExistingService("contoso-resources", "contoso").create(); + } +} +``` + +### MetadataSchemas_Delete + +```java +/** + * Samples for MetadataSchemas Delete. + */ +public final class MetadataSchemasDeleteSamples { + /* + * x-ms-original-file: + * specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/MetadataSchemas_Delete. + * json + */ + /** + * Sample code: MetadataSchemas_Delete. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void metadataSchemasDelete(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { + manager.metadataSchemas().deleteWithResponse("contoso-resources", "contoso", "author", + com.azure.core.util.Context.NONE); + } +} +``` + +### MetadataSchemas_Get + +```java +/** + * Samples for MetadataSchemas Get. + */ +public final class MetadataSchemasGetSamples { + /* + * x-ms-original-file: + * specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/MetadataSchemas_Get.json + */ + /** + * Sample code: MetadataSchemas_Get. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void metadataSchemasGet(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { + manager.metadataSchemas().getWithResponse("contoso-resources", "contoso", "lastName", + com.azure.core.util.Context.NONE); + } +} +``` + +### MetadataSchemas_Head + +```java +/** + * Samples for MetadataSchemas Head. + */ +public final class MetadataSchemasHeadSamples { + /* + * x-ms-original-file: + * specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/MetadataSchemas_Head.json + */ + /** + * Sample code: MetadataSchemas_Head. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void metadataSchemasHead(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { + manager.metadataSchemas().headWithResponse("contoso-resources", "contoso", "author", + com.azure.core.util.Context.NONE); + } +} +``` + +### MetadataSchemas_List + +```java +/** + * Samples for MetadataSchemas List. + */ +public final class MetadataSchemasListSamples { + /* + * x-ms-original-file: + * specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/MetadataSchemas_List.json + */ + /** + * Sample code: MetadataSchemas_ListByService. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void metadataSchemasListByService(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { + manager.metadataSchemas().list("contoso-resources", "contoso", null, com.azure.core.util.Context.NONE); + } +} +``` + ### Operations_List ```java -/** Samples for Operations List. */ +/** + * Samples for Operations List. + */ public final class OperationsListSamples { /* - * x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/preview/2023-07-01-preview/examples/Operations_List.json + * x-ms-original-file: + * specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Operations_List.json */ /** - * Sample code: Operations_List. - * + * Sample code: List Provider Operations. + * * @param manager Entry point to ApiCenterManager. */ - public static void operationsList(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { + public static void listProviderOperations(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { manager.operations().list(com.azure.core.util.Context.NONE); } } @@ -35,44 +831,94 @@ public final class OperationsListSamples { ### Services_CreateOrUpdate ```java -/** Samples for Services CreateOrUpdate. */ +import com.azure.resourcemanager.apicenter.models.ManagedServiceIdentity; +import com.azure.resourcemanager.apicenter.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.apicenter.models.ServiceProperties; +import com.azure.resourcemanager.apicenter.models.UserAssignedIdentity; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Services CreateOrUpdate. + */ public final class ServicesCreateOrUpdateSamples { /* - * x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/preview/2023-07-01-preview/examples/Services_CreateOrUpdate.json + * x-ms-original-file: + * specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Services_CreateOrUpdate. + * json */ /** - * Sample code: Services_Create. - * + * Sample code: Services_CreateOrUpdate. + * * @param manager Entry point to ApiCenterManager. */ - public static void servicesCreate(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { - manager - .services() - .define("contoso") - .withRegion((String) null) - .withExistingResourceGroup("contoso-resources") + public static void servicesCreateOrUpdate(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { + manager.services().define("contoso").withRegion("East US").withExistingResourceGroup("contoso-resources") + .withTags(mapOf()).withProperties(new ServiceProperties()) + .withIdentity(new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.fromString("SystemAssigned, UserAssigned")) + .withUserAssignedIdentities(mapOf( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso-resources/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-identity", + new UserAssignedIdentity()))) .create(); } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } } ``` ### Services_Delete ```java -/** Samples for Services Delete. */ +/** + * Samples for Services Delete. + */ public final class ServicesDeleteSamples { /* - * x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/preview/2023-07-01-preview/examples/Services_Delete.json + * x-ms-original-file: + * specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Services_Delete.json */ /** * Sample code: Services_Delete. - * + * * @param manager Entry point to ApiCenterManager. */ public static void servicesDelete(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { - manager - .services() - .deleteByResourceGroupWithResponse("contoso-resources", "contoso", com.azure.core.util.Context.NONE); + manager.services().deleteByResourceGroupWithResponse("contoso-resources", "contoso", + com.azure.core.util.Context.NONE); + } +} +``` + +### Services_ExportMetadataSchema + +```java + +/** + * Samples for Services ExportMetadataSchema. + */ +public final class ServicesExportMetadataSchemaSamples { + /* + * x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/ + * Services_ExportMetadataSchema.json + */ + /** + * Sample code: Services_ExportMetadataSchema. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void servicesExportMetadataSchema(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { + manager.services().exportMetadataSchema("contoso-resources", "contoso", null, com.azure.core.util.Context.NONE); } } ``` @@ -80,20 +926,22 @@ public final class ServicesDeleteSamples { ### Services_GetByResourceGroup ```java -/** Samples for Services GetByResourceGroup. */ +/** + * Samples for Services GetByResourceGroup. + */ public final class ServicesGetByResourceGroupSamples { /* - * x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/preview/2023-07-01-preview/examples/Services_Get.json + * x-ms-original-file: + * specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Services_Get.json */ /** * Sample code: Services_Get. - * + * * @param manager Entry point to ApiCenterManager. */ public static void servicesGet(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { - manager - .services() - .getByResourceGroupWithResponse("contoso-resources", "contoso", com.azure.core.util.Context.NONE); + manager.services().getByResourceGroupWithResponse("contoso-resources", "contoso", + com.azure.core.util.Context.NONE); } } ``` @@ -101,14 +949,17 @@ public final class ServicesGetByResourceGroupSamples { ### Services_List ```java -/** Samples for Services List. */ +/** + * Samples for Services List. + */ public final class ServicesListSamples { /* - * x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/preview/2023-07-01-preview/examples/Services_ListBySubscription.json + * x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/ + * Services_ListBySubscription.json */ /** * Sample code: Services_ListBySubscription. - * + * * @param manager Entry point to ApiCenterManager. */ public static void servicesListBySubscription(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { @@ -120,14 +971,17 @@ public final class ServicesListSamples { ### Services_ListByResourceGroup ```java -/** Samples for Services ListByResourceGroup. */ +/** + * Samples for Services ListByResourceGroup. + */ public final class ServicesListByResourceGroupSamples { /* - * x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/preview/2023-07-01-preview/examples/Services_ListByResourceGroup.json + * x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/ + * Services_ListByResourceGroup.json */ /** * Sample code: Services_ListByResourceGroup. - * + * * @param manager Entry point to ApiCenterManager. */ public static void servicesListByResourceGroup(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { @@ -141,24 +995,139 @@ public final class ServicesListByResourceGroupSamples { ```java import com.azure.resourcemanager.apicenter.models.Service; -/** Samples for Services Update. */ +/** + * Samples for Services Update. + */ public final class ServicesUpdateSamples { /* - * x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/preview/2023-07-01-preview/examples/Services_Update.json + * x-ms-original-file: + * specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Services_Update.json */ /** * Sample code: Services_Update. - * + * * @param manager Entry point to ApiCenterManager. */ public static void servicesUpdate(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { - Service resource = - manager - .services() - .getByResourceGroupWithResponse("contoso-resources", "contoso", com.azure.core.util.Context.NONE) - .getValue(); + Service resource = manager.services() + .getByResourceGroupWithResponse("contoso-resources", "contoso", com.azure.core.util.Context.NONE) + .getValue(); resource.update().apply(); } } ``` +### Workspaces_CreateOrUpdate + +```java +/** + * Samples for Workspaces CreateOrUpdate. + */ +public final class WorkspacesCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Workspaces_CreateOrUpdate + * .json + */ + /** + * Sample code: Workspaces_CreateOrUpdate. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void workspacesCreateOrUpdate(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { + manager.workspaces().define("default").withExistingService("contoso-resources", "contoso").create(); + } +} +``` + +### Workspaces_Delete + +```java +/** + * Samples for Workspaces Delete. + */ +public final class WorkspacesDeleteSamples { + /* + * x-ms-original-file: + * specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Workspaces_Delete.json + */ + /** + * Sample code: Workspaces_Delete. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void workspacesDelete(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { + manager.workspaces().deleteWithResponse("contoso-resources", "contoso", "default", + com.azure.core.util.Context.NONE); + } +} +``` + +### Workspaces_Get + +```java +/** + * Samples for Workspaces Get. + */ +public final class WorkspacesGetSamples { + /* + * x-ms-original-file: + * specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Workspaces_Get.json + */ + /** + * Sample code: Workspaces_Get. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void workspacesGet(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { + manager.workspaces().getWithResponse("contoso-resources", "contoso", "default", + com.azure.core.util.Context.NONE); + } +} +``` + +### Workspaces_Head + +```java +/** + * Samples for Workspaces Head. + */ +public final class WorkspacesHeadSamples { + /* + * x-ms-original-file: + * specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Workspaces_Head.json + */ + /** + * Sample code: Workspaces_Head. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void workspacesHead(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { + manager.workspaces().headWithResponse("contoso-resources", "contoso", "default", + com.azure.core.util.Context.NONE); + } +} +``` + +### Workspaces_List + +```java +/** + * Samples for Workspaces List. + */ +public final class WorkspacesListSamples { + /* + * x-ms-original-file: + * specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Workspaces_List.json + */ + /** + * Sample code: Workspaces_ListByService. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void workspacesListByService(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { + manager.workspaces().list("contoso-resources", "contoso", null, com.azure.core.util.Context.NONE); + } +} +``` + diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/pom.xml b/sdk/apicenter/azure-resourcemanager-apicenter/pom.xml index c5ff6f0f61158..72019307cde89 100644 --- a/sdk/apicenter/azure-resourcemanager-apicenter/pom.xml +++ b/sdk/apicenter/azure-resourcemanager-apicenter/pom.xml @@ -14,11 +14,11 @@ com.azure.resourcemanager azure-resourcemanager-apicenter - 1.0.0-beta.2 + 1.0.0 jar Microsoft Azure SDK for ApiCenter Management - This package contains Microsoft Azure SDK for ApiCenter Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Azure API Center Resource Provider. Package tag package-2023-07-01-preview. + This package contains Microsoft Azure SDK for ApiCenter Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Azure API Center Resource Provider. Package tag package-2024-03. https://github.com/Azure/azure-sdk-for-java @@ -45,7 +45,6 @@ UTF-8 0 0 - true @@ -88,8 +87,6 @@ 4.11.0 test - - net.bytebuddy byte-buddy diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/ApiCenterManager.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/ApiCenterManager.java index ae04b849e8534..a481734e0d7be 100644 --- a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/ApiCenterManager.java +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/ApiCenterManager.java @@ -24,11 +24,25 @@ import com.azure.core.util.Configuration; import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.apicenter.fluent.AzureApiCenter; +import com.azure.resourcemanager.apicenter.implementation.ApiDefinitionsImpl; +import com.azure.resourcemanager.apicenter.implementation.ApiVersionsImpl; +import com.azure.resourcemanager.apicenter.implementation.ApisImpl; import com.azure.resourcemanager.apicenter.implementation.AzureApiCenterBuilder; +import com.azure.resourcemanager.apicenter.implementation.DeploymentsImpl; +import com.azure.resourcemanager.apicenter.implementation.EnvironmentsImpl; +import com.azure.resourcemanager.apicenter.implementation.MetadataSchemasImpl; import com.azure.resourcemanager.apicenter.implementation.OperationsImpl; import com.azure.resourcemanager.apicenter.implementation.ServicesImpl; +import com.azure.resourcemanager.apicenter.implementation.WorkspacesImpl; +import com.azure.resourcemanager.apicenter.models.ApiDefinitions; +import com.azure.resourcemanager.apicenter.models.ApiVersions; +import com.azure.resourcemanager.apicenter.models.Apis; +import com.azure.resourcemanager.apicenter.models.Deployments; +import com.azure.resourcemanager.apicenter.models.Environments; +import com.azure.resourcemanager.apicenter.models.MetadataSchemas; import com.azure.resourcemanager.apicenter.models.Operations; import com.azure.resourcemanager.apicenter.models.Services; +import com.azure.resourcemanager.apicenter.models.Workspaces; import java.time.Duration; import java.time.temporal.ChronoUnit; import java.util.ArrayList; @@ -36,29 +50,42 @@ import java.util.Objects; import java.util.stream.Collectors; -/** Entry point to ApiCenterManager. Azure API Center Resource Provider. */ +/** + * Entry point to ApiCenterManager. + * Azure API Center Resource Provider. + */ public final class ApiCenterManager { private Operations operations; private Services services; + private MetadataSchemas metadataSchemas; + + private Workspaces workspaces; + + private Apis apis; + + private Deployments deployments; + + private ApiVersions apiVersions; + + private ApiDefinitions apiDefinitions; + + private Environments environments; + private final AzureApiCenter clientObject; private ApiCenterManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); Objects.requireNonNull(profile, "'profile' cannot be null."); - this.clientObject = - new AzureApiCenterBuilder() - .pipeline(httpPipeline) - .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) - .subscriptionId(profile.getSubscriptionId()) - .defaultPollInterval(defaultPollInterval) - .buildClient(); + this.clientObject = new AzureApiCenterBuilder().pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()).subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval).buildClient(); } /** * Creates an instance of ApiCenter service API entry point. - * + * * @param credential the credential to use. * @param profile the Azure profile for client. * @return the ApiCenter service API instance. @@ -71,7 +98,7 @@ public static ApiCenterManager authenticate(TokenCredential credential, AzurePro /** * Creates an instance of ApiCenter service API entry point. - * + * * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. * @param profile the Azure profile for client. * @return the ApiCenter service API instance. @@ -84,14 +111,16 @@ public static ApiCenterManager authenticate(HttpPipeline httpPipeline, AzureProf /** * Gets a Configurable instance that can be used to create ApiCenterManager with optional configuration. - * + * * @return the Configurable instance allowing configurations. */ public static Configurable configure() { return new ApiCenterManager.Configurable(); } - /** The Configurable allowing configurations to be set. */ + /** + * The Configurable allowing configurations to be set. + */ public static final class Configurable { private static final ClientLogger LOGGER = new ClientLogger(Configurable.class); @@ -163,8 +192,8 @@ public Configurable withRetryPolicy(RetryPolicy retryPolicy) { /** * Sets the retry options for the HTTP pipeline retry policy. - * - *

This setting has no effect, if retry policy is set via {@link #withRetryPolicy(RetryPolicy)}. + *

+ * This setting has no effect, if retry policy is set via {@link #withRetryPolicy(RetryPolicy)}. * * @param retryOptions the retry options for the HTTP pipeline retry policy. * @return the configurable object itself. @@ -181,8 +210,8 @@ public Configurable withRetryOptions(RetryOptions retryOptions) { * @return the configurable object itself. */ public Configurable withDefaultPollInterval(Duration defaultPollInterval) { - this.defaultPollInterval = - Objects.requireNonNull(defaultPollInterval, "'defaultPollInterval' cannot be null."); + this.defaultPollInterval + = Objects.requireNonNull(defaultPollInterval, "'defaultPollInterval' cannot be null."); if (this.defaultPollInterval.isNegative()) { throw LOGGER .logExceptionAsError(new IllegalArgumentException("'defaultPollInterval' cannot be negative")); @@ -202,21 +231,12 @@ public ApiCenterManager authenticate(TokenCredential credential, AzureProfile pr Objects.requireNonNull(profile, "'profile' cannot be null."); StringBuilder userAgentBuilder = new StringBuilder(); - userAgentBuilder - .append("azsdk-java") - .append("-") - .append("com.azure.resourcemanager.apicenter") - .append("/") - .append("1.0.0-beta.1"); + userAgentBuilder.append("azsdk-java").append("-").append("com.azure.resourcemanager.apicenter").append("/") + .append("1.0.0"); if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { - userAgentBuilder - .append(" (") - .append(Configuration.getGlobalConfiguration().get("java.version")) - .append("; ") - .append(Configuration.getGlobalConfiguration().get("os.name")) - .append("; ") - .append(Configuration.getGlobalConfiguration().get("os.version")) - .append("; auto-generated)"); + userAgentBuilder.append(" (").append(Configuration.getGlobalConfiguration().get("java.version")) + .append("; ").append(Configuration.getGlobalConfiguration().get("os.name")).append("; ") + .append(Configuration.getGlobalConfiguration().get("os.version")).append("; auto-generated)"); } else { userAgentBuilder.append(" (auto-generated)"); } @@ -235,38 +255,25 @@ public ApiCenterManager authenticate(TokenCredential credential, AzureProfile pr policies.add(new UserAgentPolicy(userAgentBuilder.toString())); policies.add(new AddHeadersFromContextPolicy()); policies.add(new RequestIdPolicy()); - policies - .addAll( - this - .policies - .stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .collect(Collectors.toList())); + policies.addAll(this.policies.stream().filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .collect(Collectors.toList())); HttpPolicyProviders.addBeforeRetryPolicies(policies); policies.add(retryPolicy); policies.add(new AddDatePolicy()); policies.add(new ArmChallengeAuthenticationPolicy(credential, scopes.toArray(new String[0]))); - policies - .addAll( - this - .policies - .stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .collect(Collectors.toList())); + policies.addAll(this.policies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY).collect(Collectors.toList())); HttpPolicyProviders.addAfterRetryPolicies(policies); policies.add(new HttpLoggingPolicy(httpLogOptions)); - HttpPipeline httpPipeline = - new HttpPipelineBuilder() - .httpClient(httpClient) - .policies(policies.toArray(new HttpPipelinePolicy[0])) - .build(); + HttpPipeline httpPipeline = new HttpPipelineBuilder().httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])).build(); return new ApiCenterManager(httpPipeline, profile, defaultPollInterval); } } /** * Gets the resource collection API of Operations. - * + * * @return Resource collection API of Operations. */ public Operations operations() { @@ -278,7 +285,7 @@ public Operations operations() { /** * Gets the resource collection API of Services. It manages Service. - * + * * @return Resource collection API of Services. */ public Services services() { @@ -288,10 +295,94 @@ public Services services() { return services; } + /** + * Gets the resource collection API of MetadataSchemas. It manages MetadataSchema. + * + * @return Resource collection API of MetadataSchemas. + */ + public MetadataSchemas metadataSchemas() { + if (this.metadataSchemas == null) { + this.metadataSchemas = new MetadataSchemasImpl(clientObject.getMetadataSchemas(), this); + } + return metadataSchemas; + } + + /** + * Gets the resource collection API of Workspaces. It manages Workspace. + * + * @return Resource collection API of Workspaces. + */ + public Workspaces workspaces() { + if (this.workspaces == null) { + this.workspaces = new WorkspacesImpl(clientObject.getWorkspaces(), this); + } + return workspaces; + } + + /** + * Gets the resource collection API of Apis. It manages Api. + * + * @return Resource collection API of Apis. + */ + public Apis apis() { + if (this.apis == null) { + this.apis = new ApisImpl(clientObject.getApis(), this); + } + return apis; + } + + /** + * Gets the resource collection API of Deployments. It manages Deployment. + * + * @return Resource collection API of Deployments. + */ + public Deployments deployments() { + if (this.deployments == null) { + this.deployments = new DeploymentsImpl(clientObject.getDeployments(), this); + } + return deployments; + } + + /** + * Gets the resource collection API of ApiVersions. It manages ApiVersion. + * + * @return Resource collection API of ApiVersions. + */ + public ApiVersions apiVersions() { + if (this.apiVersions == null) { + this.apiVersions = new ApiVersionsImpl(clientObject.getApiVersions(), this); + } + return apiVersions; + } + + /** + * Gets the resource collection API of ApiDefinitions. It manages ApiDefinition. + * + * @return Resource collection API of ApiDefinitions. + */ + public ApiDefinitions apiDefinitions() { + if (this.apiDefinitions == null) { + this.apiDefinitions = new ApiDefinitionsImpl(clientObject.getApiDefinitions(), this); + } + return apiDefinitions; + } + + /** + * Gets the resource collection API of Environments. It manages Environment. + * + * @return Resource collection API of Environments. + */ + public Environments environments() { + if (this.environments == null) { + this.environments = new EnvironmentsImpl(clientObject.getEnvironments(), this); + } + return environments; + } + /** * Gets wrapped service client AzureApiCenter providing direct access to the underlying auto-generated API * implementation, based on Azure REST API. - * + * * @return Wrapped service client AzureApiCenter. */ public AzureApiCenter serviceClient() { diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/ApiDefinitionsClient.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/ApiDefinitionsClient.java new file mode 100644 index 0000000000000..36f533579fb72 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/ApiDefinitionsClient.java @@ -0,0 +1,361 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.apicenter.fluent.models.ApiDefinitionInner; +import com.azure.resourcemanager.apicenter.fluent.models.ApiSpecExportResultInner; +import com.azure.resourcemanager.apicenter.models.ApiDefinitionsCreateOrUpdateResponse; +import com.azure.resourcemanager.apicenter.models.ApiDefinitionsGetResponse; +import com.azure.resourcemanager.apicenter.models.ApiSpecImportRequest; + +/** + * An instance of this class provides access to all the operations defined in ApiDefinitionsClient. + */ +public interface ApiDefinitionsClient { + /** + * Returns a collection of API definitions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ApiDefinition list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String serviceName, String workspaceName, + String apiName, String versionName); + + /** + * Returns a collection of API definitions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param filter OData filter parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ApiDefinition list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String serviceName, String workspaceName, + String apiName, String versionName, String filter, Context context); + + /** + * Returns details of the API definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param definitionName The name of the API definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aPI definition entity. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApiDefinitionsGetResponse getWithResponse(String resourceGroupName, String serviceName, String workspaceName, + String apiName, String versionName, String definitionName, Context context); + + /** + * Returns details of the API definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param definitionName The name of the API definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aPI definition entity. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApiDefinitionInner get(String resourceGroupName, String serviceName, String workspaceName, String apiName, + String versionName, String definitionName); + + /** + * Creates new or updates existing API definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param definitionName The name of the API definition. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aPI definition entity. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApiDefinitionsCreateOrUpdateResponse createOrUpdateWithResponse(String resourceGroupName, String serviceName, + String workspaceName, String apiName, String versionName, String definitionName, ApiDefinitionInner resource, + Context context); + + /** + * Creates new or updates existing API definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param definitionName The name of the API definition. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aPI definition entity. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApiDefinitionInner createOrUpdate(String resourceGroupName, String serviceName, String workspaceName, + String apiName, String versionName, String definitionName, ApiDefinitionInner resource); + + /** + * Deletes specified API definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param definitionName The name of the API definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String serviceName, String workspaceName, + String apiName, String versionName, String definitionName, Context context); + + /** + * Deletes specified API definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param definitionName The name of the API definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String serviceName, String workspaceName, String apiName, String versionName, + String definitionName); + + /** + * Checks if specified API definition exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param definitionName The name of the API definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response headWithResponse(String resourceGroupName, String serviceName, String workspaceName, String apiName, + String versionName, String definitionName, Context context); + + /** + * Checks if specified API definition exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param definitionName The name of the API definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void head(String resourceGroupName, String serviceName, String workspaceName, String apiName, String versionName, + String definitionName); + + /** + * Exports the API specification. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param definitionName The name of the API definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the API specification export result. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ApiSpecExportResultInner> beginExportSpecification( + String resourceGroupName, String serviceName, String workspaceName, String apiName, String versionName, + String definitionName); + + /** + * Exports the API specification. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param definitionName The name of the API definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the API specification export result. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ApiSpecExportResultInner> beginExportSpecification( + String resourceGroupName, String serviceName, String workspaceName, String apiName, String versionName, + String definitionName, Context context); + + /** + * Exports the API specification. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param definitionName The name of the API definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the API specification export result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApiSpecExportResultInner exportSpecification(String resourceGroupName, String serviceName, String workspaceName, + String apiName, String versionName, String definitionName); + + /** + * Exports the API specification. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param definitionName The name of the API definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the API specification export result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApiSpecExportResultInner exportSpecification(String resourceGroupName, String serviceName, String workspaceName, + String apiName, String versionName, String definitionName, Context context); + + /** + * Imports the API specification. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param definitionName The name of the API definition. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginImportSpecification(String resourceGroupName, String serviceName, + String workspaceName, String apiName, String versionName, String definitionName, ApiSpecImportRequest body); + + /** + * Imports the API specification. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param definitionName The name of the API definition. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginImportSpecification(String resourceGroupName, String serviceName, + String workspaceName, String apiName, String versionName, String definitionName, ApiSpecImportRequest body, + Context context); + + /** + * Imports the API specification. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param definitionName The name of the API definition. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void importSpecification(String resourceGroupName, String serviceName, String workspaceName, String apiName, + String versionName, String definitionName, ApiSpecImportRequest body); + + /** + * Imports the API specification. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param definitionName The name of the API definition. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void importSpecification(String resourceGroupName, String serviceName, String workspaceName, String apiName, + String versionName, String definitionName, ApiSpecImportRequest body, Context context); +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/ApiVersionsClient.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/ApiVersionsClient.java new file mode 100644 index 0000000000000..42a060f893343 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/ApiVersionsClient.java @@ -0,0 +1,191 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.apicenter.fluent.models.ApiVersionInner; +import com.azure.resourcemanager.apicenter.models.ApiVersionsCreateOrUpdateResponse; +import com.azure.resourcemanager.apicenter.models.ApiVersionsGetResponse; + +/** + * An instance of this class provides access to all the operations defined in ApiVersionsClient. + */ +public interface ApiVersionsClient { + /** + * Returns a collection of API versions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ApiVersion list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String serviceName, String workspaceName, + String apiName); + + /** + * Returns a collection of API versions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param filter OData filter parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ApiVersion list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String serviceName, String workspaceName, + String apiName, String filter, Context context); + + /** + * Returns details of the API version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aPI version entity. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApiVersionsGetResponse getWithResponse(String resourceGroupName, String serviceName, String workspaceName, + String apiName, String versionName, Context context); + + /** + * Returns details of the API version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aPI version entity. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApiVersionInner get(String resourceGroupName, String serviceName, String workspaceName, String apiName, + String versionName); + + /** + * Creates new or updates existing API version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aPI version entity. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApiVersionsCreateOrUpdateResponse createOrUpdateWithResponse(String resourceGroupName, String serviceName, + String workspaceName, String apiName, String versionName, ApiVersionInner resource, Context context); + + /** + * Creates new or updates existing API version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aPI version entity. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApiVersionInner createOrUpdate(String resourceGroupName, String serviceName, String workspaceName, String apiName, + String versionName, ApiVersionInner resource); + + /** + * Deletes specified API version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String serviceName, String workspaceName, + String apiName, String versionName, Context context); + + /** + * Deletes specified API version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String serviceName, String workspaceName, String apiName, String versionName); + + /** + * Checks if specified API version exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response headWithResponse(String resourceGroupName, String serviceName, String workspaceName, String apiName, + String versionName, Context context); + + /** + * Checks if specified API version exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void head(String resourceGroupName, String serviceName, String workspaceName, String apiName, String versionName); +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/ApisClient.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/ApisClient.java new file mode 100644 index 0000000000000..0088bbc0299ed --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/ApisClient.java @@ -0,0 +1,179 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.apicenter.fluent.models.ApiInner; +import com.azure.resourcemanager.apicenter.models.ApisCreateOrUpdateResponse; +import com.azure.resourcemanager.apicenter.models.ApisGetResponse; + +/** + * An instance of this class provides access to all the operations defined in ApisClient. + */ +public interface ApisClient { + /** + * Returns a collection of APIs. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Api list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String serviceName, String workspaceName); + + /** + * Returns a collection of APIs. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param filter OData filter parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Api list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String serviceName, String workspaceName, String filter, + Context context); + + /** + * Returns details of the API. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aPI entity. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApisGetResponse getWithResponse(String resourceGroupName, String serviceName, String workspaceName, String apiName, + Context context); + + /** + * Returns details of the API. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aPI entity. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApiInner get(String resourceGroupName, String serviceName, String workspaceName, String apiName); + + /** + * Creates new or updates existing API. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aPI entity. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApisCreateOrUpdateResponse createOrUpdateWithResponse(String resourceGroupName, String serviceName, + String workspaceName, String apiName, ApiInner resource, Context context); + + /** + * Creates new or updates existing API. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aPI entity. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApiInner createOrUpdate(String resourceGroupName, String serviceName, String workspaceName, String apiName, + ApiInner resource); + + /** + * Deletes specified API. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String serviceName, String workspaceName, + String apiName, Context context); + + /** + * Deletes specified API. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String serviceName, String workspaceName, String apiName); + + /** + * Checks if specified API exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response headWithResponse(String resourceGroupName, String serviceName, String workspaceName, String apiName, + Context context); + + /** + * Checks if specified API exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void head(String resourceGroupName, String serviceName, String workspaceName, String apiName); +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/AzureApiCenter.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/AzureApiCenter.java index 7f3105526efa5..cf61cbe99d7cf 100644 --- a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/AzureApiCenter.java +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/AzureApiCenter.java @@ -7,54 +7,105 @@ import com.azure.core.http.HttpPipeline; import java.time.Duration; -/** The interface for AzureApiCenter class. */ +/** + * The interface for AzureApiCenter class. + */ public interface AzureApiCenter { /** - * Gets The ID of the target subscription. - * + * Gets The ID of the target subscription. The value must be an UUID. + * * @return the subscriptionId value. */ String getSubscriptionId(); /** * Gets server parameter. - * + * * @return the endpoint value. */ String getEndpoint(); /** * Gets Api Version. - * + * * @return the apiVersion value. */ String getApiVersion(); /** * Gets The HTTP pipeline to send requests through. - * + * * @return the httpPipeline value. */ HttpPipeline getHttpPipeline(); /** * Gets The default poll interval for long-running operation. - * + * * @return the defaultPollInterval value. */ Duration getDefaultPollInterval(); /** * Gets the OperationsClient object to access its operations. - * + * * @return the OperationsClient object. */ OperationsClient getOperations(); /** * Gets the ServicesClient object to access its operations. - * + * * @return the ServicesClient object. */ ServicesClient getServices(); + + /** + * Gets the MetadataSchemasClient object to access its operations. + * + * @return the MetadataSchemasClient object. + */ + MetadataSchemasClient getMetadataSchemas(); + + /** + * Gets the WorkspacesClient object to access its operations. + * + * @return the WorkspacesClient object. + */ + WorkspacesClient getWorkspaces(); + + /** + * Gets the ApisClient object to access its operations. + * + * @return the ApisClient object. + */ + ApisClient getApis(); + + /** + * Gets the DeploymentsClient object to access its operations. + * + * @return the DeploymentsClient object. + */ + DeploymentsClient getDeployments(); + + /** + * Gets the ApiVersionsClient object to access its operations. + * + * @return the ApiVersionsClient object. + */ + ApiVersionsClient getApiVersions(); + + /** + * Gets the ApiDefinitionsClient object to access its operations. + * + * @return the ApiDefinitionsClient object. + */ + ApiDefinitionsClient getApiDefinitions(); + + /** + * Gets the EnvironmentsClient object to access its operations. + * + * @return the EnvironmentsClient object. + */ + EnvironmentsClient getEnvironments(); } diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/DeploymentsClient.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/DeploymentsClient.java new file mode 100644 index 0000000000000..3072c2f0a18d0 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/DeploymentsClient.java @@ -0,0 +1,193 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.apicenter.fluent.models.DeploymentInner; +import com.azure.resourcemanager.apicenter.models.DeploymentsCreateOrUpdateResponse; +import com.azure.resourcemanager.apicenter.models.DeploymentsGetResponse; + +/** + * An instance of this class provides access to all the operations defined in DeploymentsClient. + */ +public interface DeploymentsClient { + /** + * Returns a collection of API deployments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Deployment list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String serviceName, String workspaceName, + String apiName); + + /** + * Returns a collection of API deployments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param filter OData filter parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Deployment list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String serviceName, String workspaceName, + String apiName, String filter, Context context); + + /** + * Returns details of the API deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param deploymentName The name of the API deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aPI deployment entity. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DeploymentsGetResponse getWithResponse(String resourceGroupName, String serviceName, String workspaceName, + String apiName, String deploymentName, Context context); + + /** + * Returns details of the API deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param deploymentName The name of the API deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aPI deployment entity. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DeploymentInner get(String resourceGroupName, String serviceName, String workspaceName, String apiName, + String deploymentName); + + /** + * Creates new or updates existing API deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param deploymentName The name of the API deployment. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aPI deployment entity. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DeploymentsCreateOrUpdateResponse createOrUpdateWithResponse(String resourceGroupName, String serviceName, + String workspaceName, String apiName, String deploymentName, DeploymentInner resource, Context context); + + /** + * Creates new or updates existing API deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param deploymentName The name of the API deployment. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aPI deployment entity. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DeploymentInner createOrUpdate(String resourceGroupName, String serviceName, String workspaceName, String apiName, + String deploymentName, DeploymentInner resource); + + /** + * Deletes API deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param deploymentName The name of the API deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String serviceName, String workspaceName, + String apiName, String deploymentName, Context context); + + /** + * Deletes API deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param deploymentName The name of the API deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String serviceName, String workspaceName, String apiName, + String deploymentName); + + /** + * Checks if specified API deployment exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param deploymentName The name of the API deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response headWithResponse(String resourceGroupName, String serviceName, String workspaceName, String apiName, + String deploymentName, Context context); + + /** + * Checks if specified API deployment exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param deploymentName The name of the API deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void head(String resourceGroupName, String serviceName, String workspaceName, String apiName, + String deploymentName); +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/EnvironmentsClient.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/EnvironmentsClient.java new file mode 100644 index 0000000000000..121bd28a18071 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/EnvironmentsClient.java @@ -0,0 +1,179 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.apicenter.fluent.models.EnvironmentInner; +import com.azure.resourcemanager.apicenter.models.EnvironmentsCreateOrUpdateResponse; +import com.azure.resourcemanager.apicenter.models.EnvironmentsGetResponse; + +/** + * An instance of this class provides access to all the operations defined in EnvironmentsClient. + */ +public interface EnvironmentsClient { + /** + * Returns a collection of environments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Environment list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String serviceName, String workspaceName); + + /** + * Returns a collection of environments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param filter OData filter parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Environment list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String serviceName, String workspaceName, + String filter, Context context); + + /** + * Returns details of the environment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param environmentName The name of the environment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return environment entity. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + EnvironmentsGetResponse getWithResponse(String resourceGroupName, String serviceName, String workspaceName, + String environmentName, Context context); + + /** + * Returns details of the environment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param environmentName The name of the environment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return environment entity. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + EnvironmentInner get(String resourceGroupName, String serviceName, String workspaceName, String environmentName); + + /** + * Creates new or updates existing environment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param environmentName The name of the environment. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return environment entity. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + EnvironmentsCreateOrUpdateResponse createOrUpdateWithResponse(String resourceGroupName, String serviceName, + String workspaceName, String environmentName, EnvironmentInner resource, Context context); + + /** + * Creates new or updates existing environment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param environmentName The name of the environment. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return environment entity. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + EnvironmentInner createOrUpdate(String resourceGroupName, String serviceName, String workspaceName, + String environmentName, EnvironmentInner resource); + + /** + * Deletes the environment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param environmentName The name of the environment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String serviceName, String workspaceName, + String environmentName, Context context); + + /** + * Deletes the environment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param environmentName The name of the environment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String serviceName, String workspaceName, String environmentName); + + /** + * Checks if specified environment exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param environmentName The name of the environment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response headWithResponse(String resourceGroupName, String serviceName, String workspaceName, + String environmentName, Context context); + + /** + * Checks if specified environment exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param environmentName The name of the environment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void head(String resourceGroupName, String serviceName, String workspaceName, String environmentName); +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/MetadataSchemasClient.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/MetadataSchemasClient.java new file mode 100644 index 0000000000000..2525a3851db02 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/MetadataSchemasClient.java @@ -0,0 +1,169 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.apicenter.fluent.models.MetadataSchemaInner; +import com.azure.resourcemanager.apicenter.models.MetadataSchemasCreateOrUpdateResponse; +import com.azure.resourcemanager.apicenter.models.MetadataSchemasGetResponse; + +/** + * An instance of this class provides access to all the operations defined in MetadataSchemasClient. + */ +public interface MetadataSchemasClient { + /** + * Returns a collection of metadata schemas. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a MetadataSchema list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String serviceName); + + /** + * Returns a collection of metadata schemas. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param filter OData filter parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a MetadataSchema list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String serviceName, String filter, + Context context); + + /** + * Returns details of the metadata schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param metadataSchemaName The name of the metadata schema. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metadata schema entity. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MetadataSchemasGetResponse getWithResponse(String resourceGroupName, String serviceName, String metadataSchemaName, + Context context); + + /** + * Returns details of the metadata schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param metadataSchemaName The name of the metadata schema. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metadata schema entity. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MetadataSchemaInner get(String resourceGroupName, String serviceName, String metadataSchemaName); + + /** + * Creates new or updates existing metadata schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param metadataSchemaName The name of the metadata schema. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metadata schema entity. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MetadataSchemasCreateOrUpdateResponse createOrUpdateWithResponse(String resourceGroupName, String serviceName, + String metadataSchemaName, MetadataSchemaInner resource, Context context); + + /** + * Creates new or updates existing metadata schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param metadataSchemaName The name of the metadata schema. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metadata schema entity. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MetadataSchemaInner createOrUpdate(String resourceGroupName, String serviceName, String metadataSchemaName, + MetadataSchemaInner resource); + + /** + * Deletes specified metadata schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param metadataSchemaName The name of the metadata schema. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String serviceName, String metadataSchemaName, + Context context); + + /** + * Deletes specified metadata schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param metadataSchemaName The name of the metadata schema. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String serviceName, String metadataSchemaName); + + /** + * Checks if specified metadata schema exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param metadataSchemaName The name of the metadata schema. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response headWithResponse(String resourceGroupName, String serviceName, String metadataSchemaName, + Context context); + + /** + * Checks if specified metadata schema exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param metadataSchemaName The name of the metadata schema. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void head(String resourceGroupName, String serviceName, String metadataSchemaName); +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/OperationsClient.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/OperationsClient.java index 902461a5dad42..989013175b1b1 100644 --- a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/OperationsClient.java +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/OperationsClient.java @@ -10,28 +10,30 @@ import com.azure.core.util.Context; import com.azure.resourcemanager.apicenter.fluent.models.OperationInner; -/** An instance of this class provides access to all the operations defined in OperationsClient. */ +/** + * An instance of this class provides access to all the operations defined in OperationsClient. + */ public interface OperationsClient { /** * List the operations for the provider. - * + * * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with {@link - * PagedIterable}. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable list(); /** * List the operations for the provider. - * + * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with {@link - * PagedIterable}. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable list(Context context); diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/ServicesClient.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/ServicesClient.java index db5e2f5e31006..feb8a8f2dca34 100644 --- a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/ServicesClient.java +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/ServicesClient.java @@ -8,15 +8,21 @@ import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.PagedIterable; import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.apicenter.fluent.models.MetadataSchemaExportResultInner; import com.azure.resourcemanager.apicenter.fluent.models.ServiceInner; +import com.azure.resourcemanager.apicenter.models.MetadataSchemaExportRequest; import com.azure.resourcemanager.apicenter.models.ServiceUpdate; -/** An instance of this class provides access to all the operations defined in ServicesClient. */ +/** + * An instance of this class provides access to all the operations defined in ServicesClient. + */ public interface ServicesClient { /** * Lists services within an Azure subscription. - * + * * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response of a Service list operation as paginated response with {@link PagedIterable}. @@ -26,7 +32,7 @@ public interface ServicesClient { /** * Lists services within an Azure subscription. - * + * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -37,8 +43,8 @@ public interface ServicesClient { PagedIterable list(Context context); /** - * Lists services within a resource group. - * + * Returns a collection of services within the resource group. + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -49,8 +55,8 @@ public interface ServicesClient { PagedIterable listByResourceGroup(String resourceGroupName); /** - * Lists services within a resource group. - * + * Returns a collection of services within the resource group. + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -62,39 +68,39 @@ public interface ServicesClient { PagedIterable listByResourceGroup(String resourceGroupName, Context context); /** - * Get service. - * + * Returns details of the service. + * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serviceName Service name. + * @param serviceName The name of Azure API Center service. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return service along with {@link Response}. + * @return the service entity along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - Response getByResourceGroupWithResponse( - String resourceGroupName, String serviceName, Context context); + Response getByResourceGroupWithResponse(String resourceGroupName, String serviceName, + Context context); /** - * Get service. - * + * Returns details of the service. + * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serviceName Service name. + * @param serviceName The name of Azure API Center service. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return service. + * @return the service entity. */ @ServiceMethod(returns = ReturnType.SINGLE) ServiceInner getByResourceGroup(String resourceGroupName, String serviceName); /** - * Create or update service. - * + * Creates new or updates existing API. + * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serviceName Service name. - * @param resource The service entity. + * @param serviceName The name of Azure API Center service. + * @param resource Resource create parameters. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -102,28 +108,29 @@ Response getByResourceGroupWithResponse( * @return the service entity along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - Response createOrUpdateWithResponse( - String resourceGroupName, String serviceName, ServiceInner resource, Context context); + Response createOrUpdateWithResponse(String resourceGroupName, String serviceName, + ServiceInner resource, Context context); /** - * Create or update service. - * + * Creates new or updates existing API. + * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serviceName Service name. + * @param serviceName The name of Azure API Center service. + * @param resource Resource create parameters. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the service entity. */ @ServiceMethod(returns = ReturnType.SINGLE) - ServiceInner createOrUpdate(String resourceGroupName, String serviceName); + ServiceInner createOrUpdate(String resourceGroupName, String serviceName, ServiceInner resource); /** - * Update service. - * + * Updates existing service. + * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serviceName Service name. - * @param parameters The service properties to be updated. + * @param serviceName The name of Azure API Center service. + * @param properties The resource properties to be updated. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -131,27 +138,28 @@ Response createOrUpdateWithResponse( * @return the service entity along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - Response updateWithResponse( - String resourceGroupName, String serviceName, ServiceUpdate parameters, Context context); + Response updateWithResponse(String resourceGroupName, String serviceName, ServiceUpdate properties, + Context context); /** - * Update service. - * + * Updates existing service. + * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serviceName Service name. + * @param serviceName The name of Azure API Center service. + * @param properties The resource properties to be updated. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the service entity. */ @ServiceMethod(returns = ReturnType.SINGLE) - ServiceInner update(String resourceGroupName, String serviceName); + ServiceInner update(String resourceGroupName, String serviceName, ServiceUpdate properties); /** - * Delete service. - * + * Deletes specified service. + * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serviceName Service name. + * @param serviceName The name of Azure API Center service. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -162,14 +170,76 @@ Response updateWithResponse( Response deleteWithResponse(String resourceGroupName, String serviceName, Context context); /** - * Delete service. - * + * Deletes specified service. + * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serviceName Service name. + * @param serviceName The name of Azure API Center service. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */ @ServiceMethod(returns = ReturnType.SINGLE) void delete(String resourceGroupName, String serviceName); + + /** + * Exports the effective metadata schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the metadata schema export result. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, MetadataSchemaExportResultInner> + beginExportMetadataSchema(String resourceGroupName, String serviceName, MetadataSchemaExportRequest body); + + /** + * Exports the effective metadata schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the metadata schema export result. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, MetadataSchemaExportResultInner> beginExportMetadataSchema( + String resourceGroupName, String serviceName, MetadataSchemaExportRequest body, Context context); + + /** + * Exports the effective metadata schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the metadata schema export result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MetadataSchemaExportResultInner exportMetadataSchema(String resourceGroupName, String serviceName, + MetadataSchemaExportRequest body); + + /** + * Exports the effective metadata schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the metadata schema export result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MetadataSchemaExportResultInner exportMetadataSchema(String resourceGroupName, String serviceName, + MetadataSchemaExportRequest body, Context context); } diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/WorkspacesClient.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/WorkspacesClient.java new file mode 100644 index 0000000000000..7804c5c215861 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/WorkspacesClient.java @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.apicenter.fluent.models.WorkspaceInner; +import com.azure.resourcemanager.apicenter.models.WorkspacesCreateOrUpdateResponse; +import com.azure.resourcemanager.apicenter.models.WorkspacesGetResponse; + +/** + * An instance of this class provides access to all the operations defined in WorkspacesClient. + */ +public interface WorkspacesClient { + /** + * Returns a collection of workspaces. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Workspace list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String serviceName); + + /** + * Returns a collection of workspaces. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param filter OData filter parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Workspace list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String serviceName, String filter, Context context); + + /** + * Returns details of the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workspace entity. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WorkspacesGetResponse getWithResponse(String resourceGroupName, String serviceName, String workspaceName, + Context context); + + /** + * Returns details of the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workspace entity. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WorkspaceInner get(String resourceGroupName, String serviceName, String workspaceName); + + /** + * Creates new or updates existing workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workspace entity. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WorkspacesCreateOrUpdateResponse createOrUpdateWithResponse(String resourceGroupName, String serviceName, + String workspaceName, WorkspaceInner resource, Context context); + + /** + * Creates new or updates existing workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workspace entity. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WorkspaceInner createOrUpdate(String resourceGroupName, String serviceName, String workspaceName, + WorkspaceInner resource); + + /** + * Deletes specified workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String serviceName, String workspaceName, + Context context); + + /** + * Deletes specified workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String serviceName, String workspaceName); + + /** + * Checks if specified workspace exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response headWithResponse(String resourceGroupName, String serviceName, String workspaceName, + Context context); + + /** + * Checks if specified workspace exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void head(String resourceGroupName, String serviceName, String workspaceName); +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/models/ApiDefinitionInner.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/models/ApiDefinitionInner.java new file mode 100644 index 0000000000000..ccedf7e7ced9d --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/models/ApiDefinitionInner.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.apicenter.models.ApiDefinitionProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * API definition entity. + */ +@Fluent +public final class ApiDefinitionInner extends ProxyResource { + /* + * The resource-specific properties for this resource. + */ + @JsonProperty(value = "properties") + private ApiDefinitionProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** + * Creates an instance of ApiDefinitionInner class. + */ + public ApiDefinitionInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public ApiDefinitionProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the ApiDefinitionInner object itself. + */ + public ApiDefinitionInner withProperties(ApiDefinitionProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/models/ApiInner.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/models/ApiInner.java new file mode 100644 index 0000000000000..881f13910ca9e --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/models/ApiInner.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.apicenter.models.ApiProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * API entity. + */ +@Fluent +public final class ApiInner extends ProxyResource { + /* + * The resource-specific properties for this resource. + */ + @JsonProperty(value = "properties") + private ApiProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** + * Creates an instance of ApiInner class. + */ + public ApiInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public ApiProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the ApiInner object itself. + */ + public ApiInner withProperties(ApiProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/models/ApiSpecExportResultInner.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/models/ApiSpecExportResultInner.java new file mode 100644 index 0000000000000..406821d4e5d8c --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/models/ApiSpecExportResultInner.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.apicenter.models.ApiSpecExportResultFormat; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The API specification export result. + */ +@Fluent +public final class ApiSpecExportResultInner { + /* + * The format of exported result + */ + @JsonProperty(value = "format") + private ApiSpecExportResultFormat format; + + /* + * The result of the export operation. + */ + @JsonProperty(value = "value") + private String value; + + /** + * Creates an instance of ApiSpecExportResultInner class. + */ + public ApiSpecExportResultInner() { + } + + /** + * Get the format property: The format of exported result. + * + * @return the format value. + */ + public ApiSpecExportResultFormat format() { + return this.format; + } + + /** + * Set the format property: The format of exported result. + * + * @param format the format value to set. + * @return the ApiSpecExportResultInner object itself. + */ + public ApiSpecExportResultInner withFormat(ApiSpecExportResultFormat format) { + this.format = format; + return this; + } + + /** + * Get the value property: The result of the export operation. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Set the value property: The result of the export operation. + * + * @param value the value value to set. + * @return the ApiSpecExportResultInner object itself. + */ + public ApiSpecExportResultInner withValue(String value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/models/ApiVersionInner.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/models/ApiVersionInner.java new file mode 100644 index 0000000000000..9ac2ea192d34e --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/models/ApiVersionInner.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.apicenter.models.ApiVersionProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * API version entity. + */ +@Fluent +public final class ApiVersionInner extends ProxyResource { + /* + * The resource-specific properties for this resource. + */ + @JsonProperty(value = "properties") + private ApiVersionProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** + * Creates an instance of ApiVersionInner class. + */ + public ApiVersionInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public ApiVersionProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the ApiVersionInner object itself. + */ + public ApiVersionInner withProperties(ApiVersionProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/models/DeploymentInner.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/models/DeploymentInner.java new file mode 100644 index 0000000000000..53484849b0e6b --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/models/DeploymentInner.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.apicenter.models.DeploymentProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * API deployment entity. + */ +@Fluent +public final class DeploymentInner extends ProxyResource { + /* + * The resource-specific properties for this resource. + */ + @JsonProperty(value = "properties") + private DeploymentProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** + * Creates an instance of DeploymentInner class. + */ + public DeploymentInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public DeploymentProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the DeploymentInner object itself. + */ + public DeploymentInner withProperties(DeploymentProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/models/EnvironmentInner.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/models/EnvironmentInner.java new file mode 100644 index 0000000000000..c5110f1e2147f --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/models/EnvironmentInner.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.apicenter.models.EnvironmentProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Environment entity. + */ +@Fluent +public final class EnvironmentInner extends ProxyResource { + /* + * The resource-specific properties for this resource. + */ + @JsonProperty(value = "properties") + private EnvironmentProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** + * Creates an instance of EnvironmentInner class. + */ + public EnvironmentInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public EnvironmentProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the EnvironmentInner object itself. + */ + public EnvironmentInner withProperties(EnvironmentProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/models/MetadataSchemaExportResultInner.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/models/MetadataSchemaExportResultInner.java new file mode 100644 index 0000000000000..1e6627912cbf6 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/models/MetadataSchemaExportResultInner.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.apicenter.models.MetadataSchemaExportFormat; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The metadata schema export result. + */ +@Fluent +public final class MetadataSchemaExportResultInner { + /* + * The export format for the schema + */ + @JsonProperty(value = "format") + private MetadataSchemaExportFormat format; + + /* + * The result of the export operation. + */ + @JsonProperty(value = "value") + private String value; + + /** + * Creates an instance of MetadataSchemaExportResultInner class. + */ + public MetadataSchemaExportResultInner() { + } + + /** + * Get the format property: The export format for the schema. + * + * @return the format value. + */ + public MetadataSchemaExportFormat format() { + return this.format; + } + + /** + * Set the format property: The export format for the schema. + * + * @param format the format value to set. + * @return the MetadataSchemaExportResultInner object itself. + */ + public MetadataSchemaExportResultInner withFormat(MetadataSchemaExportFormat format) { + this.format = format; + return this; + } + + /** + * Get the value property: The result of the export operation. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Set the value property: The result of the export operation. + * + * @param value the value value to set. + * @return the MetadataSchemaExportResultInner object itself. + */ + public MetadataSchemaExportResultInner withValue(String value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/models/MetadataSchemaInner.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/models/MetadataSchemaInner.java new file mode 100644 index 0000000000000..384bddb2697ab --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/models/MetadataSchemaInner.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.apicenter.models.MetadataSchemaProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Metadata schema entity. Used to define metadata for the entities in API catalog. + */ +@Fluent +public final class MetadataSchemaInner extends ProxyResource { + /* + * The resource-specific properties for this resource. + */ + @JsonProperty(value = "properties") + private MetadataSchemaProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** + * Creates an instance of MetadataSchemaInner class. + */ + public MetadataSchemaInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public MetadataSchemaProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the MetadataSchemaInner object itself. + */ + public MetadataSchemaInner withProperties(MetadataSchemaProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/models/OperationInner.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/models/OperationInner.java index 423f2d203426e..a2940ca607fed 100644 --- a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/models/OperationInner.java +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/models/OperationInner.java @@ -12,8 +12,8 @@ /** * REST API Operation - * - *

Details of a REST API operation, returned from the Resource Provider Operations API. + * + * Details of a REST API operation, returned from the Resource Provider Operations API. */ @Fluent public final class OperationInner { @@ -50,14 +50,16 @@ public final class OperationInner { @JsonProperty(value = "actionType", access = JsonProperty.Access.WRITE_ONLY) private ActionType actionType; - /** Creates an instance of OperationInner class. */ + /** + * Creates an instance of OperationInner class. + */ public OperationInner() { } /** * Get the name property: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". - * + * * @return the name value. */ public String name() { @@ -67,7 +69,7 @@ public String name() { /** * Get the isDataAction property: Whether the operation applies to data-plane. This is "true" for data-plane * operations and "false" for ARM/control-plane operations. - * + * * @return the isDataAction value. */ public Boolean isDataAction() { @@ -76,7 +78,7 @@ public Boolean isDataAction() { /** * Get the display property: Localized display information for this particular operation. - * + * * @return the display value. */ public OperationDisplay display() { @@ -85,7 +87,7 @@ public OperationDisplay display() { /** * Set the display property: Localized display information for this particular operation. - * + * * @param display the display value to set. * @return the OperationInner object itself. */ @@ -97,7 +99,7 @@ public OperationInner withDisplay(OperationDisplay display) { /** * Get the origin property: The intended executor of the operation; as in Resource Based Access Control (RBAC) and * audit logs UX. Default value is "user,system". - * + * * @return the origin value. */ public Origin origin() { @@ -107,7 +109,7 @@ public Origin origin() { /** * Get the actionType property: Enum. Indicates the action type. "Internal" refers to actions that are for internal * only APIs. - * + * * @return the actionType value. */ public ActionType actionType() { @@ -116,7 +118,7 @@ public ActionType actionType() { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/models/ServiceInner.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/models/ServiceInner.java index 7e7ca4c0ac3df..3e05eccabec8b 100644 --- a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/models/ServiceInner.java +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/models/ServiceInner.java @@ -8,21 +8,23 @@ import com.azure.core.management.Resource; import com.azure.core.management.SystemData; import com.azure.resourcemanager.apicenter.models.ManagedServiceIdentity; -import com.azure.resourcemanager.apicenter.models.ProvisioningState; +import com.azure.resourcemanager.apicenter.models.ServiceProperties; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.Map; -/** The service entity. */ +/** + * The service entity. + */ @Fluent public final class ServiceInner extends Resource { /* - * The properties of the service. + * The resource-specific properties for this resource. */ @JsonProperty(value = "properties") - private ServiceProperties innerProperties; + private ServiceProperties properties; /* - * The identity of the service. + * The managed service identities assigned to this resource. */ @JsonProperty(value = "identity") private ManagedServiceIdentity identity; @@ -33,22 +35,35 @@ public final class ServiceInner extends Resource { @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) private SystemData systemData; - /** Creates an instance of ServiceInner class. */ + /** + * Creates an instance of ServiceInner class. + */ public ServiceInner() { } /** - * Get the innerProperties property: The properties of the service. - * - * @return the innerProperties value. + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public ServiceProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the ServiceInner object itself. */ - private ServiceProperties innerProperties() { - return this.innerProperties; + public ServiceInner withProperties(ServiceProperties properties) { + this.properties = properties; + return this; } /** - * Get the identity property: The identity of the service. - * + * Get the identity property: The managed service identities assigned to this resource. + * * @return the identity value. */ public ManagedServiceIdentity identity() { @@ -56,8 +71,8 @@ public ManagedServiceIdentity identity() { } /** - * Set the identity property: The identity of the service. - * + * Set the identity property: The managed service identities assigned to this resource. + * * @param identity the identity value to set. * @return the ServiceInner object itself. */ @@ -68,44 +83,39 @@ public ServiceInner withIdentity(ManagedServiceIdentity identity) { /** * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. - * + * * @return the systemData value. */ public SystemData systemData() { return this.systemData; } - /** {@inheritDoc} */ + /** + * {@inheritDoc} + */ @Override public ServiceInner withLocation(String location) { super.withLocation(location); return this; } - /** {@inheritDoc} */ + /** + * {@inheritDoc} + */ @Override public ServiceInner withTags(Map tags) { super.withTags(tags); return this; } - /** - * Get the provisioningState property: The status of the last operation. - * - * @return the provisioningState value. - */ - public ProvisioningState provisioningState() { - return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); - } - /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { - if (innerProperties() != null) { - innerProperties().validate(); + if (properties() != null) { + properties().validate(); } if (identity() != null) { identity().validate(); diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/models/WorkspaceInner.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/models/WorkspaceInner.java new file mode 100644 index 0000000000000..f49bf28e8e43a --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/models/WorkspaceInner.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.apicenter.models.WorkspaceProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Workspace entity. + */ +@Fluent +public final class WorkspaceInner extends ProxyResource { + /* + * The resource-specific properties for this resource. + */ + @JsonProperty(value = "properties") + private WorkspaceProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** + * Creates an instance of WorkspaceInner class. + */ + public WorkspaceInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public WorkspaceProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the WorkspaceInner object itself. + */ + public WorkspaceInner withProperties(WorkspaceProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/models/package-info.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/models/package-info.java index 3a0ef29d83369..0435c3e8d2125 100644 --- a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/models/package-info.java +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/models/package-info.java @@ -2,5 +2,8 @@ // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. -/** Package containing the inner data models for AzureApiCenter. Azure API Center Resource Provider. */ +/** + * Package containing the inner data models for AzureApiCenter. + * Azure API Center Resource Provider. + */ package com.azure.resourcemanager.apicenter.fluent.models; diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/package-info.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/package-info.java index 1aa2615ea9496..5eba4426c44a7 100644 --- a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/package-info.java +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/package-info.java @@ -2,5 +2,8 @@ // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. -/** Package containing the service clients for AzureApiCenter. Azure API Center Resource Provider. */ +/** + * Package containing the service clients for AzureApiCenter. + * Azure API Center Resource Provider. + */ package com.azure.resourcemanager.apicenter.fluent; diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/ApiDefinitionImpl.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/ApiDefinitionImpl.java new file mode 100644 index 0000000000000..5d1c5d3b3a9e9 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/ApiDefinitionImpl.java @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.apicenter.fluent.models.ApiDefinitionInner; +import com.azure.resourcemanager.apicenter.models.ApiDefinition; +import com.azure.resourcemanager.apicenter.models.ApiDefinitionProperties; +import com.azure.resourcemanager.apicenter.models.ApiSpecExportResult; +import com.azure.resourcemanager.apicenter.models.ApiSpecImportRequest; + +public final class ApiDefinitionImpl implements ApiDefinition, ApiDefinition.Definition, ApiDefinition.Update { + private ApiDefinitionInner innerObject; + + private final com.azure.resourcemanager.apicenter.ApiCenterManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public ApiDefinitionProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public ApiDefinitionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.apicenter.ApiCenterManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serviceName; + + private String workspaceName; + + private String apiName; + + private String versionName; + + private String definitionName; + + public ApiDefinitionImpl withExistingVersion(String resourceGroupName, String serviceName, String workspaceName, + String apiName, String versionName) { + this.resourceGroupName = resourceGroupName; + this.serviceName = serviceName; + this.workspaceName = workspaceName; + this.apiName = apiName; + this.versionName = versionName; + return this; + } + + public ApiDefinition create() { + this.innerObject = serviceManager.serviceClient().getApiDefinitions() + .createOrUpdateWithResponse(resourceGroupName, serviceName, workspaceName, apiName, versionName, + definitionName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public ApiDefinition create(Context context) { + this.innerObject = serviceManager.serviceClient().getApiDefinitions() + .createOrUpdateWithResponse(resourceGroupName, serviceName, workspaceName, apiName, versionName, + definitionName, this.innerModel(), context) + .getValue(); + return this; + } + + ApiDefinitionImpl(String name, com.azure.resourcemanager.apicenter.ApiCenterManager serviceManager) { + this.innerObject = new ApiDefinitionInner(); + this.serviceManager = serviceManager; + this.definitionName = name; + } + + public ApiDefinitionImpl update() { + return this; + } + + public ApiDefinition apply() { + this.innerObject = serviceManager.serviceClient().getApiDefinitions() + .createOrUpdateWithResponse(resourceGroupName, serviceName, workspaceName, apiName, versionName, + definitionName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public ApiDefinition apply(Context context) { + this.innerObject = serviceManager.serviceClient().getApiDefinitions() + .createOrUpdateWithResponse(resourceGroupName, serviceName, workspaceName, apiName, versionName, + definitionName, this.innerModel(), context) + .getValue(); + return this; + } + + ApiDefinitionImpl(ApiDefinitionInner innerObject, + com.azure.resourcemanager.apicenter.ApiCenterManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serviceName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "services"); + this.workspaceName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "workspaces"); + this.apiName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "apis"); + this.versionName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "versions"); + this.definitionName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "definitions"); + } + + public ApiDefinition refresh() { + this.innerObject = serviceManager.serviceClient().getApiDefinitions().getWithResponse(resourceGroupName, + serviceName, workspaceName, apiName, versionName, definitionName, Context.NONE).getValue(); + return this; + } + + public ApiDefinition refresh(Context context) { + this.innerObject = serviceManager.serviceClient().getApiDefinitions().getWithResponse(resourceGroupName, + serviceName, workspaceName, apiName, versionName, definitionName, context).getValue(); + return this; + } + + public ApiSpecExportResult exportSpecification() { + return serviceManager.apiDefinitions().exportSpecification(resourceGroupName, serviceName, workspaceName, + apiName, versionName, definitionName); + } + + public ApiSpecExportResult exportSpecification(Context context) { + return serviceManager.apiDefinitions().exportSpecification(resourceGroupName, serviceName, workspaceName, + apiName, versionName, definitionName, context); + } + + public void importSpecification(ApiSpecImportRequest body) { + serviceManager.apiDefinitions().importSpecification(resourceGroupName, serviceName, workspaceName, apiName, + versionName, definitionName, body); + } + + public void importSpecification(ApiSpecImportRequest body, Context context) { + serviceManager.apiDefinitions().importSpecification(resourceGroupName, serviceName, workspaceName, apiName, + versionName, definitionName, body, context); + } + + public ApiDefinitionImpl withProperties(ApiDefinitionProperties properties) { + this.innerModel().withProperties(properties); + return this; + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/ApiDefinitionsClientImpl.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/ApiDefinitionsClientImpl.java new file mode 100644 index 0000000000000..3f8e857fa15d9 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/ApiDefinitionsClientImpl.java @@ -0,0 +1,1711 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.Head; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.apicenter.fluent.ApiDefinitionsClient; +import com.azure.resourcemanager.apicenter.fluent.models.ApiDefinitionInner; +import com.azure.resourcemanager.apicenter.fluent.models.ApiSpecExportResultInner; +import com.azure.resourcemanager.apicenter.models.ApiDefinitionListResult; +import com.azure.resourcemanager.apicenter.models.ApiDefinitionsCreateOrUpdateResponse; +import com.azure.resourcemanager.apicenter.models.ApiDefinitionsGetResponse; +import com.azure.resourcemanager.apicenter.models.ApiSpecImportRequest; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in ApiDefinitionsClient. + */ +public final class ApiDefinitionsClientImpl implements ApiDefinitionsClient { + /** + * The proxy service used to perform REST calls. + */ + private final ApiDefinitionsService service; + + /** + * The service client containing this operation class. + */ + private final AzureApiCenterImpl client; + + /** + * Initializes an instance of ApiDefinitionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ApiDefinitionsClientImpl(AzureApiCenterImpl client) { + this.service + = RestProxy.create(ApiDefinitionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureApiCenterApiDefinitions to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AzureApiCenterApiDef") + public interface ApiDefinitionsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/versions/{versionName}/definitions") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("serviceName") String serviceName, + @PathParam("workspaceName") String workspaceName, @PathParam("apiName") String apiName, + @PathParam("versionName") String versionName, @QueryParam("$filter") String filter, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/versions/{versionName}/definitions/{definitionName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono get(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("serviceName") String serviceName, + @PathParam("workspaceName") String workspaceName, @PathParam("apiName") String apiName, + @PathParam("versionName") String versionName, @PathParam("definitionName") String definitionName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/versions/{versionName}/definitions/{definitionName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono createOrUpdate(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("serviceName") String serviceName, + @PathParam("workspaceName") String workspaceName, @PathParam("apiName") String apiName, + @PathParam("versionName") String versionName, @PathParam("definitionName") String definitionName, + @BodyParam("application/json") ApiDefinitionInner resource, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/versions/{versionName}/definitions/{definitionName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("serviceName") String serviceName, + @PathParam("workspaceName") String workspaceName, @PathParam("apiName") String apiName, + @PathParam("versionName") String versionName, @PathParam("definitionName") String definitionName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Head("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/versions/{versionName}/definitions/{definitionName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> head(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("serviceName") String serviceName, + @PathParam("workspaceName") String workspaceName, @PathParam("apiName") String apiName, + @PathParam("versionName") String versionName, @PathParam("definitionName") String definitionName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/versions/{versionName}/definitions/{definitionName}/exportSpecification") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> exportSpecification(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("serviceName") String serviceName, + @PathParam("workspaceName") String workspaceName, @PathParam("apiName") String apiName, + @PathParam("versionName") String versionName, @PathParam("definitionName") String definitionName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/versions/{versionName}/definitions/{definitionName}/importSpecification") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> importSpecification(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("serviceName") String serviceName, + @PathParam("workspaceName") String workspaceName, @PathParam("apiName") String apiName, + @PathParam("versionName") String versionName, @PathParam("definitionName") String definitionName, + @BodyParam("application/json") ApiSpecImportRequest body, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * Returns a collection of API definitions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param filter OData filter parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ApiDefinition list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, String serviceName, + String workspaceName, String apiName, String versionName, String filter) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (apiName == null) { + return Mono.error(new IllegalArgumentException("Parameter apiName is required and cannot be null.")); + } + if (versionName == null) { + return Mono.error(new IllegalArgumentException("Parameter versionName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, serviceName, workspaceName, apiName, versionName, + filter, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns a collection of API definitions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param filter OData filter parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ApiDefinition list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, String serviceName, + String workspaceName, String apiName, String versionName, String filter, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (apiName == null) { + return Mono.error(new IllegalArgumentException("Parameter apiName is required and cannot be null.")); + } + if (versionName == null) { + return Mono.error(new IllegalArgumentException("Parameter versionName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, serviceName, workspaceName, apiName, versionName, filter, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Returns a collection of API definitions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param filter OData filter parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ApiDefinition list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String serviceName, String workspaceName, + String apiName, String versionName, String filter) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, serviceName, workspaceName, apiName, versionName, filter), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Returns a collection of API definitions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ApiDefinition list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String serviceName, String workspaceName, + String apiName, String versionName) { + final String filter = null; + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, serviceName, workspaceName, apiName, versionName, filter), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Returns a collection of API definitions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param filter OData filter parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ApiDefinition list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String serviceName, String workspaceName, + String apiName, String versionName, String filter, Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, serviceName, workspaceName, apiName, + versionName, filter, context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Returns a collection of API definitions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ApiDefinition list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String serviceName, String workspaceName, + String apiName, String versionName) { + final String filter = null; + return new PagedIterable<>( + listAsync(resourceGroupName, serviceName, workspaceName, apiName, versionName, filter)); + } + + /** + * Returns a collection of API definitions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param filter OData filter parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ApiDefinition list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String serviceName, String workspaceName, + String apiName, String versionName, String filter, Context context) { + return new PagedIterable<>( + listAsync(resourceGroupName, serviceName, workspaceName, apiName, versionName, filter, context)); + } + + /** + * Returns details of the API definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param definitionName The name of the API definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aPI definition entity on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getWithResponseAsync(String resourceGroupName, String serviceName, + String workspaceName, String apiName, String versionName, String definitionName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (apiName == null) { + return Mono.error(new IllegalArgumentException("Parameter apiName is required and cannot be null.")); + } + if (versionName == null) { + return Mono.error(new IllegalArgumentException("Parameter versionName is required and cannot be null.")); + } + if (definitionName == null) { + return Mono.error(new IllegalArgumentException("Parameter definitionName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, serviceName, workspaceName, apiName, versionName, + definitionName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns details of the API definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param definitionName The name of the API definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aPI definition entity on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getWithResponseAsync(String resourceGroupName, String serviceName, + String workspaceName, String apiName, String versionName, String definitionName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (apiName == null) { + return Mono.error(new IllegalArgumentException("Parameter apiName is required and cannot be null.")); + } + if (versionName == null) { + return Mono.error(new IllegalArgumentException("Parameter versionName is required and cannot be null.")); + } + if (definitionName == null) { + return Mono.error(new IllegalArgumentException("Parameter definitionName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, serviceName, workspaceName, apiName, versionName, definitionName, accept, context); + } + + /** + * Returns details of the API definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param definitionName The name of the API definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aPI definition entity on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String serviceName, String workspaceName, + String apiName, String versionName, String definitionName) { + return getWithResponseAsync(resourceGroupName, serviceName, workspaceName, apiName, versionName, definitionName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Returns details of the API definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param definitionName The name of the API definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aPI definition entity. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApiDefinitionsGetResponse getWithResponse(String resourceGroupName, String serviceName, String workspaceName, + String apiName, String versionName, String definitionName, Context context) { + return getWithResponseAsync(resourceGroupName, serviceName, workspaceName, apiName, versionName, definitionName, + context).block(); + } + + /** + * Returns details of the API definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param definitionName The name of the API definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aPI definition entity. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApiDefinitionInner get(String resourceGroupName, String serviceName, String workspaceName, String apiName, + String versionName, String definitionName) { + return getWithResponse(resourceGroupName, serviceName, workspaceName, apiName, versionName, definitionName, + Context.NONE).getValue(); + } + + /** + * Creates new or updates existing API definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param definitionName The name of the API definition. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aPI definition entity on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateWithResponseAsync(String resourceGroupName, + String serviceName, String workspaceName, String apiName, String versionName, String definitionName, + ApiDefinitionInner resource) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (apiName == null) { + return Mono.error(new IllegalArgumentException("Parameter apiName is required and cannot be null.")); + } + if (versionName == null) { + return Mono.error(new IllegalArgumentException("Parameter versionName is required and cannot be null.")); + } + if (definitionName == null) { + return Mono.error(new IllegalArgumentException("Parameter definitionName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, serviceName, workspaceName, apiName, versionName, + definitionName, resource, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates new or updates existing API definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param definitionName The name of the API definition. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aPI definition entity on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateWithResponseAsync(String resourceGroupName, + String serviceName, String workspaceName, String apiName, String versionName, String definitionName, + ApiDefinitionInner resource, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (apiName == null) { + return Mono.error(new IllegalArgumentException("Parameter apiName is required and cannot be null.")); + } + if (versionName == null) { + return Mono.error(new IllegalArgumentException("Parameter versionName is required and cannot be null.")); + } + if (definitionName == null) { + return Mono.error(new IllegalArgumentException("Parameter definitionName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, serviceName, workspaceName, apiName, versionName, + definitionName, resource, accept, context); + } + + /** + * Creates new or updates existing API definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param definitionName The name of the API definition. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aPI definition entity on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String serviceName, + String workspaceName, String apiName, String versionName, String definitionName, ApiDefinitionInner resource) { + return createOrUpdateWithResponseAsync(resourceGroupName, serviceName, workspaceName, apiName, versionName, + definitionName, resource).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates new or updates existing API definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param definitionName The name of the API definition. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aPI definition entity. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApiDefinitionsCreateOrUpdateResponse createOrUpdateWithResponse(String resourceGroupName, String serviceName, + String workspaceName, String apiName, String versionName, String definitionName, ApiDefinitionInner resource, + Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, serviceName, workspaceName, apiName, versionName, + definitionName, resource, context).block(); + } + + /** + * Creates new or updates existing API definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param definitionName The name of the API definition. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aPI definition entity. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApiDefinitionInner createOrUpdate(String resourceGroupName, String serviceName, String workspaceName, + String apiName, String versionName, String definitionName, ApiDefinitionInner resource) { + return createOrUpdateWithResponse(resourceGroupName, serviceName, workspaceName, apiName, versionName, + definitionName, resource, Context.NONE).getValue(); + } + + /** + * Deletes specified API definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param definitionName The name of the API definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String serviceName, + String workspaceName, String apiName, String versionName, String definitionName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (apiName == null) { + return Mono.error(new IllegalArgumentException("Parameter apiName is required and cannot be null.")); + } + if (versionName == null) { + return Mono.error(new IllegalArgumentException("Parameter versionName is required and cannot be null.")); + } + if (definitionName == null) { + return Mono.error(new IllegalArgumentException("Parameter definitionName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, serviceName, workspaceName, apiName, versionName, + definitionName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes specified API definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param definitionName The name of the API definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String serviceName, + String workspaceName, String apiName, String versionName, String definitionName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (apiName == null) { + return Mono.error(new IllegalArgumentException("Parameter apiName is required and cannot be null.")); + } + if (versionName == null) { + return Mono.error(new IllegalArgumentException("Parameter versionName is required and cannot be null.")); + } + if (definitionName == null) { + return Mono.error(new IllegalArgumentException("Parameter definitionName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, serviceName, workspaceName, apiName, versionName, definitionName, accept, context); + } + + /** + * Deletes specified API definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param definitionName The name of the API definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String serviceName, String workspaceName, String apiName, + String versionName, String definitionName) { + return deleteWithResponseAsync(resourceGroupName, serviceName, workspaceName, apiName, versionName, + definitionName).flatMap(ignored -> Mono.empty()); + } + + /** + * Deletes specified API definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param definitionName The name of the API definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String serviceName, String workspaceName, + String apiName, String versionName, String definitionName, Context context) { + return deleteWithResponseAsync(resourceGroupName, serviceName, workspaceName, apiName, versionName, + definitionName, context).block(); + } + + /** + * Deletes specified API definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param definitionName The name of the API definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String serviceName, String workspaceName, String apiName, + String versionName, String definitionName) { + deleteWithResponse(resourceGroupName, serviceName, workspaceName, apiName, versionName, definitionName, + Context.NONE); + } + + /** + * Checks if specified API definition exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param definitionName The name of the API definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> headWithResponseAsync(String resourceGroupName, String serviceName, + String workspaceName, String apiName, String versionName, String definitionName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (apiName == null) { + return Mono.error(new IllegalArgumentException("Parameter apiName is required and cannot be null.")); + } + if (versionName == null) { + return Mono.error(new IllegalArgumentException("Parameter versionName is required and cannot be null.")); + } + if (definitionName == null) { + return Mono.error(new IllegalArgumentException("Parameter definitionName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.head(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, serviceName, workspaceName, apiName, versionName, + definitionName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Checks if specified API definition exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param definitionName The name of the API definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> headWithResponseAsync(String resourceGroupName, String serviceName, + String workspaceName, String apiName, String versionName, String definitionName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (apiName == null) { + return Mono.error(new IllegalArgumentException("Parameter apiName is required and cannot be null.")); + } + if (versionName == null) { + return Mono.error(new IllegalArgumentException("Parameter versionName is required and cannot be null.")); + } + if (definitionName == null) { + return Mono.error(new IllegalArgumentException("Parameter definitionName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.head(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, serviceName, workspaceName, apiName, versionName, definitionName, accept, context); + } + + /** + * Checks if specified API definition exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param definitionName The name of the API definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono headAsync(String resourceGroupName, String serviceName, String workspaceName, String apiName, + String versionName, String definitionName) { + return headWithResponseAsync(resourceGroupName, serviceName, workspaceName, apiName, versionName, + definitionName).flatMap(ignored -> Mono.empty()); + } + + /** + * Checks if specified API definition exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param definitionName The name of the API definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response headWithResponse(String resourceGroupName, String serviceName, String workspaceName, + String apiName, String versionName, String definitionName, Context context) { + return headWithResponseAsync(resourceGroupName, serviceName, workspaceName, apiName, versionName, + definitionName, context).block(); + } + + /** + * Checks if specified API definition exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param definitionName The name of the API definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void head(String resourceGroupName, String serviceName, String workspaceName, String apiName, + String versionName, String definitionName) { + headWithResponse(resourceGroupName, serviceName, workspaceName, apiName, versionName, definitionName, + Context.NONE); + } + + /** + * Exports the API specification. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param definitionName The name of the API definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the API specification export result along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> exportSpecificationWithResponseAsync(String resourceGroupName, + String serviceName, String workspaceName, String apiName, String versionName, String definitionName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (apiName == null) { + return Mono.error(new IllegalArgumentException("Parameter apiName is required and cannot be null.")); + } + if (versionName == null) { + return Mono.error(new IllegalArgumentException("Parameter versionName is required and cannot be null.")); + } + if (definitionName == null) { + return Mono.error(new IllegalArgumentException("Parameter definitionName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.exportSpecification(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, serviceName, workspaceName, apiName, versionName, + definitionName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Exports the API specification. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param definitionName The name of the API definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the API specification export result along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> exportSpecificationWithResponseAsync(String resourceGroupName, + String serviceName, String workspaceName, String apiName, String versionName, String definitionName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (apiName == null) { + return Mono.error(new IllegalArgumentException("Parameter apiName is required and cannot be null.")); + } + if (versionName == null) { + return Mono.error(new IllegalArgumentException("Parameter versionName is required and cannot be null.")); + } + if (definitionName == null) { + return Mono.error(new IllegalArgumentException("Parameter definitionName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.exportSpecification(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, serviceName, workspaceName, apiName, versionName, + definitionName, accept, context); + } + + /** + * Exports the API specification. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param definitionName The name of the API definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of the API specification export result. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ApiSpecExportResultInner> beginExportSpecificationAsync( + String resourceGroupName, String serviceName, String workspaceName, String apiName, String versionName, + String definitionName) { + Mono>> mono = exportSpecificationWithResponseAsync(resourceGroupName, serviceName, + workspaceName, apiName, versionName, definitionName); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), ApiSpecExportResultInner.class, ApiSpecExportResultInner.class, + this.client.getContext()); + } + + /** + * Exports the API specification. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param definitionName The name of the API definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of the API specification export result. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ApiSpecExportResultInner> beginExportSpecificationAsync( + String resourceGroupName, String serviceName, String workspaceName, String apiName, String versionName, + String definitionName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = exportSpecificationWithResponseAsync(resourceGroupName, serviceName, + workspaceName, apiName, versionName, definitionName, context); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), ApiSpecExportResultInner.class, ApiSpecExportResultInner.class, context); + } + + /** + * Exports the API specification. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param definitionName The name of the API definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the API specification export result. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ApiSpecExportResultInner> beginExportSpecification( + String resourceGroupName, String serviceName, String workspaceName, String apiName, String versionName, + String definitionName) { + return this.beginExportSpecificationAsync(resourceGroupName, serviceName, workspaceName, apiName, versionName, + definitionName).getSyncPoller(); + } + + /** + * Exports the API specification. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param definitionName The name of the API definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the API specification export result. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ApiSpecExportResultInner> beginExportSpecification( + String resourceGroupName, String serviceName, String workspaceName, String apiName, String versionName, + String definitionName, Context context) { + return this.beginExportSpecificationAsync(resourceGroupName, serviceName, workspaceName, apiName, versionName, + definitionName, context).getSyncPoller(); + } + + /** + * Exports the API specification. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param definitionName The name of the API definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the API specification export result on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono exportSpecificationAsync(String resourceGroupName, String serviceName, + String workspaceName, String apiName, String versionName, String definitionName) { + return beginExportSpecificationAsync(resourceGroupName, serviceName, workspaceName, apiName, versionName, + definitionName).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Exports the API specification. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param definitionName The name of the API definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the API specification export result on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono exportSpecificationAsync(String resourceGroupName, String serviceName, + String workspaceName, String apiName, String versionName, String definitionName, Context context) { + return beginExportSpecificationAsync(resourceGroupName, serviceName, workspaceName, apiName, versionName, + definitionName, context).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Exports the API specification. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param definitionName The name of the API definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the API specification export result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApiSpecExportResultInner exportSpecification(String resourceGroupName, String serviceName, + String workspaceName, String apiName, String versionName, String definitionName) { + return exportSpecificationAsync(resourceGroupName, serviceName, workspaceName, apiName, versionName, + definitionName).block(); + } + + /** + * Exports the API specification. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param definitionName The name of the API definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the API specification export result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApiSpecExportResultInner exportSpecification(String resourceGroupName, String serviceName, + String workspaceName, String apiName, String versionName, String definitionName, Context context) { + return exportSpecificationAsync(resourceGroupName, serviceName, workspaceName, apiName, versionName, + definitionName, context).block(); + } + + /** + * Imports the API specification. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param definitionName The name of the API definition. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> importSpecificationWithResponseAsync(String resourceGroupName, + String serviceName, String workspaceName, String apiName, String versionName, String definitionName, + ApiSpecImportRequest body) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (apiName == null) { + return Mono.error(new IllegalArgumentException("Parameter apiName is required and cannot be null.")); + } + if (versionName == null) { + return Mono.error(new IllegalArgumentException("Parameter versionName is required and cannot be null.")); + } + if (definitionName == null) { + return Mono.error(new IllegalArgumentException("Parameter definitionName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.importSpecification(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, serviceName, workspaceName, apiName, versionName, + definitionName, body, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Imports the API specification. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param definitionName The name of the API definition. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> importSpecificationWithResponseAsync(String resourceGroupName, + String serviceName, String workspaceName, String apiName, String versionName, String definitionName, + ApiSpecImportRequest body, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (apiName == null) { + return Mono.error(new IllegalArgumentException("Parameter apiName is required and cannot be null.")); + } + if (versionName == null) { + return Mono.error(new IllegalArgumentException("Parameter versionName is required and cannot be null.")); + } + if (definitionName == null) { + return Mono.error(new IllegalArgumentException("Parameter definitionName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.importSpecification(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, serviceName, workspaceName, apiName, versionName, + definitionName, body, accept, context); + } + + /** + * Imports the API specification. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param definitionName The name of the API definition. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginImportSpecificationAsync(String resourceGroupName, + String serviceName, String workspaceName, String apiName, String versionName, String definitionName, + ApiSpecImportRequest body) { + Mono>> mono = importSpecificationWithResponseAsync(resourceGroupName, serviceName, + workspaceName, apiName, versionName, definitionName, body); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Imports the API specification. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param definitionName The name of the API definition. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginImportSpecificationAsync(String resourceGroupName, + String serviceName, String workspaceName, String apiName, String versionName, String definitionName, + ApiSpecImportRequest body, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = importSpecificationWithResponseAsync(resourceGroupName, serviceName, + workspaceName, apiName, versionName, definitionName, body, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + context); + } + + /** + * Imports the API specification. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param definitionName The name of the API definition. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginImportSpecification(String resourceGroupName, String serviceName, + String workspaceName, String apiName, String versionName, String definitionName, ApiSpecImportRequest body) { + return this.beginImportSpecificationAsync(resourceGroupName, serviceName, workspaceName, apiName, versionName, + definitionName, body).getSyncPoller(); + } + + /** + * Imports the API specification. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param definitionName The name of the API definition. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginImportSpecification(String resourceGroupName, String serviceName, + String workspaceName, String apiName, String versionName, String definitionName, ApiSpecImportRequest body, + Context context) { + return this.beginImportSpecificationAsync(resourceGroupName, serviceName, workspaceName, apiName, versionName, + definitionName, body, context).getSyncPoller(); + } + + /** + * Imports the API specification. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param definitionName The name of the API definition. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono importSpecificationAsync(String resourceGroupName, String serviceName, String workspaceName, + String apiName, String versionName, String definitionName, ApiSpecImportRequest body) { + return beginImportSpecificationAsync(resourceGroupName, serviceName, workspaceName, apiName, versionName, + definitionName, body).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Imports the API specification. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param definitionName The name of the API definition. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono importSpecificationAsync(String resourceGroupName, String serviceName, String workspaceName, + String apiName, String versionName, String definitionName, ApiSpecImportRequest body, Context context) { + return beginImportSpecificationAsync(resourceGroupName, serviceName, workspaceName, apiName, versionName, + definitionName, body, context).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Imports the API specification. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param definitionName The name of the API definition. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void importSpecification(String resourceGroupName, String serviceName, String workspaceName, String apiName, + String versionName, String definitionName, ApiSpecImportRequest body) { + importSpecificationAsync(resourceGroupName, serviceName, workspaceName, apiName, versionName, definitionName, + body).block(); + } + + /** + * Imports the API specification. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param definitionName The name of the API definition. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void importSpecification(String resourceGroupName, String serviceName, String workspaceName, String apiName, + String versionName, String definitionName, ApiSpecImportRequest body, Context context) { + importSpecificationAsync(resourceGroupName, serviceName, workspaceName, apiName, versionName, definitionName, + body, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + * + * The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ApiDefinition list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + * + * The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ApiDefinition list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/ApiDefinitionsImpl.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/ApiDefinitionsImpl.java new file mode 100644 index 0000000000000..74ebca1107d27 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/ApiDefinitionsImpl.java @@ -0,0 +1,279 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.apicenter.fluent.ApiDefinitionsClient; +import com.azure.resourcemanager.apicenter.fluent.models.ApiDefinitionInner; +import com.azure.resourcemanager.apicenter.fluent.models.ApiSpecExportResultInner; +import com.azure.resourcemanager.apicenter.models.ApiDefinition; +import com.azure.resourcemanager.apicenter.models.ApiDefinitions; +import com.azure.resourcemanager.apicenter.models.ApiDefinitionsGetResponse; +import com.azure.resourcemanager.apicenter.models.ApiSpecExportResult; +import com.azure.resourcemanager.apicenter.models.ApiSpecImportRequest; + +public final class ApiDefinitionsImpl implements ApiDefinitions { + private static final ClientLogger LOGGER = new ClientLogger(ApiDefinitionsImpl.class); + + private final ApiDefinitionsClient innerClient; + + private final com.azure.resourcemanager.apicenter.ApiCenterManager serviceManager; + + public ApiDefinitionsImpl(ApiDefinitionsClient innerClient, + com.azure.resourcemanager.apicenter.ApiCenterManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String serviceName, String workspaceName, + String apiName, String versionName) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, serviceName, workspaceName, apiName, versionName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ApiDefinitionImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String serviceName, String workspaceName, + String apiName, String versionName, String filter, Context context) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, serviceName, + workspaceName, apiName, versionName, filter, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ApiDefinitionImpl(inner1, this.manager())); + } + + public Response getWithResponse(String resourceGroupName, String serviceName, String workspaceName, + String apiName, String versionName, String definitionName, Context context) { + ApiDefinitionsGetResponse inner = this.serviceClient().getWithResponse(resourceGroupName, serviceName, + workspaceName, apiName, versionName, definitionName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new ApiDefinitionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ApiDefinition get(String resourceGroupName, String serviceName, String workspaceName, String apiName, + String versionName, String definitionName) { + ApiDefinitionInner inner = this.serviceClient().get(resourceGroupName, serviceName, workspaceName, apiName, + versionName, definitionName); + if (inner != null) { + return new ApiDefinitionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteWithResponse(String resourceGroupName, String serviceName, String workspaceName, + String apiName, String versionName, String definitionName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, serviceName, workspaceName, apiName, + versionName, definitionName, context); + } + + public void delete(String resourceGroupName, String serviceName, String workspaceName, String apiName, + String versionName, String definitionName) { + this.serviceClient().delete(resourceGroupName, serviceName, workspaceName, apiName, versionName, + definitionName); + } + + public Response headWithResponse(String resourceGroupName, String serviceName, String workspaceName, + String apiName, String versionName, String definitionName, Context context) { + return this.serviceClient().headWithResponse(resourceGroupName, serviceName, workspaceName, apiName, + versionName, definitionName, context); + } + + public void head(String resourceGroupName, String serviceName, String workspaceName, String apiName, + String versionName, String definitionName) { + this.serviceClient().head(resourceGroupName, serviceName, workspaceName, apiName, versionName, definitionName); + } + + public ApiSpecExportResult exportSpecification(String resourceGroupName, String serviceName, String workspaceName, + String apiName, String versionName, String definitionName) { + ApiSpecExportResultInner inner = this.serviceClient().exportSpecification(resourceGroupName, serviceName, + workspaceName, apiName, versionName, definitionName); + if (inner != null) { + return new ApiSpecExportResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public ApiSpecExportResult exportSpecification(String resourceGroupName, String serviceName, String workspaceName, + String apiName, String versionName, String definitionName, Context context) { + ApiSpecExportResultInner inner = this.serviceClient().exportSpecification(resourceGroupName, serviceName, + workspaceName, apiName, versionName, definitionName, context); + if (inner != null) { + return new ApiSpecExportResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public void importSpecification(String resourceGroupName, String serviceName, String workspaceName, String apiName, + String versionName, String definitionName, ApiSpecImportRequest body) { + this.serviceClient().importSpecification(resourceGroupName, serviceName, workspaceName, apiName, versionName, + definitionName, body); + } + + public void importSpecification(String resourceGroupName, String serviceName, String workspaceName, String apiName, + String versionName, String definitionName, ApiSpecImportRequest body, Context context) { + this.serviceClient().importSpecification(resourceGroupName, serviceName, workspaceName, apiName, versionName, + definitionName, body, context); + } + + public ApiDefinition getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serviceName = ResourceManagerUtils.getValueFromIdByName(id, "services"); + if (serviceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'services'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String apiName = ResourceManagerUtils.getValueFromIdByName(id, "apis"); + if (apiName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'apis'.", id))); + } + String versionName = ResourceManagerUtils.getValueFromIdByName(id, "versions"); + if (versionName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'versions'.", id))); + } + String definitionName = ResourceManagerUtils.getValueFromIdByName(id, "definitions"); + if (definitionName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'definitions'.", id))); + } + return this.getWithResponse(resourceGroupName, serviceName, workspaceName, apiName, versionName, definitionName, + Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serviceName = ResourceManagerUtils.getValueFromIdByName(id, "services"); + if (serviceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'services'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String apiName = ResourceManagerUtils.getValueFromIdByName(id, "apis"); + if (apiName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'apis'.", id))); + } + String versionName = ResourceManagerUtils.getValueFromIdByName(id, "versions"); + if (versionName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'versions'.", id))); + } + String definitionName = ResourceManagerUtils.getValueFromIdByName(id, "definitions"); + if (definitionName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'definitions'.", id))); + } + return this.getWithResponse(resourceGroupName, serviceName, workspaceName, apiName, versionName, definitionName, + context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serviceName = ResourceManagerUtils.getValueFromIdByName(id, "services"); + if (serviceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'services'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String apiName = ResourceManagerUtils.getValueFromIdByName(id, "apis"); + if (apiName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'apis'.", id))); + } + String versionName = ResourceManagerUtils.getValueFromIdByName(id, "versions"); + if (versionName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'versions'.", id))); + } + String definitionName = ResourceManagerUtils.getValueFromIdByName(id, "definitions"); + if (definitionName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'definitions'.", id))); + } + this.deleteWithResponse(resourceGroupName, serviceName, workspaceName, apiName, versionName, definitionName, + Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serviceName = ResourceManagerUtils.getValueFromIdByName(id, "services"); + if (serviceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'services'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String apiName = ResourceManagerUtils.getValueFromIdByName(id, "apis"); + if (apiName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'apis'.", id))); + } + String versionName = ResourceManagerUtils.getValueFromIdByName(id, "versions"); + if (versionName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'versions'.", id))); + } + String definitionName = ResourceManagerUtils.getValueFromIdByName(id, "definitions"); + if (definitionName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'definitions'.", id))); + } + return this.deleteWithResponse(resourceGroupName, serviceName, workspaceName, apiName, versionName, + definitionName, context); + } + + private ApiDefinitionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.apicenter.ApiCenterManager manager() { + return this.serviceManager; + } + + public ApiDefinitionImpl define(String name) { + return new ApiDefinitionImpl(name, this.manager()); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/ApiImpl.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/ApiImpl.java new file mode 100644 index 0000000000000..b078a43214fa5 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/ApiImpl.java @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.apicenter.fluent.models.ApiInner; +import com.azure.resourcemanager.apicenter.models.Api; +import com.azure.resourcemanager.apicenter.models.ApiProperties; + +public final class ApiImpl implements Api, Api.Definition, Api.Update { + private ApiInner innerObject; + + private final com.azure.resourcemanager.apicenter.ApiCenterManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public ApiProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public ApiInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.apicenter.ApiCenterManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serviceName; + + private String workspaceName; + + private String apiName; + + public ApiImpl withExistingWorkspace(String resourceGroupName, String serviceName, String workspaceName) { + this.resourceGroupName = resourceGroupName; + this.serviceName = serviceName; + this.workspaceName = workspaceName; + return this; + } + + public Api create() { + this.innerObject = serviceManager.serviceClient().getApis().createOrUpdateWithResponse(resourceGroupName, + serviceName, workspaceName, apiName, this.innerModel(), Context.NONE).getValue(); + return this; + } + + public Api create(Context context) { + this.innerObject = serviceManager.serviceClient().getApis().createOrUpdateWithResponse(resourceGroupName, + serviceName, workspaceName, apiName, this.innerModel(), context).getValue(); + return this; + } + + ApiImpl(String name, com.azure.resourcemanager.apicenter.ApiCenterManager serviceManager) { + this.innerObject = new ApiInner(); + this.serviceManager = serviceManager; + this.apiName = name; + } + + public ApiImpl update() { + return this; + } + + public Api apply() { + this.innerObject = serviceManager.serviceClient().getApis().createOrUpdateWithResponse(resourceGroupName, + serviceName, workspaceName, apiName, this.innerModel(), Context.NONE).getValue(); + return this; + } + + public Api apply(Context context) { + this.innerObject = serviceManager.serviceClient().getApis().createOrUpdateWithResponse(resourceGroupName, + serviceName, workspaceName, apiName, this.innerModel(), context).getValue(); + return this; + } + + ApiImpl(ApiInner innerObject, com.azure.resourcemanager.apicenter.ApiCenterManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serviceName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "services"); + this.workspaceName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "workspaces"); + this.apiName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "apis"); + } + + public Api refresh() { + this.innerObject = serviceManager.serviceClient().getApis() + .getWithResponse(resourceGroupName, serviceName, workspaceName, apiName, Context.NONE).getValue(); + return this; + } + + public Api refresh(Context context) { + this.innerObject = serviceManager.serviceClient().getApis() + .getWithResponse(resourceGroupName, serviceName, workspaceName, apiName, context).getValue(); + return this; + } + + public ApiImpl withProperties(ApiProperties properties) { + this.innerModel().withProperties(properties); + return this; + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/ApiSpecExportResultImpl.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/ApiSpecExportResultImpl.java new file mode 100644 index 0000000000000..e7fea655b6f2d --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/ApiSpecExportResultImpl.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.implementation; + +import com.azure.resourcemanager.apicenter.fluent.models.ApiSpecExportResultInner; +import com.azure.resourcemanager.apicenter.models.ApiSpecExportResult; +import com.azure.resourcemanager.apicenter.models.ApiSpecExportResultFormat; + +public final class ApiSpecExportResultImpl implements ApiSpecExportResult { + private ApiSpecExportResultInner innerObject; + + private final com.azure.resourcemanager.apicenter.ApiCenterManager serviceManager; + + ApiSpecExportResultImpl(ApiSpecExportResultInner innerObject, + com.azure.resourcemanager.apicenter.ApiCenterManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public ApiSpecExportResultFormat format() { + return this.innerModel().format(); + } + + public String value() { + return this.innerModel().value(); + } + + public ApiSpecExportResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.apicenter.ApiCenterManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/ApiVersionImpl.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/ApiVersionImpl.java new file mode 100644 index 0000000000000..6ae67df630dd8 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/ApiVersionImpl.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.apicenter.fluent.models.ApiVersionInner; +import com.azure.resourcemanager.apicenter.models.ApiVersion; +import com.azure.resourcemanager.apicenter.models.ApiVersionProperties; + +public final class ApiVersionImpl implements ApiVersion, ApiVersion.Definition, ApiVersion.Update { + private ApiVersionInner innerObject; + + private final com.azure.resourcemanager.apicenter.ApiCenterManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public ApiVersionProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public ApiVersionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.apicenter.ApiCenterManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serviceName; + + private String workspaceName; + + private String apiName; + + private String versionName; + + public ApiVersionImpl withExistingApi(String resourceGroupName, String serviceName, String workspaceName, + String apiName) { + this.resourceGroupName = resourceGroupName; + this.serviceName = serviceName; + this.workspaceName = workspaceName; + this.apiName = apiName; + return this; + } + + public ApiVersion create() { + this.innerObject = serviceManager.serviceClient().getApiVersions().createOrUpdateWithResponse(resourceGroupName, + serviceName, workspaceName, apiName, versionName, this.innerModel(), Context.NONE).getValue(); + return this; + } + + public ApiVersion create(Context context) { + this.innerObject = serviceManager.serviceClient().getApiVersions().createOrUpdateWithResponse(resourceGroupName, + serviceName, workspaceName, apiName, versionName, this.innerModel(), context).getValue(); + return this; + } + + ApiVersionImpl(String name, com.azure.resourcemanager.apicenter.ApiCenterManager serviceManager) { + this.innerObject = new ApiVersionInner(); + this.serviceManager = serviceManager; + this.versionName = name; + } + + public ApiVersionImpl update() { + return this; + } + + public ApiVersion apply() { + this.innerObject = serviceManager.serviceClient().getApiVersions().createOrUpdateWithResponse(resourceGroupName, + serviceName, workspaceName, apiName, versionName, this.innerModel(), Context.NONE).getValue(); + return this; + } + + public ApiVersion apply(Context context) { + this.innerObject = serviceManager.serviceClient().getApiVersions().createOrUpdateWithResponse(resourceGroupName, + serviceName, workspaceName, apiName, versionName, this.innerModel(), context).getValue(); + return this; + } + + ApiVersionImpl(ApiVersionInner innerObject, com.azure.resourcemanager.apicenter.ApiCenterManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serviceName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "services"); + this.workspaceName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "workspaces"); + this.apiName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "apis"); + this.versionName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "versions"); + } + + public ApiVersion refresh() { + this.innerObject = serviceManager.serviceClient().getApiVersions() + .getWithResponse(resourceGroupName, serviceName, workspaceName, apiName, versionName, Context.NONE) + .getValue(); + return this; + } + + public ApiVersion refresh(Context context) { + this.innerObject = serviceManager.serviceClient().getApiVersions() + .getWithResponse(resourceGroupName, serviceName, workspaceName, apiName, versionName, context).getValue(); + return this; + } + + public ApiVersionImpl withProperties(ApiVersionProperties properties) { + this.innerModel().withProperties(properties); + return this; + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/ApiVersionsClientImpl.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/ApiVersionsClientImpl.java new file mode 100644 index 0000000000000..24dbba883e4ad --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/ApiVersionsClientImpl.java @@ -0,0 +1,1022 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.Head; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.apicenter.fluent.ApiVersionsClient; +import com.azure.resourcemanager.apicenter.fluent.models.ApiVersionInner; +import com.azure.resourcemanager.apicenter.models.ApiVersionListResult; +import com.azure.resourcemanager.apicenter.models.ApiVersionsCreateOrUpdateResponse; +import com.azure.resourcemanager.apicenter.models.ApiVersionsGetResponse; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in ApiVersionsClient. + */ +public final class ApiVersionsClientImpl implements ApiVersionsClient { + /** + * The proxy service used to perform REST calls. + */ + private final ApiVersionsService service; + + /** + * The service client containing this operation class. + */ + private final AzureApiCenterImpl client; + + /** + * Initializes an instance of ApiVersionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ApiVersionsClientImpl(AzureApiCenterImpl client) { + this.service + = RestProxy.create(ApiVersionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureApiCenterApiVersions to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AzureApiCenterApiVer") + public interface ApiVersionsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/versions") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("serviceName") String serviceName, + @PathParam("workspaceName") String workspaceName, @PathParam("apiName") String apiName, + @QueryParam("$filter") String filter, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/versions/{versionName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono get(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("serviceName") String serviceName, + @PathParam("workspaceName") String workspaceName, @PathParam("apiName") String apiName, + @PathParam("versionName") String versionName, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/versions/{versionName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono createOrUpdate(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("serviceName") String serviceName, + @PathParam("workspaceName") String workspaceName, @PathParam("apiName") String apiName, + @PathParam("versionName") String versionName, @BodyParam("application/json") ApiVersionInner resource, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/versions/{versionName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("serviceName") String serviceName, + @PathParam("workspaceName") String workspaceName, @PathParam("apiName") String apiName, + @PathParam("versionName") String versionName, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Head("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/versions/{versionName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> head(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("serviceName") String serviceName, + @PathParam("workspaceName") String workspaceName, @PathParam("apiName") String apiName, + @PathParam("versionName") String versionName, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * Returns a collection of API versions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param filter OData filter parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ApiVersion list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, String serviceName, + String workspaceName, String apiName, String filter) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (apiName == null) { + return Mono.error(new IllegalArgumentException("Parameter apiName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, serviceName, workspaceName, apiName, filter, accept, + context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns a collection of API versions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param filter OData filter parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ApiVersion list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, String serviceName, + String workspaceName, String apiName, String filter, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (apiName == null) { + return Mono.error(new IllegalArgumentException("Parameter apiName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, serviceName, workspaceName, apiName, filter, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Returns a collection of API versions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param filter OData filter parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ApiVersion list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String serviceName, String workspaceName, + String apiName, String filter) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, serviceName, workspaceName, apiName, filter), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Returns a collection of API versions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ApiVersion list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String serviceName, String workspaceName, + String apiName) { + final String filter = null; + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, serviceName, workspaceName, apiName, filter), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Returns a collection of API versions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param filter OData filter parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ApiVersion list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String serviceName, String workspaceName, + String apiName, String filter, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, serviceName, workspaceName, apiName, filter, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Returns a collection of API versions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ApiVersion list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String serviceName, String workspaceName, + String apiName) { + final String filter = null; + return new PagedIterable<>(listAsync(resourceGroupName, serviceName, workspaceName, apiName, filter)); + } + + /** + * Returns a collection of API versions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param filter OData filter parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ApiVersion list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String serviceName, String workspaceName, + String apiName, String filter, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, serviceName, workspaceName, apiName, filter, context)); + } + + /** + * Returns details of the API version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aPI version entity on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getWithResponseAsync(String resourceGroupName, String serviceName, + String workspaceName, String apiName, String versionName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (apiName == null) { + return Mono.error(new IllegalArgumentException("Parameter apiName is required and cannot be null.")); + } + if (versionName == null) { + return Mono.error(new IllegalArgumentException("Parameter versionName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, serviceName, workspaceName, apiName, versionName, + accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns details of the API version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aPI version entity on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getWithResponseAsync(String resourceGroupName, String serviceName, + String workspaceName, String apiName, String versionName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (apiName == null) { + return Mono.error(new IllegalArgumentException("Parameter apiName is required and cannot be null.")); + } + if (versionName == null) { + return Mono.error(new IllegalArgumentException("Parameter versionName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, serviceName, workspaceName, apiName, versionName, accept, context); + } + + /** + * Returns details of the API version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aPI version entity on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String serviceName, String workspaceName, + String apiName, String versionName) { + return getWithResponseAsync(resourceGroupName, serviceName, workspaceName, apiName, versionName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Returns details of the API version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aPI version entity. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApiVersionsGetResponse getWithResponse(String resourceGroupName, String serviceName, String workspaceName, + String apiName, String versionName, Context context) { + return getWithResponseAsync(resourceGroupName, serviceName, workspaceName, apiName, versionName, context) + .block(); + } + + /** + * Returns details of the API version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aPI version entity. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApiVersionInner get(String resourceGroupName, String serviceName, String workspaceName, String apiName, + String versionName) { + return getWithResponse(resourceGroupName, serviceName, workspaceName, apiName, versionName, Context.NONE) + .getValue(); + } + + /** + * Creates new or updates existing API version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aPI version entity on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateWithResponseAsync(String resourceGroupName, + String serviceName, String workspaceName, String apiName, String versionName, ApiVersionInner resource) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (apiName == null) { + return Mono.error(new IllegalArgumentException("Parameter apiName is required and cannot be null.")); + } + if (versionName == null) { + return Mono.error(new IllegalArgumentException("Parameter versionName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, serviceName, workspaceName, apiName, versionName, + resource, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates new or updates existing API version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aPI version entity on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateWithResponseAsync(String resourceGroupName, + String serviceName, String workspaceName, String apiName, String versionName, ApiVersionInner resource, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (apiName == null) { + return Mono.error(new IllegalArgumentException("Parameter apiName is required and cannot be null.")); + } + if (versionName == null) { + return Mono.error(new IllegalArgumentException("Parameter versionName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, serviceName, workspaceName, apiName, versionName, + resource, accept, context); + } + + /** + * Creates new or updates existing API version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aPI version entity on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String serviceName, + String workspaceName, String apiName, String versionName, ApiVersionInner resource) { + return createOrUpdateWithResponseAsync(resourceGroupName, serviceName, workspaceName, apiName, versionName, + resource).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates new or updates existing API version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aPI version entity. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApiVersionsCreateOrUpdateResponse createOrUpdateWithResponse(String resourceGroupName, String serviceName, + String workspaceName, String apiName, String versionName, ApiVersionInner resource, Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, serviceName, workspaceName, apiName, versionName, + resource, context).block(); + } + + /** + * Creates new or updates existing API version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aPI version entity. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApiVersionInner createOrUpdate(String resourceGroupName, String serviceName, String workspaceName, + String apiName, String versionName, ApiVersionInner resource) { + return createOrUpdateWithResponse(resourceGroupName, serviceName, workspaceName, apiName, versionName, resource, + Context.NONE).getValue(); + } + + /** + * Deletes specified API version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String serviceName, + String workspaceName, String apiName, String versionName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (apiName == null) { + return Mono.error(new IllegalArgumentException("Parameter apiName is required and cannot be null.")); + } + if (versionName == null) { + return Mono.error(new IllegalArgumentException("Parameter versionName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, serviceName, workspaceName, apiName, versionName, + accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes specified API version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String serviceName, + String workspaceName, String apiName, String versionName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (apiName == null) { + return Mono.error(new IllegalArgumentException("Parameter apiName is required and cannot be null.")); + } + if (versionName == null) { + return Mono.error(new IllegalArgumentException("Parameter versionName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, serviceName, workspaceName, apiName, versionName, accept, context); + } + + /** + * Deletes specified API version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String serviceName, String workspaceName, String apiName, + String versionName) { + return deleteWithResponseAsync(resourceGroupName, serviceName, workspaceName, apiName, versionName) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Deletes specified API version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String serviceName, String workspaceName, + String apiName, String versionName, Context context) { + return deleteWithResponseAsync(resourceGroupName, serviceName, workspaceName, apiName, versionName, context) + .block(); + } + + /** + * Deletes specified API version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String serviceName, String workspaceName, String apiName, + String versionName) { + deleteWithResponse(resourceGroupName, serviceName, workspaceName, apiName, versionName, Context.NONE); + } + + /** + * Checks if specified API version exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> headWithResponseAsync(String resourceGroupName, String serviceName, + String workspaceName, String apiName, String versionName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (apiName == null) { + return Mono.error(new IllegalArgumentException("Parameter apiName is required and cannot be null.")); + } + if (versionName == null) { + return Mono.error(new IllegalArgumentException("Parameter versionName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.head(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, serviceName, workspaceName, apiName, versionName, + accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Checks if specified API version exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> headWithResponseAsync(String resourceGroupName, String serviceName, + String workspaceName, String apiName, String versionName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (apiName == null) { + return Mono.error(new IllegalArgumentException("Parameter apiName is required and cannot be null.")); + } + if (versionName == null) { + return Mono.error(new IllegalArgumentException("Parameter versionName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.head(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, serviceName, workspaceName, apiName, versionName, accept, context); + } + + /** + * Checks if specified API version exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono headAsync(String resourceGroupName, String serviceName, String workspaceName, String apiName, + String versionName) { + return headWithResponseAsync(resourceGroupName, serviceName, workspaceName, apiName, versionName) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Checks if specified API version exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response headWithResponse(String resourceGroupName, String serviceName, String workspaceName, + String apiName, String versionName, Context context) { + return headWithResponseAsync(resourceGroupName, serviceName, workspaceName, apiName, versionName, context) + .block(); + } + + /** + * Checks if specified API version exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void head(String resourceGroupName, String serviceName, String workspaceName, String apiName, + String versionName) { + headWithResponse(resourceGroupName, serviceName, workspaceName, apiName, versionName, Context.NONE); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + * + * The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ApiVersion list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + * + * The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ApiVersion list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/ApiVersionsImpl.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/ApiVersionsImpl.java new file mode 100644 index 0000000000000..7f672b0dc65a3 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/ApiVersionsImpl.java @@ -0,0 +1,218 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.apicenter.fluent.ApiVersionsClient; +import com.azure.resourcemanager.apicenter.fluent.models.ApiVersionInner; +import com.azure.resourcemanager.apicenter.models.ApiVersion; +import com.azure.resourcemanager.apicenter.models.ApiVersions; +import com.azure.resourcemanager.apicenter.models.ApiVersionsGetResponse; + +public final class ApiVersionsImpl implements ApiVersions { + private static final ClientLogger LOGGER = new ClientLogger(ApiVersionsImpl.class); + + private final ApiVersionsClient innerClient; + + private final com.azure.resourcemanager.apicenter.ApiCenterManager serviceManager; + + public ApiVersionsImpl(ApiVersionsClient innerClient, + com.azure.resourcemanager.apicenter.ApiCenterManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String serviceName, String workspaceName, + String apiName) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, serviceName, workspaceName, apiName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ApiVersionImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String serviceName, String workspaceName, + String apiName, String filter, Context context) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, serviceName, workspaceName, apiName, filter, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ApiVersionImpl(inner1, this.manager())); + } + + public Response getWithResponse(String resourceGroupName, String serviceName, String workspaceName, + String apiName, String versionName, Context context) { + ApiVersionsGetResponse inner = this.serviceClient().getWithResponse(resourceGroupName, serviceName, + workspaceName, apiName, versionName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new ApiVersionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ApiVersion get(String resourceGroupName, String serviceName, String workspaceName, String apiName, + String versionName) { + ApiVersionInner inner + = this.serviceClient().get(resourceGroupName, serviceName, workspaceName, apiName, versionName); + if (inner != null) { + return new ApiVersionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteWithResponse(String resourceGroupName, String serviceName, String workspaceName, + String apiName, String versionName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, serviceName, workspaceName, apiName, + versionName, context); + } + + public void delete(String resourceGroupName, String serviceName, String workspaceName, String apiName, + String versionName) { + this.serviceClient().delete(resourceGroupName, serviceName, workspaceName, apiName, versionName); + } + + public Response headWithResponse(String resourceGroupName, String serviceName, String workspaceName, + String apiName, String versionName, Context context) { + return this.serviceClient().headWithResponse(resourceGroupName, serviceName, workspaceName, apiName, + versionName, context); + } + + public void head(String resourceGroupName, String serviceName, String workspaceName, String apiName, + String versionName) { + this.serviceClient().head(resourceGroupName, serviceName, workspaceName, apiName, versionName); + } + + public ApiVersion getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serviceName = ResourceManagerUtils.getValueFromIdByName(id, "services"); + if (serviceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'services'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String apiName = ResourceManagerUtils.getValueFromIdByName(id, "apis"); + if (apiName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'apis'.", id))); + } + String versionName = ResourceManagerUtils.getValueFromIdByName(id, "versions"); + if (versionName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'versions'.", id))); + } + return this.getWithResponse(resourceGroupName, serviceName, workspaceName, apiName, versionName, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serviceName = ResourceManagerUtils.getValueFromIdByName(id, "services"); + if (serviceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'services'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String apiName = ResourceManagerUtils.getValueFromIdByName(id, "apis"); + if (apiName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'apis'.", id))); + } + String versionName = ResourceManagerUtils.getValueFromIdByName(id, "versions"); + if (versionName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'versions'.", id))); + } + return this.getWithResponse(resourceGroupName, serviceName, workspaceName, apiName, versionName, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serviceName = ResourceManagerUtils.getValueFromIdByName(id, "services"); + if (serviceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'services'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String apiName = ResourceManagerUtils.getValueFromIdByName(id, "apis"); + if (apiName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'apis'.", id))); + } + String versionName = ResourceManagerUtils.getValueFromIdByName(id, "versions"); + if (versionName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'versions'.", id))); + } + this.deleteWithResponse(resourceGroupName, serviceName, workspaceName, apiName, versionName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serviceName = ResourceManagerUtils.getValueFromIdByName(id, "services"); + if (serviceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'services'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String apiName = ResourceManagerUtils.getValueFromIdByName(id, "apis"); + if (apiName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'apis'.", id))); + } + String versionName = ResourceManagerUtils.getValueFromIdByName(id, "versions"); + if (versionName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'versions'.", id))); + } + return this.deleteWithResponse(resourceGroupName, serviceName, workspaceName, apiName, versionName, context); + } + + private ApiVersionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.apicenter.ApiCenterManager manager() { + return this.serviceManager; + } + + public ApiVersionImpl define(String name) { + return new ApiVersionImpl(name, this.manager()); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/ApisClientImpl.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/ApisClientImpl.java new file mode 100644 index 0000000000000..d56a027c11db8 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/ApisClientImpl.java @@ -0,0 +1,941 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.Head; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.apicenter.fluent.ApisClient; +import com.azure.resourcemanager.apicenter.fluent.models.ApiInner; +import com.azure.resourcemanager.apicenter.models.ApiListResult; +import com.azure.resourcemanager.apicenter.models.ApisCreateOrUpdateResponse; +import com.azure.resourcemanager.apicenter.models.ApisGetResponse; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in ApisClient. + */ +public final class ApisClientImpl implements ApisClient { + /** + * The proxy service used to perform REST calls. + */ + private final ApisService service; + + /** + * The service client containing this operation class. + */ + private final AzureApiCenterImpl client; + + /** + * Initializes an instance of ApisClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ApisClientImpl(AzureApiCenterImpl client) { + this.service = RestProxy.create(ApisService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureApiCenterApis to be used by the proxy service to perform REST + * calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AzureApiCenterApis") + public interface ApisService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("serviceName") String serviceName, + @PathParam("workspaceName") String workspaceName, @QueryParam("$filter") String filter, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono get(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("serviceName") String serviceName, + @PathParam("workspaceName") String workspaceName, @PathParam("apiName") String apiName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono createOrUpdate(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("serviceName") String serviceName, + @PathParam("workspaceName") String workspaceName, @PathParam("apiName") String apiName, + @BodyParam("application/json") ApiInner resource, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("serviceName") String serviceName, + @PathParam("workspaceName") String workspaceName, @PathParam("apiName") String apiName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Head("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> head(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("serviceName") String serviceName, + @PathParam("workspaceName") String workspaceName, @PathParam("apiName") String apiName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * Returns a collection of APIs. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param filter OData filter parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Api list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, String serviceName, + String workspaceName, String filter) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, serviceName, workspaceName, filter, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns a collection of APIs. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param filter OData filter parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Api list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, String serviceName, + String workspaceName, String filter, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, serviceName, workspaceName, filter, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Returns a collection of APIs. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param filter OData filter parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Api list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String serviceName, String workspaceName, + String filter) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, serviceName, workspaceName, filter), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Returns a collection of APIs. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Api list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String serviceName, String workspaceName) { + final String filter = null; + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, serviceName, workspaceName, filter), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Returns a collection of APIs. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param filter OData filter parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Api list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String serviceName, String workspaceName, + String filter, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, serviceName, workspaceName, filter, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Returns a collection of APIs. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Api list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String serviceName, String workspaceName) { + final String filter = null; + return new PagedIterable<>(listAsync(resourceGroupName, serviceName, workspaceName, filter)); + } + + /** + * Returns a collection of APIs. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param filter OData filter parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Api list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String serviceName, String workspaceName, + String filter, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, serviceName, workspaceName, filter, context)); + } + + /** + * Returns details of the API. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aPI entity on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getWithResponseAsync(String resourceGroupName, String serviceName, + String workspaceName, String apiName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (apiName == null) { + return Mono.error(new IllegalArgumentException("Parameter apiName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, serviceName, workspaceName, apiName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns details of the API. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aPI entity on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getWithResponseAsync(String resourceGroupName, String serviceName, + String workspaceName, String apiName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (apiName == null) { + return Mono.error(new IllegalArgumentException("Parameter apiName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, serviceName, workspaceName, apiName, accept, context); + } + + /** + * Returns details of the API. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aPI entity on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String serviceName, String workspaceName, + String apiName) { + return getWithResponseAsync(resourceGroupName, serviceName, workspaceName, apiName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Returns details of the API. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aPI entity. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApisGetResponse getWithResponse(String resourceGroupName, String serviceName, String workspaceName, + String apiName, Context context) { + return getWithResponseAsync(resourceGroupName, serviceName, workspaceName, apiName, context).block(); + } + + /** + * Returns details of the API. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aPI entity. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApiInner get(String resourceGroupName, String serviceName, String workspaceName, String apiName) { + return getWithResponse(resourceGroupName, serviceName, workspaceName, apiName, Context.NONE).getValue(); + } + + /** + * Creates new or updates existing API. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aPI entity on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateWithResponseAsync(String resourceGroupName, + String serviceName, String workspaceName, String apiName, ApiInner resource) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (apiName == null) { + return Mono.error(new IllegalArgumentException("Parameter apiName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, serviceName, workspaceName, apiName, resource, + accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates new or updates existing API. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aPI entity on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateWithResponseAsync(String resourceGroupName, + String serviceName, String workspaceName, String apiName, ApiInner resource, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (apiName == null) { + return Mono.error(new IllegalArgumentException("Parameter apiName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, serviceName, workspaceName, apiName, resource, accept, + context); + } + + /** + * Creates new or updates existing API. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aPI entity on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String serviceName, String workspaceName, + String apiName, ApiInner resource) { + return createOrUpdateWithResponseAsync(resourceGroupName, serviceName, workspaceName, apiName, resource) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates new or updates existing API. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aPI entity. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApisCreateOrUpdateResponse createOrUpdateWithResponse(String resourceGroupName, String serviceName, + String workspaceName, String apiName, ApiInner resource, Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, serviceName, workspaceName, apiName, resource, + context).block(); + } + + /** + * Creates new or updates existing API. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aPI entity. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApiInner createOrUpdate(String resourceGroupName, String serviceName, String workspaceName, String apiName, + ApiInner resource) { + return createOrUpdateWithResponse(resourceGroupName, serviceName, workspaceName, apiName, resource, + Context.NONE).getValue(); + } + + /** + * Deletes specified API. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String serviceName, + String workspaceName, String apiName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (apiName == null) { + return Mono.error(new IllegalArgumentException("Parameter apiName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, serviceName, workspaceName, apiName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes specified API. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String serviceName, + String workspaceName, String apiName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (apiName == null) { + return Mono.error(new IllegalArgumentException("Parameter apiName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, serviceName, workspaceName, apiName, accept, context); + } + + /** + * Deletes specified API. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String serviceName, String workspaceName, String apiName) { + return deleteWithResponseAsync(resourceGroupName, serviceName, workspaceName, apiName) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Deletes specified API. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String serviceName, String workspaceName, + String apiName, Context context) { + return deleteWithResponseAsync(resourceGroupName, serviceName, workspaceName, apiName, context).block(); + } + + /** + * Deletes specified API. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String serviceName, String workspaceName, String apiName) { + deleteWithResponse(resourceGroupName, serviceName, workspaceName, apiName, Context.NONE); + } + + /** + * Checks if specified API exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> headWithResponseAsync(String resourceGroupName, String serviceName, + String workspaceName, String apiName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (apiName == null) { + return Mono.error(new IllegalArgumentException("Parameter apiName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.head(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, serviceName, workspaceName, apiName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Checks if specified API exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> headWithResponseAsync(String resourceGroupName, String serviceName, + String workspaceName, String apiName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (apiName == null) { + return Mono.error(new IllegalArgumentException("Parameter apiName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.head(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, serviceName, workspaceName, apiName, accept, context); + } + + /** + * Checks if specified API exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono headAsync(String resourceGroupName, String serviceName, String workspaceName, String apiName) { + return headWithResponseAsync(resourceGroupName, serviceName, workspaceName, apiName) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Checks if specified API exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response headWithResponse(String resourceGroupName, String serviceName, String workspaceName, + String apiName, Context context) { + return headWithResponseAsync(resourceGroupName, serviceName, workspaceName, apiName, context).block(); + } + + /** + * Checks if specified API exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void head(String resourceGroupName, String serviceName, String workspaceName, String apiName) { + headWithResponse(resourceGroupName, serviceName, workspaceName, apiName, Context.NONE); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + * + * The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Api list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + * + * The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Api list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/ApisImpl.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/ApisImpl.java new file mode 100644 index 0000000000000..544dff866de76 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/ApisImpl.java @@ -0,0 +1,188 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.apicenter.fluent.ApisClient; +import com.azure.resourcemanager.apicenter.fluent.models.ApiInner; +import com.azure.resourcemanager.apicenter.models.Api; +import com.azure.resourcemanager.apicenter.models.Apis; +import com.azure.resourcemanager.apicenter.models.ApisGetResponse; + +public final class ApisImpl implements Apis { + private static final ClientLogger LOGGER = new ClientLogger(ApisImpl.class); + + private final ApisClient innerClient; + + private final com.azure.resourcemanager.apicenter.ApiCenterManager serviceManager; + + public ApisImpl(ApisClient innerClient, com.azure.resourcemanager.apicenter.ApiCenterManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String serviceName, String workspaceName) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, serviceName, workspaceName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ApiImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String serviceName, String workspaceName, String filter, + Context context) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, serviceName, workspaceName, filter, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ApiImpl(inner1, this.manager())); + } + + public Response getWithResponse(String resourceGroupName, String serviceName, String workspaceName, + String apiName, Context context) { + ApisGetResponse inner + = this.serviceClient().getWithResponse(resourceGroupName, serviceName, workspaceName, apiName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new ApiImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Api get(String resourceGroupName, String serviceName, String workspaceName, String apiName) { + ApiInner inner = this.serviceClient().get(resourceGroupName, serviceName, workspaceName, apiName); + if (inner != null) { + return new ApiImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteWithResponse(String resourceGroupName, String serviceName, String workspaceName, + String apiName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, serviceName, workspaceName, apiName, context); + } + + public void delete(String resourceGroupName, String serviceName, String workspaceName, String apiName) { + this.serviceClient().delete(resourceGroupName, serviceName, workspaceName, apiName); + } + + public Response headWithResponse(String resourceGroupName, String serviceName, String workspaceName, + String apiName, Context context) { + return this.serviceClient().headWithResponse(resourceGroupName, serviceName, workspaceName, apiName, context); + } + + public void head(String resourceGroupName, String serviceName, String workspaceName, String apiName) { + this.serviceClient().head(resourceGroupName, serviceName, workspaceName, apiName); + } + + public Api getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serviceName = ResourceManagerUtils.getValueFromIdByName(id, "services"); + if (serviceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'services'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String apiName = ResourceManagerUtils.getValueFromIdByName(id, "apis"); + if (apiName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'apis'.", id))); + } + return this.getWithResponse(resourceGroupName, serviceName, workspaceName, apiName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serviceName = ResourceManagerUtils.getValueFromIdByName(id, "services"); + if (serviceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'services'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String apiName = ResourceManagerUtils.getValueFromIdByName(id, "apis"); + if (apiName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'apis'.", id))); + } + return this.getWithResponse(resourceGroupName, serviceName, workspaceName, apiName, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serviceName = ResourceManagerUtils.getValueFromIdByName(id, "services"); + if (serviceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'services'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String apiName = ResourceManagerUtils.getValueFromIdByName(id, "apis"); + if (apiName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'apis'.", id))); + } + this.deleteWithResponse(resourceGroupName, serviceName, workspaceName, apiName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serviceName = ResourceManagerUtils.getValueFromIdByName(id, "services"); + if (serviceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'services'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String apiName = ResourceManagerUtils.getValueFromIdByName(id, "apis"); + if (apiName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'apis'.", id))); + } + return this.deleteWithResponse(resourceGroupName, serviceName, workspaceName, apiName, context); + } + + private ApisClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.apicenter.ApiCenterManager manager() { + return this.serviceManager; + } + + public ApiImpl define(String name) { + return new ApiImpl(name, this.manager()); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/AzureApiCenterBuilder.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/AzureApiCenterBuilder.java index 1c85178c872ea..124ff2f3fd04b 100644 --- a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/AzureApiCenterBuilder.java +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/AzureApiCenterBuilder.java @@ -14,17 +14,19 @@ import com.azure.core.util.serializer.SerializerAdapter; import java.time.Duration; -/** A builder for creating a new instance of the AzureApiCenterImpl type. */ -@ServiceClientBuilder(serviceClients = {AzureApiCenterImpl.class}) +/** + * A builder for creating a new instance of the AzureApiCenterImpl type. + */ +@ServiceClientBuilder(serviceClients = { AzureApiCenterImpl.class }) public final class AzureApiCenterBuilder { /* - * The ID of the target subscription. + * The ID of the target subscription. The value must be an UUID. */ private String subscriptionId; /** - * Sets The ID of the target subscription. - * + * Sets The ID of the target subscription. The value must be an UUID. + * * @param subscriptionId the subscriptionId value. * @return the AzureApiCenterBuilder. */ @@ -40,7 +42,7 @@ public AzureApiCenterBuilder subscriptionId(String subscriptionId) { /** * Sets server parameter. - * + * * @param endpoint the endpoint value. * @return the AzureApiCenterBuilder. */ @@ -56,7 +58,7 @@ public AzureApiCenterBuilder endpoint(String endpoint) { /** * Sets The environment to connect to. - * + * * @param environment the environment value. * @return the AzureApiCenterBuilder. */ @@ -72,7 +74,7 @@ public AzureApiCenterBuilder environment(AzureEnvironment environment) { /** * Sets The HTTP pipeline to send requests through. - * + * * @param pipeline the pipeline value. * @return the AzureApiCenterBuilder. */ @@ -88,7 +90,7 @@ public AzureApiCenterBuilder pipeline(HttpPipeline pipeline) { /** * Sets The default poll interval for long-running operation. - * + * * @param defaultPollInterval the defaultPollInterval value. * @return the AzureApiCenterBuilder. */ @@ -104,7 +106,7 @@ public AzureApiCenterBuilder defaultPollInterval(Duration defaultPollInterval) { /** * Sets The serializer to serialize an object into a string. - * + * * @param serializerAdapter the serializerAdapter value. * @return the AzureApiCenterBuilder. */ @@ -115,30 +117,20 @@ public AzureApiCenterBuilder serializerAdapter(SerializerAdapter serializerAdapt /** * Builds an instance of AzureApiCenterImpl with the provided parameters. - * + * * @return an instance of AzureApiCenterImpl. */ public AzureApiCenterImpl buildClient() { String localEndpoint = (endpoint != null) ? endpoint : "https://management.azure.com"; AzureEnvironment localEnvironment = (environment != null) ? environment : AzureEnvironment.AZURE; - HttpPipeline localPipeline = - (pipeline != null) - ? pipeline - : new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(); - Duration localDefaultPollInterval = - (defaultPollInterval != null) ? defaultPollInterval : Duration.ofSeconds(30); - SerializerAdapter localSerializerAdapter = - (serializerAdapter != null) - ? serializerAdapter - : SerializerFactory.createDefaultManagementSerializerAdapter(); - AzureApiCenterImpl client = - new AzureApiCenterImpl( - localPipeline, - localSerializerAdapter, - localDefaultPollInterval, - localEnvironment, - this.subscriptionId, - localEndpoint); + HttpPipeline localPipeline = (pipeline != null) ? pipeline + : new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(); + Duration localDefaultPollInterval + = (defaultPollInterval != null) ? defaultPollInterval : Duration.ofSeconds(30); + SerializerAdapter localSerializerAdapter = (serializerAdapter != null) ? serializerAdapter + : SerializerFactory.createDefaultManagementSerializerAdapter(); + AzureApiCenterImpl client = new AzureApiCenterImpl(localPipeline, localSerializerAdapter, + localDefaultPollInterval, localEnvironment, this.subscriptionId, localEndpoint); return client; } } diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/AzureApiCenterImpl.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/AzureApiCenterImpl.java index 320e51224d57a..fed6213bed51b 100644 --- a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/AzureApiCenterImpl.java +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/AzureApiCenterImpl.java @@ -22,9 +22,16 @@ import com.azure.core.util.polling.PollerFlux; import com.azure.core.util.serializer.SerializerAdapter; import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.apicenter.fluent.ApiDefinitionsClient; +import com.azure.resourcemanager.apicenter.fluent.ApiVersionsClient; +import com.azure.resourcemanager.apicenter.fluent.ApisClient; import com.azure.resourcemanager.apicenter.fluent.AzureApiCenter; +import com.azure.resourcemanager.apicenter.fluent.DeploymentsClient; +import com.azure.resourcemanager.apicenter.fluent.EnvironmentsClient; +import com.azure.resourcemanager.apicenter.fluent.MetadataSchemasClient; import com.azure.resourcemanager.apicenter.fluent.OperationsClient; import com.azure.resourcemanager.apicenter.fluent.ServicesClient; +import com.azure.resourcemanager.apicenter.fluent.WorkspacesClient; import java.io.IOException; import java.lang.reflect.Type; import java.nio.ByteBuffer; @@ -34,135 +41,253 @@ import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; -/** Initializes a new instance of the AzureApiCenterImpl type. */ +/** + * Initializes a new instance of the AzureApiCenterImpl type. + */ @ServiceClient(builder = AzureApiCenterBuilder.class) public final class AzureApiCenterImpl implements AzureApiCenter { - /** The ID of the target subscription. */ + /** + * The ID of the target subscription. The value must be an UUID. + */ private final String subscriptionId; /** - * Gets The ID of the target subscription. - * + * Gets The ID of the target subscription. The value must be an UUID. + * * @return the subscriptionId value. */ public String getSubscriptionId() { return this.subscriptionId; } - /** server parameter. */ + /** + * server parameter. + */ private final String endpoint; /** * Gets server parameter. - * + * * @return the endpoint value. */ public String getEndpoint() { return this.endpoint; } - /** Api Version. */ + /** + * Api Version. + */ private final String apiVersion; /** * Gets Api Version. - * + * * @return the apiVersion value. */ public String getApiVersion() { return this.apiVersion; } - /** The HTTP pipeline to send requests through. */ + /** + * The HTTP pipeline to send requests through. + */ private final HttpPipeline httpPipeline; /** * Gets The HTTP pipeline to send requests through. - * + * * @return the httpPipeline value. */ public HttpPipeline getHttpPipeline() { return this.httpPipeline; } - /** The serializer to serialize an object into a string. */ + /** + * The serializer to serialize an object into a string. + */ private final SerializerAdapter serializerAdapter; /** * Gets The serializer to serialize an object into a string. - * + * * @return the serializerAdapter value. */ SerializerAdapter getSerializerAdapter() { return this.serializerAdapter; } - /** The default poll interval for long-running operation. */ + /** + * The default poll interval for long-running operation. + */ private final Duration defaultPollInterval; /** * Gets The default poll interval for long-running operation. - * + * * @return the defaultPollInterval value. */ public Duration getDefaultPollInterval() { return this.defaultPollInterval; } - /** The OperationsClient object to access its operations. */ + /** + * The OperationsClient object to access its operations. + */ private final OperationsClient operations; /** * Gets the OperationsClient object to access its operations. - * + * * @return the OperationsClient object. */ public OperationsClient getOperations() { return this.operations; } - /** The ServicesClient object to access its operations. */ + /** + * The ServicesClient object to access its operations. + */ private final ServicesClient services; /** * Gets the ServicesClient object to access its operations. - * + * * @return the ServicesClient object. */ public ServicesClient getServices() { return this.services; } + /** + * The MetadataSchemasClient object to access its operations. + */ + private final MetadataSchemasClient metadataSchemas; + + /** + * Gets the MetadataSchemasClient object to access its operations. + * + * @return the MetadataSchemasClient object. + */ + public MetadataSchemasClient getMetadataSchemas() { + return this.metadataSchemas; + } + + /** + * The WorkspacesClient object to access its operations. + */ + private final WorkspacesClient workspaces; + + /** + * Gets the WorkspacesClient object to access its operations. + * + * @return the WorkspacesClient object. + */ + public WorkspacesClient getWorkspaces() { + return this.workspaces; + } + + /** + * The ApisClient object to access its operations. + */ + private final ApisClient apis; + + /** + * Gets the ApisClient object to access its operations. + * + * @return the ApisClient object. + */ + public ApisClient getApis() { + return this.apis; + } + + /** + * The DeploymentsClient object to access its operations. + */ + private final DeploymentsClient deployments; + + /** + * Gets the DeploymentsClient object to access its operations. + * + * @return the DeploymentsClient object. + */ + public DeploymentsClient getDeployments() { + return this.deployments; + } + + /** + * The ApiVersionsClient object to access its operations. + */ + private final ApiVersionsClient apiVersions; + + /** + * Gets the ApiVersionsClient object to access its operations. + * + * @return the ApiVersionsClient object. + */ + public ApiVersionsClient getApiVersions() { + return this.apiVersions; + } + + /** + * The ApiDefinitionsClient object to access its operations. + */ + private final ApiDefinitionsClient apiDefinitions; + + /** + * Gets the ApiDefinitionsClient object to access its operations. + * + * @return the ApiDefinitionsClient object. + */ + public ApiDefinitionsClient getApiDefinitions() { + return this.apiDefinitions; + } + + /** + * The EnvironmentsClient object to access its operations. + */ + private final EnvironmentsClient environments; + + /** + * Gets the EnvironmentsClient object to access its operations. + * + * @return the EnvironmentsClient object. + */ + public EnvironmentsClient getEnvironments() { + return this.environments; + } + /** * Initializes an instance of AzureApiCenter client. - * + * * @param httpPipeline The HTTP pipeline to send requests through. * @param serializerAdapter The serializer to serialize an object into a string. * @param defaultPollInterval The default poll interval for long-running operation. * @param environment The Azure environment. - * @param subscriptionId The ID of the target subscription. + * @param subscriptionId The ID of the target subscription. The value must be an UUID. * @param endpoint server parameter. */ - AzureApiCenterImpl( - HttpPipeline httpPipeline, - SerializerAdapter serializerAdapter, - Duration defaultPollInterval, - AzureEnvironment environment, - String subscriptionId, - String endpoint) { + AzureApiCenterImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, Duration defaultPollInterval, + AzureEnvironment environment, String subscriptionId, String endpoint) { this.httpPipeline = httpPipeline; this.serializerAdapter = serializerAdapter; this.defaultPollInterval = defaultPollInterval; this.subscriptionId = subscriptionId; this.endpoint = endpoint; - this.apiVersion = "2023-07-01-preview"; + this.apiVersion = "2024-03-01"; this.operations = new OperationsClientImpl(this); this.services = new ServicesClientImpl(this); + this.metadataSchemas = new MetadataSchemasClientImpl(this); + this.workspaces = new WorkspacesClientImpl(this); + this.apis = new ApisClientImpl(this); + this.deployments = new DeploymentsClientImpl(this); + this.apiVersions = new ApiVersionsClientImpl(this); + this.apiDefinitions = new ApiDefinitionsClientImpl(this); + this.environments = new EnvironmentsClientImpl(this); } /** * Gets default client context. - * + * * @return the default client context. */ public Context getContext() { @@ -171,7 +296,7 @@ public Context getContext() { /** * Merges default client context with provided context. - * + * * @param context the context to be merged with default client context. * @return the merged context. */ @@ -181,7 +306,7 @@ public Context mergeContext(Context context) { /** * Gets long running operation result. - * + * * @param activationResponse the response of activation operation. * @param httpPipeline the http pipeline. * @param pollResultType type of poll result. @@ -191,26 +316,15 @@ public Context mergeContext(Context context) { * @param type of final result. * @return poller flux for poll result and final result. */ - public PollerFlux, U> getLroResult( - Mono>> activationResponse, - HttpPipeline httpPipeline, - Type pollResultType, - Type finalResultType, - Context context) { - return PollerFactory - .create( - serializerAdapter, - httpPipeline, - pollResultType, - finalResultType, - defaultPollInterval, - activationResponse, - context); + public PollerFlux, U> getLroResult(Mono>> activationResponse, + HttpPipeline httpPipeline, Type pollResultType, Type finalResultType, Context context) { + return PollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, + defaultPollInterval, activationResponse, context); } /** * Gets the final result, or an error, based on last async poll response. - * + * * @param response the last async poll response. * @param type of poll result. * @param type of final result. @@ -223,19 +337,16 @@ public Mono getLroFinalResultOrError(AsyncPollResponse, HttpResponse errorResponse = null; PollResult.Error lroError = response.getValue().getError(); if (lroError != null) { - errorResponse = - new HttpResponseImpl( - lroError.getResponseStatusCode(), lroError.getResponseHeaders(), lroError.getResponseBody()); + errorResponse = new HttpResponseImpl(lroError.getResponseStatusCode(), lroError.getResponseHeaders(), + lroError.getResponseBody()); errorMessage = response.getValue().getError().getMessage(); String errorBody = response.getValue().getError().getResponseBody(); if (errorBody != null) { // try to deserialize error body to ManagementError try { - managementError = - this - .getSerializerAdapter() - .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); + managementError = this.getSerializerAdapter().deserialize(errorBody, ManagementError.class, + SerializerEncoding.JSON); if (managementError.getCode() == null || managementError.getMessage() == null) { managementError = null; } diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/DeploymentImpl.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/DeploymentImpl.java new file mode 100644 index 0000000000000..be9cbf61e83ed --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/DeploymentImpl.java @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.apicenter.fluent.models.DeploymentInner; +import com.azure.resourcemanager.apicenter.models.Deployment; +import com.azure.resourcemanager.apicenter.models.DeploymentProperties; + +public final class DeploymentImpl implements Deployment, Deployment.Definition, Deployment.Update { + private DeploymentInner innerObject; + + private final com.azure.resourcemanager.apicenter.ApiCenterManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public DeploymentProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public DeploymentInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.apicenter.ApiCenterManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serviceName; + + private String workspaceName; + + private String apiName; + + private String deploymentName; + + public DeploymentImpl withExistingApi(String resourceGroupName, String serviceName, String workspaceName, + String apiName) { + this.resourceGroupName = resourceGroupName; + this.serviceName = serviceName; + this.workspaceName = workspaceName; + this.apiName = apiName; + return this; + } + + public Deployment create() { + this.innerObject = serviceManager.serviceClient().getDeployments().createOrUpdateWithResponse(resourceGroupName, + serviceName, workspaceName, apiName, deploymentName, this.innerModel(), Context.NONE).getValue(); + return this; + } + + public Deployment create(Context context) { + this.innerObject = serviceManager.serviceClient().getDeployments().createOrUpdateWithResponse(resourceGroupName, + serviceName, workspaceName, apiName, deploymentName, this.innerModel(), context).getValue(); + return this; + } + + DeploymentImpl(String name, com.azure.resourcemanager.apicenter.ApiCenterManager serviceManager) { + this.innerObject = new DeploymentInner(); + this.serviceManager = serviceManager; + this.deploymentName = name; + } + + public DeploymentImpl update() { + return this; + } + + public Deployment apply() { + this.innerObject = serviceManager.serviceClient().getDeployments().createOrUpdateWithResponse(resourceGroupName, + serviceName, workspaceName, apiName, deploymentName, this.innerModel(), Context.NONE).getValue(); + return this; + } + + public Deployment apply(Context context) { + this.innerObject = serviceManager.serviceClient().getDeployments().createOrUpdateWithResponse(resourceGroupName, + serviceName, workspaceName, apiName, deploymentName, this.innerModel(), context).getValue(); + return this; + } + + DeploymentImpl(DeploymentInner innerObject, com.azure.resourcemanager.apicenter.ApiCenterManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serviceName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "services"); + this.workspaceName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "workspaces"); + this.apiName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "apis"); + this.deploymentName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "deployments"); + } + + public Deployment refresh() { + this.innerObject = serviceManager.serviceClient().getDeployments() + .getWithResponse(resourceGroupName, serviceName, workspaceName, apiName, deploymentName, Context.NONE) + .getValue(); + return this; + } + + public Deployment refresh(Context context) { + this.innerObject = serviceManager.serviceClient().getDeployments() + .getWithResponse(resourceGroupName, serviceName, workspaceName, apiName, deploymentName, context) + .getValue(); + return this; + } + + public DeploymentImpl withProperties(DeploymentProperties properties) { + this.innerModel().withProperties(properties); + return this; + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/DeploymentsClientImpl.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/DeploymentsClientImpl.java new file mode 100644 index 0000000000000..cc8b1534c4558 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/DeploymentsClientImpl.java @@ -0,0 +1,1022 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.Head; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.apicenter.fluent.DeploymentsClient; +import com.azure.resourcemanager.apicenter.fluent.models.DeploymentInner; +import com.azure.resourcemanager.apicenter.models.DeploymentListResult; +import com.azure.resourcemanager.apicenter.models.DeploymentsCreateOrUpdateResponse; +import com.azure.resourcemanager.apicenter.models.DeploymentsGetResponse; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in DeploymentsClient. + */ +public final class DeploymentsClientImpl implements DeploymentsClient { + /** + * The proxy service used to perform REST calls. + */ + private final DeploymentsService service; + + /** + * The service client containing this operation class. + */ + private final AzureApiCenterImpl client; + + /** + * Initializes an instance of DeploymentsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DeploymentsClientImpl(AzureApiCenterImpl client) { + this.service + = RestProxy.create(DeploymentsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureApiCenterDeployments to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AzureApiCenterDeploy") + public interface DeploymentsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/deployments") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("serviceName") String serviceName, + @PathParam("workspaceName") String workspaceName, @PathParam("apiName") String apiName, + @QueryParam("$filter") String filter, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/deployments/{deploymentName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono get(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("serviceName") String serviceName, + @PathParam("workspaceName") String workspaceName, @PathParam("apiName") String apiName, + @PathParam("deploymentName") String deploymentName, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/deployments/{deploymentName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono createOrUpdate(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("serviceName") String serviceName, + @PathParam("workspaceName") String workspaceName, @PathParam("apiName") String apiName, + @PathParam("deploymentName") String deploymentName, @BodyParam("application/json") DeploymentInner resource, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/deployments/{deploymentName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("serviceName") String serviceName, + @PathParam("workspaceName") String workspaceName, @PathParam("apiName") String apiName, + @PathParam("deploymentName") String deploymentName, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Head("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/deployments/{deploymentName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> head(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("serviceName") String serviceName, + @PathParam("workspaceName") String workspaceName, @PathParam("apiName") String apiName, + @PathParam("deploymentName") String deploymentName, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * Returns a collection of API deployments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param filter OData filter parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Deployment list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, String serviceName, + String workspaceName, String apiName, String filter) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (apiName == null) { + return Mono.error(new IllegalArgumentException("Parameter apiName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, serviceName, workspaceName, apiName, filter, accept, + context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns a collection of API deployments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param filter OData filter parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Deployment list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, String serviceName, + String workspaceName, String apiName, String filter, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (apiName == null) { + return Mono.error(new IllegalArgumentException("Parameter apiName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, serviceName, workspaceName, apiName, filter, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Returns a collection of API deployments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param filter OData filter parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Deployment list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String serviceName, String workspaceName, + String apiName, String filter) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, serviceName, workspaceName, apiName, filter), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Returns a collection of API deployments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Deployment list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String serviceName, String workspaceName, + String apiName) { + final String filter = null; + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, serviceName, workspaceName, apiName, filter), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Returns a collection of API deployments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param filter OData filter parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Deployment list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String serviceName, String workspaceName, + String apiName, String filter, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, serviceName, workspaceName, apiName, filter, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Returns a collection of API deployments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Deployment list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String serviceName, String workspaceName, + String apiName) { + final String filter = null; + return new PagedIterable<>(listAsync(resourceGroupName, serviceName, workspaceName, apiName, filter)); + } + + /** + * Returns a collection of API deployments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param filter OData filter parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Deployment list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String serviceName, String workspaceName, + String apiName, String filter, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, serviceName, workspaceName, apiName, filter, context)); + } + + /** + * Returns details of the API deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param deploymentName The name of the API deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aPI deployment entity on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getWithResponseAsync(String resourceGroupName, String serviceName, + String workspaceName, String apiName, String deploymentName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (apiName == null) { + return Mono.error(new IllegalArgumentException("Parameter apiName is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, serviceName, workspaceName, apiName, deploymentName, + accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns details of the API deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param deploymentName The name of the API deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aPI deployment entity on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getWithResponseAsync(String resourceGroupName, String serviceName, + String workspaceName, String apiName, String deploymentName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (apiName == null) { + return Mono.error(new IllegalArgumentException("Parameter apiName is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, serviceName, workspaceName, apiName, deploymentName, accept, context); + } + + /** + * Returns details of the API deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param deploymentName The name of the API deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aPI deployment entity on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String serviceName, String workspaceName, + String apiName, String deploymentName) { + return getWithResponseAsync(resourceGroupName, serviceName, workspaceName, apiName, deploymentName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Returns details of the API deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param deploymentName The name of the API deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aPI deployment entity. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DeploymentsGetResponse getWithResponse(String resourceGroupName, String serviceName, String workspaceName, + String apiName, String deploymentName, Context context) { + return getWithResponseAsync(resourceGroupName, serviceName, workspaceName, apiName, deploymentName, context) + .block(); + } + + /** + * Returns details of the API deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param deploymentName The name of the API deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aPI deployment entity. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DeploymentInner get(String resourceGroupName, String serviceName, String workspaceName, String apiName, + String deploymentName) { + return getWithResponse(resourceGroupName, serviceName, workspaceName, apiName, deploymentName, Context.NONE) + .getValue(); + } + + /** + * Creates new or updates existing API deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param deploymentName The name of the API deployment. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aPI deployment entity on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateWithResponseAsync(String resourceGroupName, + String serviceName, String workspaceName, String apiName, String deploymentName, DeploymentInner resource) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (apiName == null) { + return Mono.error(new IllegalArgumentException("Parameter apiName is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, serviceName, workspaceName, apiName, deploymentName, + resource, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates new or updates existing API deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param deploymentName The name of the API deployment. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aPI deployment entity on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateWithResponseAsync(String resourceGroupName, + String serviceName, String workspaceName, String apiName, String deploymentName, DeploymentInner resource, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (apiName == null) { + return Mono.error(new IllegalArgumentException("Parameter apiName is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, serviceName, workspaceName, apiName, deploymentName, + resource, accept, context); + } + + /** + * Creates new or updates existing API deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param deploymentName The name of the API deployment. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aPI deployment entity on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String serviceName, + String workspaceName, String apiName, String deploymentName, DeploymentInner resource) { + return createOrUpdateWithResponseAsync(resourceGroupName, serviceName, workspaceName, apiName, deploymentName, + resource).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates new or updates existing API deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param deploymentName The name of the API deployment. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aPI deployment entity. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DeploymentsCreateOrUpdateResponse createOrUpdateWithResponse(String resourceGroupName, String serviceName, + String workspaceName, String apiName, String deploymentName, DeploymentInner resource, Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, serviceName, workspaceName, apiName, deploymentName, + resource, context).block(); + } + + /** + * Creates new or updates existing API deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param deploymentName The name of the API deployment. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aPI deployment entity. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DeploymentInner createOrUpdate(String resourceGroupName, String serviceName, String workspaceName, + String apiName, String deploymentName, DeploymentInner resource) { + return createOrUpdateWithResponse(resourceGroupName, serviceName, workspaceName, apiName, deploymentName, + resource, Context.NONE).getValue(); + } + + /** + * Deletes API deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param deploymentName The name of the API deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String serviceName, + String workspaceName, String apiName, String deploymentName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (apiName == null) { + return Mono.error(new IllegalArgumentException("Parameter apiName is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, serviceName, workspaceName, apiName, deploymentName, + accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes API deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param deploymentName The name of the API deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String serviceName, + String workspaceName, String apiName, String deploymentName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (apiName == null) { + return Mono.error(new IllegalArgumentException("Parameter apiName is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, serviceName, workspaceName, apiName, deploymentName, accept, context); + } + + /** + * Deletes API deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param deploymentName The name of the API deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String serviceName, String workspaceName, String apiName, + String deploymentName) { + return deleteWithResponseAsync(resourceGroupName, serviceName, workspaceName, apiName, deploymentName) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Deletes API deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param deploymentName The name of the API deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String serviceName, String workspaceName, + String apiName, String deploymentName, Context context) { + return deleteWithResponseAsync(resourceGroupName, serviceName, workspaceName, apiName, deploymentName, context) + .block(); + } + + /** + * Deletes API deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param deploymentName The name of the API deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String serviceName, String workspaceName, String apiName, + String deploymentName) { + deleteWithResponse(resourceGroupName, serviceName, workspaceName, apiName, deploymentName, Context.NONE); + } + + /** + * Checks if specified API deployment exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param deploymentName The name of the API deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> headWithResponseAsync(String resourceGroupName, String serviceName, + String workspaceName, String apiName, String deploymentName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (apiName == null) { + return Mono.error(new IllegalArgumentException("Parameter apiName is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.head(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, serviceName, workspaceName, apiName, deploymentName, + accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Checks if specified API deployment exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param deploymentName The name of the API deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> headWithResponseAsync(String resourceGroupName, String serviceName, + String workspaceName, String apiName, String deploymentName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (apiName == null) { + return Mono.error(new IllegalArgumentException("Parameter apiName is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.head(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, serviceName, workspaceName, apiName, deploymentName, accept, context); + } + + /** + * Checks if specified API deployment exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param deploymentName The name of the API deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono headAsync(String resourceGroupName, String serviceName, String workspaceName, String apiName, + String deploymentName) { + return headWithResponseAsync(resourceGroupName, serviceName, workspaceName, apiName, deploymentName) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Checks if specified API deployment exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param deploymentName The name of the API deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response headWithResponse(String resourceGroupName, String serviceName, String workspaceName, + String apiName, String deploymentName, Context context) { + return headWithResponseAsync(resourceGroupName, serviceName, workspaceName, apiName, deploymentName, context) + .block(); + } + + /** + * Checks if specified API deployment exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param deploymentName The name of the API deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void head(String resourceGroupName, String serviceName, String workspaceName, String apiName, + String deploymentName) { + headWithResponse(resourceGroupName, serviceName, workspaceName, apiName, deploymentName, Context.NONE); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + * + * The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Deployment list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + * + * The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Deployment list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/DeploymentsImpl.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/DeploymentsImpl.java new file mode 100644 index 0000000000000..0428095c2d1a7 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/DeploymentsImpl.java @@ -0,0 +1,219 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.apicenter.fluent.DeploymentsClient; +import com.azure.resourcemanager.apicenter.fluent.models.DeploymentInner; +import com.azure.resourcemanager.apicenter.models.Deployment; +import com.azure.resourcemanager.apicenter.models.Deployments; +import com.azure.resourcemanager.apicenter.models.DeploymentsGetResponse; + +public final class DeploymentsImpl implements Deployments { + private static final ClientLogger LOGGER = new ClientLogger(DeploymentsImpl.class); + + private final DeploymentsClient innerClient; + + private final com.azure.resourcemanager.apicenter.ApiCenterManager serviceManager; + + public DeploymentsImpl(DeploymentsClient innerClient, + com.azure.resourcemanager.apicenter.ApiCenterManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String serviceName, String workspaceName, + String apiName) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, serviceName, workspaceName, apiName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new DeploymentImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String serviceName, String workspaceName, + String apiName, String filter, Context context) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, serviceName, workspaceName, apiName, filter, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new DeploymentImpl(inner1, this.manager())); + } + + public Response getWithResponse(String resourceGroupName, String serviceName, String workspaceName, + String apiName, String deploymentName, Context context) { + DeploymentsGetResponse inner = this.serviceClient().getWithResponse(resourceGroupName, serviceName, + workspaceName, apiName, deploymentName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new DeploymentImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Deployment get(String resourceGroupName, String serviceName, String workspaceName, String apiName, + String deploymentName) { + DeploymentInner inner + = this.serviceClient().get(resourceGroupName, serviceName, workspaceName, apiName, deploymentName); + if (inner != null) { + return new DeploymentImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteWithResponse(String resourceGroupName, String serviceName, String workspaceName, + String apiName, String deploymentName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, serviceName, workspaceName, apiName, + deploymentName, context); + } + + public void delete(String resourceGroupName, String serviceName, String workspaceName, String apiName, + String deploymentName) { + this.serviceClient().delete(resourceGroupName, serviceName, workspaceName, apiName, deploymentName); + } + + public Response headWithResponse(String resourceGroupName, String serviceName, String workspaceName, + String apiName, String deploymentName, Context context) { + return this.serviceClient().headWithResponse(resourceGroupName, serviceName, workspaceName, apiName, + deploymentName, context); + } + + public void head(String resourceGroupName, String serviceName, String workspaceName, String apiName, + String deploymentName) { + this.serviceClient().head(resourceGroupName, serviceName, workspaceName, apiName, deploymentName); + } + + public Deployment getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serviceName = ResourceManagerUtils.getValueFromIdByName(id, "services"); + if (serviceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'services'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String apiName = ResourceManagerUtils.getValueFromIdByName(id, "apis"); + if (apiName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'apis'.", id))); + } + String deploymentName = ResourceManagerUtils.getValueFromIdByName(id, "deployments"); + if (deploymentName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'deployments'.", id))); + } + return this + .getWithResponse(resourceGroupName, serviceName, workspaceName, apiName, deploymentName, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serviceName = ResourceManagerUtils.getValueFromIdByName(id, "services"); + if (serviceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'services'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String apiName = ResourceManagerUtils.getValueFromIdByName(id, "apis"); + if (apiName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'apis'.", id))); + } + String deploymentName = ResourceManagerUtils.getValueFromIdByName(id, "deployments"); + if (deploymentName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'deployments'.", id))); + } + return this.getWithResponse(resourceGroupName, serviceName, workspaceName, apiName, deploymentName, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serviceName = ResourceManagerUtils.getValueFromIdByName(id, "services"); + if (serviceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'services'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String apiName = ResourceManagerUtils.getValueFromIdByName(id, "apis"); + if (apiName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'apis'.", id))); + } + String deploymentName = ResourceManagerUtils.getValueFromIdByName(id, "deployments"); + if (deploymentName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'deployments'.", id))); + } + this.deleteWithResponse(resourceGroupName, serviceName, workspaceName, apiName, deploymentName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serviceName = ResourceManagerUtils.getValueFromIdByName(id, "services"); + if (serviceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'services'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String apiName = ResourceManagerUtils.getValueFromIdByName(id, "apis"); + if (apiName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'apis'.", id))); + } + String deploymentName = ResourceManagerUtils.getValueFromIdByName(id, "deployments"); + if (deploymentName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'deployments'.", id))); + } + return this.deleteWithResponse(resourceGroupName, serviceName, workspaceName, apiName, deploymentName, context); + } + + private DeploymentsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.apicenter.ApiCenterManager manager() { + return this.serviceManager; + } + + public DeploymentImpl define(String name) { + return new DeploymentImpl(name, this.manager()); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/EnvironmentImpl.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/EnvironmentImpl.java new file mode 100644 index 0000000000000..0f7fa6fc95ebe --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/EnvironmentImpl.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.apicenter.fluent.models.EnvironmentInner; +import com.azure.resourcemanager.apicenter.models.Environment; +import com.azure.resourcemanager.apicenter.models.EnvironmentProperties; + +public final class EnvironmentImpl implements Environment, Environment.Definition, Environment.Update { + private EnvironmentInner innerObject; + + private final com.azure.resourcemanager.apicenter.ApiCenterManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public EnvironmentProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public EnvironmentInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.apicenter.ApiCenterManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serviceName; + + private String workspaceName; + + private String environmentName; + + public EnvironmentImpl withExistingWorkspace(String resourceGroupName, String serviceName, String workspaceName) { + this.resourceGroupName = resourceGroupName; + this.serviceName = serviceName; + this.workspaceName = workspaceName; + return this; + } + + public Environment create() { + this.innerObject + = serviceManager.serviceClient().getEnvironments().createOrUpdateWithResponse(resourceGroupName, + serviceName, workspaceName, environmentName, this.innerModel(), Context.NONE).getValue(); + return this; + } + + public Environment create(Context context) { + this.innerObject + = serviceManager.serviceClient().getEnvironments().createOrUpdateWithResponse(resourceGroupName, + serviceName, workspaceName, environmentName, this.innerModel(), context).getValue(); + return this; + } + + EnvironmentImpl(String name, com.azure.resourcemanager.apicenter.ApiCenterManager serviceManager) { + this.innerObject = new EnvironmentInner(); + this.serviceManager = serviceManager; + this.environmentName = name; + } + + public EnvironmentImpl update() { + return this; + } + + public Environment apply() { + this.innerObject + = serviceManager.serviceClient().getEnvironments().createOrUpdateWithResponse(resourceGroupName, + serviceName, workspaceName, environmentName, this.innerModel(), Context.NONE).getValue(); + return this; + } + + public Environment apply(Context context) { + this.innerObject + = serviceManager.serviceClient().getEnvironments().createOrUpdateWithResponse(resourceGroupName, + serviceName, workspaceName, environmentName, this.innerModel(), context).getValue(); + return this; + } + + EnvironmentImpl(EnvironmentInner innerObject, com.azure.resourcemanager.apicenter.ApiCenterManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serviceName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "services"); + this.workspaceName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "workspaces"); + this.environmentName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "environments"); + } + + public Environment refresh() { + this.innerObject = serviceManager.serviceClient().getEnvironments() + .getWithResponse(resourceGroupName, serviceName, workspaceName, environmentName, Context.NONE).getValue(); + return this; + } + + public Environment refresh(Context context) { + this.innerObject = serviceManager.serviceClient().getEnvironments() + .getWithResponse(resourceGroupName, serviceName, workspaceName, environmentName, context).getValue(); + return this; + } + + public EnvironmentImpl withProperties(EnvironmentProperties properties) { + this.innerModel().withProperties(properties); + return this; + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/EnvironmentsClientImpl.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/EnvironmentsClientImpl.java new file mode 100644 index 0000000000000..4ac6926776bf2 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/EnvironmentsClientImpl.java @@ -0,0 +1,960 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.Head; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.apicenter.fluent.EnvironmentsClient; +import com.azure.resourcemanager.apicenter.fluent.models.EnvironmentInner; +import com.azure.resourcemanager.apicenter.models.EnvironmentListResult; +import com.azure.resourcemanager.apicenter.models.EnvironmentsCreateOrUpdateResponse; +import com.azure.resourcemanager.apicenter.models.EnvironmentsGetResponse; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in EnvironmentsClient. + */ +public final class EnvironmentsClientImpl implements EnvironmentsClient { + /** + * The proxy service used to perform REST calls. + */ + private final EnvironmentsService service; + + /** + * The service client containing this operation class. + */ + private final AzureApiCenterImpl client; + + /** + * Initializes an instance of EnvironmentsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + EnvironmentsClientImpl(AzureApiCenterImpl client) { + this.service + = RestProxy.create(EnvironmentsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureApiCenterEnvironments to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AzureApiCenterEnviro") + public interface EnvironmentsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/environments") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("serviceName") String serviceName, + @PathParam("workspaceName") String workspaceName, @QueryParam("$filter") String filter, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/environments/{environmentName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono get(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("serviceName") String serviceName, + @PathParam("workspaceName") String workspaceName, @PathParam("environmentName") String environmentName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/environments/{environmentName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono createOrUpdate(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("serviceName") String serviceName, + @PathParam("workspaceName") String workspaceName, @PathParam("environmentName") String environmentName, + @BodyParam("application/json") EnvironmentInner resource, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/environments/{environmentName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("serviceName") String serviceName, + @PathParam("workspaceName") String workspaceName, @PathParam("environmentName") String environmentName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Head("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/environments/{environmentName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> head(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("serviceName") String serviceName, + @PathParam("workspaceName") String workspaceName, @PathParam("environmentName") String environmentName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * Returns a collection of environments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param filter OData filter parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Environment list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, String serviceName, + String workspaceName, String filter) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, serviceName, workspaceName, filter, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns a collection of environments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param filter OData filter parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Environment list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, String serviceName, + String workspaceName, String filter, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, serviceName, workspaceName, filter, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Returns a collection of environments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param filter OData filter parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Environment list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String serviceName, String workspaceName, + String filter) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, serviceName, workspaceName, filter), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Returns a collection of environments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Environment list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String serviceName, String workspaceName) { + final String filter = null; + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, serviceName, workspaceName, filter), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Returns a collection of environments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param filter OData filter parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Environment list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String serviceName, String workspaceName, + String filter, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, serviceName, workspaceName, filter, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Returns a collection of environments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Environment list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String serviceName, String workspaceName) { + final String filter = null; + return new PagedIterable<>(listAsync(resourceGroupName, serviceName, workspaceName, filter)); + } + + /** + * Returns a collection of environments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param filter OData filter parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Environment list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String serviceName, String workspaceName, + String filter, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, serviceName, workspaceName, filter, context)); + } + + /** + * Returns details of the environment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param environmentName The name of the environment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return environment entity on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getWithResponseAsync(String resourceGroupName, String serviceName, + String workspaceName, String environmentName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (environmentName == null) { + return Mono + .error(new IllegalArgumentException("Parameter environmentName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, serviceName, workspaceName, environmentName, accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns details of the environment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param environmentName The name of the environment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return environment entity on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getWithResponseAsync(String resourceGroupName, String serviceName, + String workspaceName, String environmentName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (environmentName == null) { + return Mono + .error(new IllegalArgumentException("Parameter environmentName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, serviceName, workspaceName, environmentName, accept, context); + } + + /** + * Returns details of the environment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param environmentName The name of the environment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return environment entity on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String serviceName, String workspaceName, + String environmentName) { + return getWithResponseAsync(resourceGroupName, serviceName, workspaceName, environmentName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Returns details of the environment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param environmentName The name of the environment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return environment entity. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public EnvironmentsGetResponse getWithResponse(String resourceGroupName, String serviceName, String workspaceName, + String environmentName, Context context) { + return getWithResponseAsync(resourceGroupName, serviceName, workspaceName, environmentName, context).block(); + } + + /** + * Returns details of the environment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param environmentName The name of the environment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return environment entity. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public EnvironmentInner get(String resourceGroupName, String serviceName, String workspaceName, + String environmentName) { + return getWithResponse(resourceGroupName, serviceName, workspaceName, environmentName, Context.NONE).getValue(); + } + + /** + * Creates new or updates existing environment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param environmentName The name of the environment. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return environment entity on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateWithResponseAsync(String resourceGroupName, + String serviceName, String workspaceName, String environmentName, EnvironmentInner resource) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (environmentName == null) { + return Mono + .error(new IllegalArgumentException("Parameter environmentName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, serviceName, workspaceName, environmentName, + resource, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates new or updates existing environment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param environmentName The name of the environment. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return environment entity on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateWithResponseAsync(String resourceGroupName, + String serviceName, String workspaceName, String environmentName, EnvironmentInner resource, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (environmentName == null) { + return Mono + .error(new IllegalArgumentException("Parameter environmentName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, serviceName, workspaceName, environmentName, resource, + accept, context); + } + + /** + * Creates new or updates existing environment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param environmentName The name of the environment. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return environment entity on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String serviceName, + String workspaceName, String environmentName, EnvironmentInner resource) { + return createOrUpdateWithResponseAsync(resourceGroupName, serviceName, workspaceName, environmentName, resource) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates new or updates existing environment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param environmentName The name of the environment. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return environment entity. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public EnvironmentsCreateOrUpdateResponse createOrUpdateWithResponse(String resourceGroupName, String serviceName, + String workspaceName, String environmentName, EnvironmentInner resource, Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, serviceName, workspaceName, environmentName, resource, + context).block(); + } + + /** + * Creates new or updates existing environment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param environmentName The name of the environment. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return environment entity. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public EnvironmentInner createOrUpdate(String resourceGroupName, String serviceName, String workspaceName, + String environmentName, EnvironmentInner resource) { + return createOrUpdateWithResponse(resourceGroupName, serviceName, workspaceName, environmentName, resource, + Context.NONE).getValue(); + } + + /** + * Deletes the environment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param environmentName The name of the environment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String serviceName, + String workspaceName, String environmentName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (environmentName == null) { + return Mono + .error(new IllegalArgumentException("Parameter environmentName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, serviceName, workspaceName, environmentName, accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes the environment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param environmentName The name of the environment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String serviceName, + String workspaceName, String environmentName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (environmentName == null) { + return Mono + .error(new IllegalArgumentException("Parameter environmentName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, serviceName, workspaceName, environmentName, accept, context); + } + + /** + * Deletes the environment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param environmentName The name of the environment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String serviceName, String workspaceName, + String environmentName) { + return deleteWithResponseAsync(resourceGroupName, serviceName, workspaceName, environmentName) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Deletes the environment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param environmentName The name of the environment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String serviceName, String workspaceName, + String environmentName, Context context) { + return deleteWithResponseAsync(resourceGroupName, serviceName, workspaceName, environmentName, context).block(); + } + + /** + * Deletes the environment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param environmentName The name of the environment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String serviceName, String workspaceName, String environmentName) { + deleteWithResponse(resourceGroupName, serviceName, workspaceName, environmentName, Context.NONE); + } + + /** + * Checks if specified environment exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param environmentName The name of the environment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> headWithResponseAsync(String resourceGroupName, String serviceName, + String workspaceName, String environmentName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (environmentName == null) { + return Mono + .error(new IllegalArgumentException("Parameter environmentName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.head(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, serviceName, workspaceName, environmentName, accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Checks if specified environment exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param environmentName The name of the environment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> headWithResponseAsync(String resourceGroupName, String serviceName, + String workspaceName, String environmentName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (environmentName == null) { + return Mono + .error(new IllegalArgumentException("Parameter environmentName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.head(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, serviceName, workspaceName, environmentName, accept, context); + } + + /** + * Checks if specified environment exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param environmentName The name of the environment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono headAsync(String resourceGroupName, String serviceName, String workspaceName, + String environmentName) { + return headWithResponseAsync(resourceGroupName, serviceName, workspaceName, environmentName) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Checks if specified environment exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param environmentName The name of the environment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response headWithResponse(String resourceGroupName, String serviceName, String workspaceName, + String environmentName, Context context) { + return headWithResponseAsync(resourceGroupName, serviceName, workspaceName, environmentName, context).block(); + } + + /** + * Checks if specified environment exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param environmentName The name of the environment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void head(String resourceGroupName, String serviceName, String workspaceName, String environmentName) { + headWithResponse(resourceGroupName, serviceName, workspaceName, environmentName, Context.NONE); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + * + * The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Environment list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + * + * The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Environment list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/EnvironmentsImpl.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/EnvironmentsImpl.java new file mode 100644 index 0000000000000..93e8ba53b6107 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/EnvironmentsImpl.java @@ -0,0 +1,194 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.apicenter.fluent.EnvironmentsClient; +import com.azure.resourcemanager.apicenter.fluent.models.EnvironmentInner; +import com.azure.resourcemanager.apicenter.models.Environment; +import com.azure.resourcemanager.apicenter.models.Environments; +import com.azure.resourcemanager.apicenter.models.EnvironmentsGetResponse; + +public final class EnvironmentsImpl implements Environments { + private static final ClientLogger LOGGER = new ClientLogger(EnvironmentsImpl.class); + + private final EnvironmentsClient innerClient; + + private final com.azure.resourcemanager.apicenter.ApiCenterManager serviceManager; + + public EnvironmentsImpl(EnvironmentsClient innerClient, + com.azure.resourcemanager.apicenter.ApiCenterManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String serviceName, String workspaceName) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, serviceName, workspaceName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new EnvironmentImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String serviceName, String workspaceName, + String filter, Context context) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, serviceName, workspaceName, filter, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new EnvironmentImpl(inner1, this.manager())); + } + + public Response getWithResponse(String resourceGroupName, String serviceName, String workspaceName, + String environmentName, Context context) { + EnvironmentsGetResponse inner = this.serviceClient().getWithResponse(resourceGroupName, serviceName, + workspaceName, environmentName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new EnvironmentImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Environment get(String resourceGroupName, String serviceName, String workspaceName, String environmentName) { + EnvironmentInner inner + = this.serviceClient().get(resourceGroupName, serviceName, workspaceName, environmentName); + if (inner != null) { + return new EnvironmentImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteWithResponse(String resourceGroupName, String serviceName, String workspaceName, + String environmentName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, serviceName, workspaceName, environmentName, + context); + } + + public void delete(String resourceGroupName, String serviceName, String workspaceName, String environmentName) { + this.serviceClient().delete(resourceGroupName, serviceName, workspaceName, environmentName); + } + + public Response headWithResponse(String resourceGroupName, String serviceName, String workspaceName, + String environmentName, Context context) { + return this.serviceClient().headWithResponse(resourceGroupName, serviceName, workspaceName, environmentName, + context); + } + + public void head(String resourceGroupName, String serviceName, String workspaceName, String environmentName) { + this.serviceClient().head(resourceGroupName, serviceName, workspaceName, environmentName); + } + + public Environment getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serviceName = ResourceManagerUtils.getValueFromIdByName(id, "services"); + if (serviceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'services'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String environmentName = ResourceManagerUtils.getValueFromIdByName(id, "environments"); + if (environmentName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'environments'.", id))); + } + return this.getWithResponse(resourceGroupName, serviceName, workspaceName, environmentName, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serviceName = ResourceManagerUtils.getValueFromIdByName(id, "services"); + if (serviceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'services'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String environmentName = ResourceManagerUtils.getValueFromIdByName(id, "environments"); + if (environmentName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'environments'.", id))); + } + return this.getWithResponse(resourceGroupName, serviceName, workspaceName, environmentName, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serviceName = ResourceManagerUtils.getValueFromIdByName(id, "services"); + if (serviceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'services'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String environmentName = ResourceManagerUtils.getValueFromIdByName(id, "environments"); + if (environmentName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'environments'.", id))); + } + this.deleteWithResponse(resourceGroupName, serviceName, workspaceName, environmentName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serviceName = ResourceManagerUtils.getValueFromIdByName(id, "services"); + if (serviceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'services'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String environmentName = ResourceManagerUtils.getValueFromIdByName(id, "environments"); + if (environmentName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'environments'.", id))); + } + return this.deleteWithResponse(resourceGroupName, serviceName, workspaceName, environmentName, context); + } + + private EnvironmentsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.apicenter.ApiCenterManager manager() { + return this.serviceManager; + } + + public EnvironmentImpl define(String name) { + return new EnvironmentImpl(name, this.manager()); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/MetadataSchemaExportResultImpl.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/MetadataSchemaExportResultImpl.java new file mode 100644 index 0000000000000..17bb7b70bbe06 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/MetadataSchemaExportResultImpl.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.implementation; + +import com.azure.resourcemanager.apicenter.fluent.models.MetadataSchemaExportResultInner; +import com.azure.resourcemanager.apicenter.models.MetadataSchemaExportFormat; +import com.azure.resourcemanager.apicenter.models.MetadataSchemaExportResult; + +public final class MetadataSchemaExportResultImpl implements MetadataSchemaExportResult { + private MetadataSchemaExportResultInner innerObject; + + private final com.azure.resourcemanager.apicenter.ApiCenterManager serviceManager; + + MetadataSchemaExportResultImpl(MetadataSchemaExportResultInner innerObject, + com.azure.resourcemanager.apicenter.ApiCenterManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public MetadataSchemaExportFormat format() { + return this.innerModel().format(); + } + + public String value() { + return this.innerModel().value(); + } + + public MetadataSchemaExportResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.apicenter.ApiCenterManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/MetadataSchemaImpl.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/MetadataSchemaImpl.java new file mode 100644 index 0000000000000..6f5b5d67033a0 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/MetadataSchemaImpl.java @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.apicenter.fluent.models.MetadataSchemaInner; +import com.azure.resourcemanager.apicenter.models.MetadataSchema; +import com.azure.resourcemanager.apicenter.models.MetadataSchemaProperties; + +public final class MetadataSchemaImpl implements MetadataSchema, MetadataSchema.Definition, MetadataSchema.Update { + private MetadataSchemaInner innerObject; + + private final com.azure.resourcemanager.apicenter.ApiCenterManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public MetadataSchemaProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public MetadataSchemaInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.apicenter.ApiCenterManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serviceName; + + private String metadataSchemaName; + + public MetadataSchemaImpl withExistingService(String resourceGroupName, String serviceName) { + this.resourceGroupName = resourceGroupName; + this.serviceName = serviceName; + return this; + } + + public MetadataSchema create() { + this.innerObject + = serviceManager.serviceClient().getMetadataSchemas().createOrUpdateWithResponse(resourceGroupName, + serviceName, metadataSchemaName, this.innerModel(), Context.NONE).getValue(); + return this; + } + + public MetadataSchema create(Context context) { + this.innerObject = serviceManager.serviceClient().getMetadataSchemas() + .createOrUpdateWithResponse(resourceGroupName, serviceName, metadataSchemaName, this.innerModel(), context) + .getValue(); + return this; + } + + MetadataSchemaImpl(String name, com.azure.resourcemanager.apicenter.ApiCenterManager serviceManager) { + this.innerObject = new MetadataSchemaInner(); + this.serviceManager = serviceManager; + this.metadataSchemaName = name; + } + + public MetadataSchemaImpl update() { + return this; + } + + public MetadataSchema apply() { + this.innerObject + = serviceManager.serviceClient().getMetadataSchemas().createOrUpdateWithResponse(resourceGroupName, + serviceName, metadataSchemaName, this.innerModel(), Context.NONE).getValue(); + return this; + } + + public MetadataSchema apply(Context context) { + this.innerObject = serviceManager.serviceClient().getMetadataSchemas() + .createOrUpdateWithResponse(resourceGroupName, serviceName, metadataSchemaName, this.innerModel(), context) + .getValue(); + return this; + } + + MetadataSchemaImpl(MetadataSchemaInner innerObject, + com.azure.resourcemanager.apicenter.ApiCenterManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serviceName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "services"); + this.metadataSchemaName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "metadataSchemas"); + } + + public MetadataSchema refresh() { + this.innerObject = serviceManager.serviceClient().getMetadataSchemas() + .getWithResponse(resourceGroupName, serviceName, metadataSchemaName, Context.NONE).getValue(); + return this; + } + + public MetadataSchema refresh(Context context) { + this.innerObject = serviceManager.serviceClient().getMetadataSchemas() + .getWithResponse(resourceGroupName, serviceName, metadataSchemaName, context).getValue(); + return this; + } + + public MetadataSchemaImpl withProperties(MetadataSchemaProperties properties) { + this.innerModel().withProperties(properties); + return this; + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/MetadataSchemasClientImpl.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/MetadataSchemasClientImpl.java new file mode 100644 index 0000000000000..6067fae3fa65c --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/MetadataSchemasClientImpl.java @@ -0,0 +1,896 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.Head; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.apicenter.fluent.MetadataSchemasClient; +import com.azure.resourcemanager.apicenter.fluent.models.MetadataSchemaInner; +import com.azure.resourcemanager.apicenter.models.MetadataSchemaListResult; +import com.azure.resourcemanager.apicenter.models.MetadataSchemasCreateOrUpdateResponse; +import com.azure.resourcemanager.apicenter.models.MetadataSchemasGetResponse; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in MetadataSchemasClient. + */ +public final class MetadataSchemasClientImpl implements MetadataSchemasClient { + /** + * The proxy service used to perform REST calls. + */ + private final MetadataSchemasService service; + + /** + * The service client containing this operation class. + */ + private final AzureApiCenterImpl client; + + /** + * Initializes an instance of MetadataSchemasClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + MetadataSchemasClientImpl(AzureApiCenterImpl client) { + this.service + = RestProxy.create(MetadataSchemasService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureApiCenterMetadataSchemas to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AzureApiCenterMetada") + public interface MetadataSchemasService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/metadataSchemas") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("serviceName") String serviceName, + @QueryParam("$filter") String filter, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/metadataSchemas/{metadataSchemaName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono get(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("serviceName") String serviceName, + @PathParam("metadataSchemaName") String metadataSchemaName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/metadataSchemas/{metadataSchemaName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono createOrUpdate(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("serviceName") String serviceName, + @PathParam("metadataSchemaName") String metadataSchemaName, + @BodyParam("application/json") MetadataSchemaInner resource, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/metadataSchemas/{metadataSchemaName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("serviceName") String serviceName, + @PathParam("metadataSchemaName") String metadataSchemaName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Head("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/metadataSchemas/{metadataSchemaName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> head(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("serviceName") String serviceName, + @PathParam("metadataSchemaName") String metadataSchemaName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Returns a collection of metadata schemas. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param filter OData filter parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a MetadataSchema list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, String serviceName, + String filter) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, serviceName, filter, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns a collection of metadata schemas. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param filter OData filter parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a MetadataSchema list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, String serviceName, + String filter, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, serviceName, filter, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Returns a collection of metadata schemas. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param filter OData filter parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a MetadataSchema list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String serviceName, String filter) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, serviceName, filter), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Returns a collection of metadata schemas. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a MetadataSchema list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String serviceName) { + final String filter = null; + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, serviceName, filter), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Returns a collection of metadata schemas. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param filter OData filter parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a MetadataSchema list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String serviceName, String filter, + Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, serviceName, filter, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Returns a collection of metadata schemas. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a MetadataSchema list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String serviceName) { + final String filter = null; + return new PagedIterable<>(listAsync(resourceGroupName, serviceName, filter)); + } + + /** + * Returns a collection of metadata schemas. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param filter OData filter parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a MetadataSchema list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String serviceName, String filter, + Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, serviceName, filter, context)); + } + + /** + * Returns details of the metadata schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param metadataSchemaName The name of the metadata schema. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metadata schema entity on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getWithResponseAsync(String resourceGroupName, String serviceName, + String metadataSchemaName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (metadataSchemaName == null) { + return Mono + .error(new IllegalArgumentException("Parameter metadataSchemaName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, serviceName, metadataSchemaName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns details of the metadata schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param metadataSchemaName The name of the metadata schema. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metadata schema entity on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getWithResponseAsync(String resourceGroupName, String serviceName, + String metadataSchemaName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (metadataSchemaName == null) { + return Mono + .error(new IllegalArgumentException("Parameter metadataSchemaName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, serviceName, metadataSchemaName, accept, context); + } + + /** + * Returns details of the metadata schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param metadataSchemaName The name of the metadata schema. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metadata schema entity on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String serviceName, + String metadataSchemaName) { + return getWithResponseAsync(resourceGroupName, serviceName, metadataSchemaName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Returns details of the metadata schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param metadataSchemaName The name of the metadata schema. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metadata schema entity. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MetadataSchemasGetResponse getWithResponse(String resourceGroupName, String serviceName, + String metadataSchemaName, Context context) { + return getWithResponseAsync(resourceGroupName, serviceName, metadataSchemaName, context).block(); + } + + /** + * Returns details of the metadata schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param metadataSchemaName The name of the metadata schema. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metadata schema entity. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MetadataSchemaInner get(String resourceGroupName, String serviceName, String metadataSchemaName) { + return getWithResponse(resourceGroupName, serviceName, metadataSchemaName, Context.NONE).getValue(); + } + + /** + * Creates new or updates existing metadata schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param metadataSchemaName The name of the metadata schema. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metadata schema entity on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateWithResponseAsync(String resourceGroupName, + String serviceName, String metadataSchemaName, MetadataSchemaInner resource) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (metadataSchemaName == null) { + return Mono + .error(new IllegalArgumentException("Parameter metadataSchemaName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, serviceName, metadataSchemaName, resource, accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates new or updates existing metadata schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param metadataSchemaName The name of the metadata schema. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metadata schema entity on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateWithResponseAsync(String resourceGroupName, + String serviceName, String metadataSchemaName, MetadataSchemaInner resource, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (metadataSchemaName == null) { + return Mono + .error(new IllegalArgumentException("Parameter metadataSchemaName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, serviceName, metadataSchemaName, resource, accept, + context); + } + + /** + * Creates new or updates existing metadata schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param metadataSchemaName The name of the metadata schema. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metadata schema entity on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String serviceName, + String metadataSchemaName, MetadataSchemaInner resource) { + return createOrUpdateWithResponseAsync(resourceGroupName, serviceName, metadataSchemaName, resource) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates new or updates existing metadata schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param metadataSchemaName The name of the metadata schema. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metadata schema entity. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MetadataSchemasCreateOrUpdateResponse createOrUpdateWithResponse(String resourceGroupName, + String serviceName, String metadataSchemaName, MetadataSchemaInner resource, Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, serviceName, metadataSchemaName, resource, context) + .block(); + } + + /** + * Creates new or updates existing metadata schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param metadataSchemaName The name of the metadata schema. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metadata schema entity. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MetadataSchemaInner createOrUpdate(String resourceGroupName, String serviceName, String metadataSchemaName, + MetadataSchemaInner resource) { + return createOrUpdateWithResponse(resourceGroupName, serviceName, metadataSchemaName, resource, Context.NONE) + .getValue(); + } + + /** + * Deletes specified metadata schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param metadataSchemaName The name of the metadata schema. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String serviceName, + String metadataSchemaName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (metadataSchemaName == null) { + return Mono + .error(new IllegalArgumentException("Parameter metadataSchemaName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, serviceName, metadataSchemaName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes specified metadata schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param metadataSchemaName The name of the metadata schema. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String serviceName, + String metadataSchemaName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (metadataSchemaName == null) { + return Mono + .error(new IllegalArgumentException("Parameter metadataSchemaName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, serviceName, metadataSchemaName, accept, context); + } + + /** + * Deletes specified metadata schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param metadataSchemaName The name of the metadata schema. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String serviceName, String metadataSchemaName) { + return deleteWithResponseAsync(resourceGroupName, serviceName, metadataSchemaName) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Deletes specified metadata schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param metadataSchemaName The name of the metadata schema. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String serviceName, String metadataSchemaName, + Context context) { + return deleteWithResponseAsync(resourceGroupName, serviceName, metadataSchemaName, context).block(); + } + + /** + * Deletes specified metadata schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param metadataSchemaName The name of the metadata schema. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String serviceName, String metadataSchemaName) { + deleteWithResponse(resourceGroupName, serviceName, metadataSchemaName, Context.NONE); + } + + /** + * Checks if specified metadata schema exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param metadataSchemaName The name of the metadata schema. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> headWithResponseAsync(String resourceGroupName, String serviceName, + String metadataSchemaName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (metadataSchemaName == null) { + return Mono + .error(new IllegalArgumentException("Parameter metadataSchemaName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.head(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, serviceName, metadataSchemaName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Checks if specified metadata schema exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param metadataSchemaName The name of the metadata schema. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> headWithResponseAsync(String resourceGroupName, String serviceName, + String metadataSchemaName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (metadataSchemaName == null) { + return Mono + .error(new IllegalArgumentException("Parameter metadataSchemaName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.head(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, serviceName, metadataSchemaName, accept, context); + } + + /** + * Checks if specified metadata schema exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param metadataSchemaName The name of the metadata schema. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono headAsync(String resourceGroupName, String serviceName, String metadataSchemaName) { + return headWithResponseAsync(resourceGroupName, serviceName, metadataSchemaName) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Checks if specified metadata schema exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param metadataSchemaName The name of the metadata schema. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response headWithResponse(String resourceGroupName, String serviceName, String metadataSchemaName, + Context context) { + return headWithResponseAsync(resourceGroupName, serviceName, metadataSchemaName, context).block(); + } + + /** + * Checks if specified metadata schema exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param metadataSchemaName The name of the metadata schema. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void head(String resourceGroupName, String serviceName, String metadataSchemaName) { + headWithResponse(resourceGroupName, serviceName, metadataSchemaName, Context.NONE); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + * + * The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a MetadataSchema list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + * + * The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a MetadataSchema list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/MetadataSchemasImpl.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/MetadataSchemasImpl.java new file mode 100644 index 0000000000000..e065a52584add --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/MetadataSchemasImpl.java @@ -0,0 +1,169 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.apicenter.fluent.MetadataSchemasClient; +import com.azure.resourcemanager.apicenter.fluent.models.MetadataSchemaInner; +import com.azure.resourcemanager.apicenter.models.MetadataSchema; +import com.azure.resourcemanager.apicenter.models.MetadataSchemas; +import com.azure.resourcemanager.apicenter.models.MetadataSchemasGetResponse; + +public final class MetadataSchemasImpl implements MetadataSchemas { + private static final ClientLogger LOGGER = new ClientLogger(MetadataSchemasImpl.class); + + private final MetadataSchemasClient innerClient; + + private final com.azure.resourcemanager.apicenter.ApiCenterManager serviceManager; + + public MetadataSchemasImpl(MetadataSchemasClient innerClient, + com.azure.resourcemanager.apicenter.ApiCenterManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String serviceName) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, serviceName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new MetadataSchemaImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String serviceName, String filter, + Context context) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, serviceName, filter, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new MetadataSchemaImpl(inner1, this.manager())); + } + + public Response getWithResponse(String resourceGroupName, String serviceName, + String metadataSchemaName, Context context) { + MetadataSchemasGetResponse inner + = this.serviceClient().getWithResponse(resourceGroupName, serviceName, metadataSchemaName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new MetadataSchemaImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public MetadataSchema get(String resourceGroupName, String serviceName, String metadataSchemaName) { + MetadataSchemaInner inner = this.serviceClient().get(resourceGroupName, serviceName, metadataSchemaName); + if (inner != null) { + return new MetadataSchemaImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteWithResponse(String resourceGroupName, String serviceName, String metadataSchemaName, + Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, serviceName, metadataSchemaName, context); + } + + public void delete(String resourceGroupName, String serviceName, String metadataSchemaName) { + this.serviceClient().delete(resourceGroupName, serviceName, metadataSchemaName); + } + + public Response headWithResponse(String resourceGroupName, String serviceName, String metadataSchemaName, + Context context) { + return this.serviceClient().headWithResponse(resourceGroupName, serviceName, metadataSchemaName, context); + } + + public void head(String resourceGroupName, String serviceName, String metadataSchemaName) { + this.serviceClient().head(resourceGroupName, serviceName, metadataSchemaName); + } + + public MetadataSchema getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serviceName = ResourceManagerUtils.getValueFromIdByName(id, "services"); + if (serviceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'services'.", id))); + } + String metadataSchemaName = ResourceManagerUtils.getValueFromIdByName(id, "metadataSchemas"); + if (metadataSchemaName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'metadataSchemas'.", id))); + } + return this.getWithResponse(resourceGroupName, serviceName, metadataSchemaName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serviceName = ResourceManagerUtils.getValueFromIdByName(id, "services"); + if (serviceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'services'.", id))); + } + String metadataSchemaName = ResourceManagerUtils.getValueFromIdByName(id, "metadataSchemas"); + if (metadataSchemaName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'metadataSchemas'.", id))); + } + return this.getWithResponse(resourceGroupName, serviceName, metadataSchemaName, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serviceName = ResourceManagerUtils.getValueFromIdByName(id, "services"); + if (serviceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'services'.", id))); + } + String metadataSchemaName = ResourceManagerUtils.getValueFromIdByName(id, "metadataSchemas"); + if (metadataSchemaName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'metadataSchemas'.", id))); + } + this.deleteWithResponse(resourceGroupName, serviceName, metadataSchemaName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serviceName = ResourceManagerUtils.getValueFromIdByName(id, "services"); + if (serviceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'services'.", id))); + } + String metadataSchemaName = ResourceManagerUtils.getValueFromIdByName(id, "metadataSchemas"); + if (metadataSchemaName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'metadataSchemas'.", id))); + } + return this.deleteWithResponse(resourceGroupName, serviceName, metadataSchemaName, context); + } + + private MetadataSchemasClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.apicenter.ApiCenterManager manager() { + return this.serviceManager; + } + + public MetadataSchemaImpl define(String name) { + return new MetadataSchemaImpl(name, this.manager()); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/OperationsClientImpl.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/OperationsClientImpl.java index ab602fcd347c8..8b3b45d04ce89 100644 --- a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/OperationsClientImpl.java +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/OperationsClientImpl.java @@ -30,22 +30,28 @@ import com.azure.resourcemanager.apicenter.models.OperationListResult; import reactor.core.publisher.Mono; -/** An instance of this class provides access to all the operations defined in OperationsClient. */ +/** + * An instance of this class provides access to all the operations defined in OperationsClient. + */ public final class OperationsClientImpl implements OperationsClient { - /** The proxy service used to perform REST calls. */ + /** + * The proxy service used to perform REST calls. + */ private final OperationsService service; - /** The service client containing this operation class. */ + /** + * The service client containing this operation class. + */ private final AzureApiCenterImpl client; /** * Initializes an instance of OperationsClientImpl. - * + * * @param client the instance of the service client containing this operation class. */ OperationsClientImpl(AzureApiCenterImpl client) { - this.service = - RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.service + = RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); this.client = client; } @@ -56,99 +62,74 @@ public final class OperationsClientImpl implements OperationsClient { @Host("{$host}") @ServiceInterface(name = "AzureApiCenterOperat") public interface OperationsService { - @Headers({"Content-Type: application/json"}) + @Headers({ "Content-Type: application/json" }) @Get("/providers/Microsoft.ApiCenter/operations") - @ExpectedResponses({200}) + @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> list( - @HostParam("$host") String endpoint, - @QueryParam("api-version") String apiVersion, - @HeaderParam("Accept") String accept, - Context context); + Mono> list(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); - @Headers({"Content-Type: application/json"}) + @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") - @ExpectedResponses({200}) + @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("$host") String endpoint, - @HeaderParam("Accept") String accept, - Context context); + Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); } /** * List the operations for the provider. - * + * * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on - * successful completion of {@link Mono}. + * successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listSinglePageAsync() { if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); } final String accept = "application/json"; return FluxUtil .withContext( context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) - .>map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().nextLink(), - null)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** * List the operations for the provider. - * + * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on - * successful completion of {@link Mono}. + * successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listSinglePageAsync(Context context) { if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); } final String accept = "application/json"; context = this.client.mergeContext(context); - return service - .list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context) - .map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().nextLink(), - null)); + return service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); } /** * List the operations for the provider. - * + * * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with {@link - * PagedFlux}. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listAsync() { @@ -157,27 +138,27 @@ private PagedFlux listAsync() { /** * List the operations for the provider. - * + * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with {@link - * PagedFlux}. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listAsync(Context context) { - return new PagedFlux<>( - () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + return new PagedFlux<>(() -> listSinglePageAsync(context), + nextLink -> listNextSinglePageAsync(nextLink, context)); } /** * List the operations for the provider. - * + * * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with {@link - * PagedIterable}. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list() { @@ -186,13 +167,13 @@ public PagedIterable list() { /** * List the operations for the provider. - * + * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with {@link - * PagedIterable}. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(Context context) { @@ -201,14 +182,15 @@ public PagedIterable list(Context context) { /** * Get the next page of items. - * + * * @param nextLink The URL to get the next list of items - *

The nextLink parameter. + * + * The nextLink parameter. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on - * successful completion of {@link Mono}. + * successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listNextSinglePageAsync(String nextLink) { @@ -216,37 +198,28 @@ private Mono> listNextSinglePageAsync(String nextL return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); } if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); } final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) - .>map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().nextLink(), - null)) + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** * Get the next page of items. - * + * * @param nextLink The URL to get the next list of items - *

The nextLink parameter. + * + * The nextLink parameter. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on - * successful completion of {@link Mono}. + * successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listNextSinglePageAsync(String nextLink, Context context) { @@ -254,23 +227,13 @@ private Mono> listNextSinglePageAsync(String nextL return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); } if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); } final String accept = "application/json"; context = this.client.mergeContext(context); - return service - .listNext(nextLink, this.client.getEndpoint(), accept, context) - .map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().nextLink(), - null)); + return service.listNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); } } diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/OperationsImpl.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/OperationsImpl.java index c2b7c983c5d53..95d567b8b92f2 100644 --- a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/OperationsImpl.java +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/OperationsImpl.java @@ -19,20 +19,20 @@ public final class OperationsImpl implements Operations { private final com.azure.resourcemanager.apicenter.ApiCenterManager serviceManager; - public OperationsImpl( - OperationsClient innerClient, com.azure.resourcemanager.apicenter.ApiCenterManager serviceManager) { + public OperationsImpl(OperationsClient innerClient, + com.azure.resourcemanager.apicenter.ApiCenterManager serviceManager) { this.innerClient = innerClient; this.serviceManager = serviceManager; } public PagedIterable list() { PagedIterable inner = this.serviceClient().list(); - return Utils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + return ResourceManagerUtils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); } public PagedIterable list(Context context) { PagedIterable inner = this.serviceClient().list(context); - return Utils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + return ResourceManagerUtils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); } private OperationsClient serviceClient() { diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/Utils.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/ResourceManagerUtils.java similarity index 79% rename from sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/Utils.java rename to sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/ResourceManagerUtils.java index 87c674191f4cf..84e153ae7dca1 100644 --- a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/Utils.java +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/ResourceManagerUtils.java @@ -19,7 +19,10 @@ import java.util.stream.Stream; import reactor.core.publisher.Flux; -final class Utils { +final class ResourceManagerUtils { + private ResourceManagerUtils() { + } + static String getValueFromIdByName(String id, String name) { if (id == null) { return null; @@ -38,6 +41,7 @@ static String getValueFromIdByName(String id, String name) { } } return null; + } static String getValueFromIdByParameterName(String id, String pathTemplate, String parameterName) { @@ -60,7 +64,7 @@ static String getValueFromIdByParameterName(String id, String pathTemplate, Stri segments.add(idSegment); idItrReverted.forEachRemaining(segments::add); Collections.reverse(segments); - if (segments.size() > 0 && segments.get(0).isEmpty()) { + if (!segments.isEmpty() && segments.get(0).isEmpty()) { segments.remove(0); } return String.join("/", segments); @@ -71,10 +75,11 @@ static String getValueFromIdByParameterName(String id, String pathTemplate, Stri } } return null; + } static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) { - return new PagedIterableImpl(pageIterable, mapper); + return new PagedIterableImpl<>(pageIterable, mapper); } private static final class PagedIterableImpl extends PagedIterable { @@ -84,26 +89,17 @@ private static final class PagedIterableImpl extends PagedIterable { private final Function, PagedResponse> pageMapper; private PagedIterableImpl(PagedIterable pagedIterable, Function mapper) { - super( - PagedFlux - .create( - () -> - (continuationToken, pageSize) -> - Flux.fromStream(pagedIterable.streamByPage().map(getPageMapper(mapper))))); + super(PagedFlux.create(() -> (continuationToken, pageSize) -> Flux + .fromStream(pagedIterable.streamByPage().map(getPageMapper(mapper))))); this.pagedIterable = pagedIterable; this.mapper = mapper; this.pageMapper = getPageMapper(mapper); } private static Function, PagedResponse> getPageMapper(Function mapper) { - return page -> - new PagedResponseBase( - page.getRequest(), - page.getStatusCode(), - page.getHeaders(), - page.getElements().stream().map(mapper).collect(Collectors.toList()), - page.getContinuationToken(), - null); + return page -> new PagedResponseBase(page.getRequest(), page.getStatusCode(), page.getHeaders(), + page.getElements().stream().map(mapper).collect(Collectors.toList()), page.getContinuationToken(), + null); } @Override @@ -133,30 +129,27 @@ public Stream> streamByPage(String continuationToken, int prefe @Override public Iterator iterator() { - return new IteratorImpl(pagedIterable.iterator(), mapper); + return new IteratorImpl<>(pagedIterable.iterator(), mapper); } @Override public Iterable> iterableByPage() { - return new IterableImpl, PagedResponse>(pagedIterable.iterableByPage(), pageMapper); + return new IterableImpl<>(pagedIterable.iterableByPage(), pageMapper); } @Override public Iterable> iterableByPage(String continuationToken) { - return new IterableImpl, PagedResponse>( - pagedIterable.iterableByPage(continuationToken), pageMapper); + return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken), pageMapper); } @Override public Iterable> iterableByPage(int preferredPageSize) { - return new IterableImpl, PagedResponse>( - pagedIterable.iterableByPage(preferredPageSize), pageMapper); + return new IterableImpl<>(pagedIterable.iterableByPage(preferredPageSize), pageMapper); } @Override public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { - return new IterableImpl, PagedResponse>( - pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); + return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); } } @@ -198,7 +191,7 @@ private IterableImpl(Iterable iterable, Function mapper) { @Override public Iterator iterator() { - return new IteratorImpl(iterable.iterator(), mapper); + return new IteratorImpl<>(iterable.iterator(), mapper); } } } diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/ServiceImpl.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/ServiceImpl.java index f9c14f4731cd3..76fc8b8110cdd 100644 --- a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/ServiceImpl.java +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/ServiceImpl.java @@ -9,8 +9,10 @@ import com.azure.core.util.Context; import com.azure.resourcemanager.apicenter.fluent.models.ServiceInner; import com.azure.resourcemanager.apicenter.models.ManagedServiceIdentity; -import com.azure.resourcemanager.apicenter.models.ProvisioningState; +import com.azure.resourcemanager.apicenter.models.MetadataSchemaExportRequest; +import com.azure.resourcemanager.apicenter.models.MetadataSchemaExportResult; import com.azure.resourcemanager.apicenter.models.Service; +import com.azure.resourcemanager.apicenter.models.ServiceProperties; import com.azure.resourcemanager.apicenter.models.ServiceUpdate; import java.util.Collections; import java.util.Map; @@ -45,6 +47,10 @@ public Map tags() { } } + public ServiceProperties properties() { + return this.innerModel().properties(); + } + public ManagedServiceIdentity identity() { return this.innerModel().identity(); } @@ -53,10 +59,6 @@ public SystemData systemData() { return this.innerModel().systemData(); } - public ProvisioningState provisioningState() { - return this.innerModel().provisioningState(); - } - public Region region() { return Region.fromName(this.regionName()); } @@ -81,7 +83,7 @@ private com.azure.resourcemanager.apicenter.ApiCenterManager manager() { private String serviceName; - private ServiceUpdate updateParameters; + private ServiceUpdate updateProperties; public ServiceImpl withExistingResourceGroup(String resourceGroupName) { this.resourceGroupName = resourceGroupName; @@ -89,22 +91,14 @@ public ServiceImpl withExistingResourceGroup(String resourceGroupName) { } public Service create() { - this.innerObject = - serviceManager - .serviceClient() - .getServices() - .createOrUpdateWithResponse(resourceGroupName, serviceName, this.innerModel(), Context.NONE) - .getValue(); + this.innerObject = serviceManager.serviceClient().getServices() + .createOrUpdateWithResponse(resourceGroupName, serviceName, this.innerModel(), Context.NONE).getValue(); return this; } public Service create(Context context) { - this.innerObject = - serviceManager - .serviceClient() - .getServices() - .createOrUpdateWithResponse(resourceGroupName, serviceName, this.innerModel(), context) - .getValue(); + this.innerObject = serviceManager.serviceClient().getServices() + .createOrUpdateWithResponse(resourceGroupName, serviceName, this.innerModel(), context).getValue(); return this; } @@ -115,57 +109,49 @@ public Service create(Context context) { } public ServiceImpl update() { - this.updateParameters = new ServiceUpdate(); + this.updateProperties = new ServiceUpdate(); return this; } public Service apply() { - this.innerObject = - serviceManager - .serviceClient() - .getServices() - .updateWithResponse(resourceGroupName, serviceName, updateParameters, Context.NONE) - .getValue(); + this.innerObject = serviceManager.serviceClient().getServices() + .updateWithResponse(resourceGroupName, serviceName, updateProperties, Context.NONE).getValue(); return this; } public Service apply(Context context) { - this.innerObject = - serviceManager - .serviceClient() - .getServices() - .updateWithResponse(resourceGroupName, serviceName, updateParameters, context) - .getValue(); + this.innerObject = serviceManager.serviceClient().getServices() + .updateWithResponse(resourceGroupName, serviceName, updateProperties, context).getValue(); return this; } ServiceImpl(ServiceInner innerObject, com.azure.resourcemanager.apicenter.ApiCenterManager serviceManager) { this.innerObject = innerObject; this.serviceManager = serviceManager; - this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); - this.serviceName = Utils.getValueFromIdByName(innerObject.id(), "services"); + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serviceName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "services"); } public Service refresh() { - this.innerObject = - serviceManager - .serviceClient() - .getServices() - .getByResourceGroupWithResponse(resourceGroupName, serviceName, Context.NONE) - .getValue(); + this.innerObject = serviceManager.serviceClient().getServices() + .getByResourceGroupWithResponse(resourceGroupName, serviceName, Context.NONE).getValue(); return this; } public Service refresh(Context context) { - this.innerObject = - serviceManager - .serviceClient() - .getServices() - .getByResourceGroupWithResponse(resourceGroupName, serviceName, context) - .getValue(); + this.innerObject = serviceManager.serviceClient().getServices() + .getByResourceGroupWithResponse(resourceGroupName, serviceName, context).getValue(); return this; } + public MetadataSchemaExportResult exportMetadataSchema(MetadataSchemaExportRequest body) { + return serviceManager.services().exportMetadataSchema(resourceGroupName, serviceName, body); + } + + public MetadataSchemaExportResult exportMetadataSchema(MetadataSchemaExportRequest body, Context context) { + return serviceManager.services().exportMetadataSchema(resourceGroupName, serviceName, body, context); + } + public ServiceImpl withRegion(Region location) { this.innerModel().withLocation(location.toString()); return this; @@ -177,12 +163,31 @@ public ServiceImpl withRegion(String location) { } public ServiceImpl withTags(Map tags) { - this.innerModel().withTags(tags); + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateProperties.withTags(tags); + return this; + } + } + + public ServiceImpl withProperties(ServiceProperties properties) { + this.innerModel().withProperties(properties); return this; } public ServiceImpl withIdentity(ManagedServiceIdentity identity) { - this.innerModel().withIdentity(identity); - return this; + if (isInCreateMode()) { + this.innerModel().withIdentity(identity); + return this; + } else { + this.updateProperties.withIdentity(identity); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; } } diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/ServicesClientImpl.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/ServicesClientImpl.java index 4f0a5791be46a..c719dca22b83b 100644 --- a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/ServicesClientImpl.java +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/ServicesClientImpl.java @@ -14,6 +14,7 @@ import com.azure.core.annotation.HostParam; import com.azure.core.annotation.Patch; import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; import com.azure.core.annotation.Put; import com.azure.core.annotation.QueryParam; import com.azure.core.annotation.ReturnType; @@ -27,25 +28,38 @@ import com.azure.core.http.rest.Response; import com.azure.core.http.rest.RestProxy; import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; import com.azure.resourcemanager.apicenter.fluent.ServicesClient; +import com.azure.resourcemanager.apicenter.fluent.models.MetadataSchemaExportResultInner; import com.azure.resourcemanager.apicenter.fluent.models.ServiceInner; -import com.azure.resourcemanager.apicenter.models.ServiceCollection; +import com.azure.resourcemanager.apicenter.models.MetadataSchemaExportRequest; +import com.azure.resourcemanager.apicenter.models.ServiceListResult; import com.azure.resourcemanager.apicenter.models.ServiceUpdate; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; -/** An instance of this class provides access to all the operations defined in ServicesClient. */ +/** + * An instance of this class provides access to all the operations defined in ServicesClient. + */ public final class ServicesClientImpl implements ServicesClient { - /** The proxy service used to perform REST calls. */ + /** + * The proxy service used to perform REST calls. + */ private final ServicesService service; - /** The service client containing this operation class. */ + /** + * The service client containing this operation class. + */ private final AzureApiCenterImpl client; /** * Initializes an instance of ServicesClientImpl. - * + * * @param client the instance of the service client containing this operation class. */ ServicesClientImpl(AzureApiCenterImpl client) { @@ -60,214 +74,160 @@ public final class ServicesClientImpl implements ServicesClient { @Host("{$host}") @ServiceInterface(name = "AzureApiCenterServic") public interface ServicesService { - @Headers({"Content-Type: application/json"}) + @Headers({ "Content-Type: application/json" }) @Get("/subscriptions/{subscriptionId}/providers/Microsoft.ApiCenter/services") - @ExpectedResponses({200}) + @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> list( - @HostParam("$host") String endpoint, - @QueryParam("api-version") String apiVersion, - @PathParam("subscriptionId") String subscriptionId, - @HeaderParam("Accept") String accept, - Context context); + Mono> list(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); - @Headers({"Content-Type: application/json"}) - @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services") - @ExpectedResponses({200}) + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services") + @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listByResourceGroup( - @HostParam("$host") String endpoint, - @QueryParam("api-version") String apiVersion, - @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @HeaderParam("Accept") String accept, + Mono> listByResourceGroup(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, Context context); - @Headers({"Content-Type: application/json"}) - @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}") - @ExpectedResponses({200}) + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}") + @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> getByResourceGroup( - @HostParam("$host") String endpoint, - @QueryParam("api-version") String apiVersion, - @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("serviceName") String serviceName, - @HeaderParam("Accept") String accept, - Context context); + Mono> getByResourceGroup(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("serviceName") String serviceName, + @HeaderParam("Accept") String accept, Context context); - @Headers({"Content-Type: application/json"}) - @Put( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}") - @ExpectedResponses({200, 201}) + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}") + @ExpectedResponses({ 200, 201 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> createOrUpdate( - @HostParam("$host") String endpoint, - @QueryParam("api-version") String apiVersion, - @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("serviceName") String serviceName, - @BodyParam("application/json") ServiceInner resource, - @HeaderParam("Accept") String accept, + Mono> createOrUpdate(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("serviceName") String serviceName, + @BodyParam("application/json") ServiceInner resource, @HeaderParam("Accept") String accept, Context context); - @Headers({"Content-Type: application/json"}) - @Patch( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}") - @ExpectedResponses({200}) + @Headers({ "Content-Type: application/json" }) + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}") + @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> update( - @HostParam("$host") String endpoint, - @QueryParam("api-version") String apiVersion, - @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("serviceName") String serviceName, - @BodyParam("application/json") ServiceUpdate parameters, - @HeaderParam("Accept") String accept, + Mono> update(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("serviceName") String serviceName, + @BodyParam("application/json") ServiceUpdate properties, @HeaderParam("Accept") String accept, Context context); - @Headers({"Content-Type: application/json"}) - @Delete( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}") - @ExpectedResponses({200, 204}) + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}") + @ExpectedResponses({ 200, 204 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> delete( - @HostParam("$host") String endpoint, - @QueryParam("api-version") String apiVersion, + Mono> delete(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("serviceName") String serviceName, - @HeaderParam("Accept") String accept, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("serviceName") String serviceName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/exportMetadataSchema") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> exportMetadataSchema(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("serviceName") String serviceName, + @BodyParam("application/json") MetadataSchemaExportRequest body, @HeaderParam("Accept") String accept, Context context); - @Headers({"Content-Type: application/json"}) + @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") - @ExpectedResponses({200}) + @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listBySubscriptionNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("$host") String endpoint, - @HeaderParam("Accept") String accept, - Context context); + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); - @Headers({"Content-Type: application/json"}) + @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") - @ExpectedResponses({200}) + @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listByResourceGroupNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("$host") String endpoint, - @HeaderParam("Accept") String accept, - Context context); + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); } /** * Lists services within an Azure subscription. - * + * * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response of a Service list operation along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listSinglePageAsync() { if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } final String accept = "application/json"; return FluxUtil - .withContext( - context -> - service - .list( - this.client.getEndpoint(), - this.client.getApiVersion(), - this.client.getSubscriptionId(), - accept, - context)) - .>map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().nextLink(), - null)) + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** * Lists services within an Azure subscription. - * + * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response of a Service list operation along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listSinglePageAsync(Context context) { if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } final String accept = "application/json"; context = this.client.mergeContext(context); return service - .list( - this.client.getEndpoint(), - this.client.getApiVersion(), - this.client.getSubscriptionId(), - accept, + .list(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context) - .map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().nextLink(), - null)); + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); } /** * Lists services within an Azure subscription. - * + * * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response of a Service list operation as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listAsync() { - return new PagedFlux<>( - () -> listSinglePageAsync(), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + return new PagedFlux<>(() -> listSinglePageAsync(), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); } /** * Lists services within an Azure subscription. - * + * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -276,13 +236,13 @@ private PagedFlux listAsync() { */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listAsync(Context context) { - return new PagedFlux<>( - () -> listSinglePageAsync(context), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + return new PagedFlux<>(() -> listSinglePageAsync(context), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); } /** * Lists services within an Azure subscription. - * + * * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response of a Service list operation as paginated response with {@link PagedIterable}. @@ -294,7 +254,7 @@ public PagedIterable list() { /** * Lists services within an Azure subscription. - * + * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -307,28 +267,24 @@ public PagedIterable list(Context context) { } /** - * Lists services within a resource group. - * + * Returns a collection of services within the resource group. + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response of a Service list operation along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (resourceGroupName == null) { return Mono @@ -336,53 +292,34 @@ private Mono> listByResourceGroupSinglePageAsync(Str } final String accept = "application/json"; return FluxUtil - .withContext( - context -> - service - .listByResourceGroup( - this.client.getEndpoint(), - this.client.getApiVersion(), - this.client.getSubscriptionId(), - resourceGroupName, - accept, - context)) - .>map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().nextLink(), - null)) + .withContext(context -> service.listByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * Lists services within a resource group. - * + * Returns a collection of services within the resource group. + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response of a Service list operation along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByResourceGroupSinglePageAsync( - String resourceGroupName, Context context) { + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName, + Context context) { if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (resourceGroupName == null) { return Mono @@ -391,27 +328,15 @@ private Mono> listByResourceGroupSinglePageAsync( final String accept = "application/json"; context = this.client.mergeContext(context); return service - .listByResourceGroup( - this.client.getEndpoint(), - this.client.getApiVersion(), - this.client.getSubscriptionId(), - resourceGroupName, - accept, - context) - .map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().nextLink(), - null)); + .listByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); } /** - * Lists services within a resource group. - * + * Returns a collection of services within the resource group. + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -420,14 +345,13 @@ private Mono> listByResourceGroupSinglePageAsync( */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listByResourceGroupAsync(String resourceGroupName) { - return new PagedFlux<>( - () -> listByResourceGroupSinglePageAsync(resourceGroupName), + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName), nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); } /** - * Lists services within a resource group. - * + * Returns a collection of services within the resource group. + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -437,14 +361,13 @@ private PagedFlux listByResourceGroupAsync(String resourceGroupNam */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { - return new PagedFlux<>( - () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, context), nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); } /** - * Lists services within a resource group. - * + * Returns a collection of services within the resource group. + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -457,8 +380,8 @@ public PagedIterable listByResourceGroup(String resourceGroupName) } /** - * Lists services within a resource group. - * + * Returns a collection of services within the resource group. + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -472,29 +395,25 @@ public PagedIterable listByResourceGroup(String resourceGroupName, } /** - * Get service. - * + * Returns details of the service. + * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serviceName Service name. + * @param serviceName The name of Azure API Center service. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return service along with {@link Response} on successful completion of {@link Mono}. + * @return the service entity along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getByResourceGroupWithResponseAsync( - String resourceGroupName, String serviceName) { + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String serviceName) { if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (resourceGroupName == null) { return Mono @@ -505,45 +424,32 @@ private Mono> getByResourceGroupWithResponseAsync( } final String accept = "application/json"; return FluxUtil - .withContext( - context -> - service - .getByResourceGroup( - this.client.getEndpoint(), - this.client.getApiVersion(), - this.client.getSubscriptionId(), - resourceGroupName, - serviceName, - accept, - context)) + .withContext(context -> service.getByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, serviceName, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * Get service. - * + * Returns details of the service. + * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serviceName Service name. + * @param serviceName The name of Azure API Center service. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return service along with {@link Response} on successful completion of {@link Mono}. + * @return the service entity along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getByResourceGroupWithResponseAsync( - String resourceGroupName, String serviceName, Context context) { + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String serviceName, Context context) { if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (resourceGroupName == null) { return Mono @@ -554,26 +460,19 @@ private Mono> getByResourceGroupWithResponseAsync( } final String accept = "application/json"; context = this.client.mergeContext(context); - return service - .getByResourceGroup( - this.client.getEndpoint(), - this.client.getApiVersion(), - this.client.getSubscriptionId(), - resourceGroupName, - serviceName, - accept, - context); + return service.getByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, serviceName, accept, context); } /** - * Get service. - * + * Returns details of the service. + * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serviceName Service name. + * @param serviceName The name of Azure API Center service. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return service on successful completion of {@link Mono}. + * @return the service entity on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono getByResourceGroupAsync(String resourceGroupName, String serviceName) { @@ -582,31 +481,31 @@ private Mono getByResourceGroupAsync(String resourceGroupName, Str } /** - * Get service. - * + * Returns details of the service. + * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serviceName Service name. + * @param serviceName The name of Azure API Center service. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return service along with {@link Response}. + * @return the service entity along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response getByResourceGroupWithResponse( - String resourceGroupName, String serviceName, Context context) { + public Response getByResourceGroupWithResponse(String resourceGroupName, String serviceName, + Context context) { return getByResourceGroupWithResponseAsync(resourceGroupName, serviceName, context).block(); } /** - * Get service. - * + * Returns details of the service. + * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serviceName Service name. + * @param serviceName The name of Azure API Center service. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return service. + * @return the service entity. */ @ServiceMethod(returns = ReturnType.SINGLE) public ServiceInner getByResourceGroup(String resourceGroupName, String serviceName) { @@ -614,30 +513,26 @@ public ServiceInner getByResourceGroup(String resourceGroupName, String serviceN } /** - * Create or update service. - * + * Creates new or updates existing API. + * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serviceName Service name. - * @param resource The service entity. + * @param serviceName The name of Azure API Center service. + * @param resource Resource create parameters. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the service entity along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> createOrUpdateWithResponseAsync( - String resourceGroupName, String serviceName, ServiceInner resource) { + private Mono> createOrUpdateWithResponseAsync(String resourceGroupName, String serviceName, + ServiceInner resource) { if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (resourceGroupName == null) { return Mono @@ -646,32 +541,24 @@ private Mono> createOrUpdateWithResponseAsync( if (serviceName == null) { return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); } - if (resource != null) { + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { resource.validate(); } final String accept = "application/json"; return FluxUtil - .withContext( - context -> - service - .createOrUpdate( - this.client.getEndpoint(), - this.client.getApiVersion(), - this.client.getSubscriptionId(), - resourceGroupName, - serviceName, - resource, - accept, - context)) + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, serviceName, resource, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * Create or update service. - * + * Creates new or updates existing API. + * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serviceName Service name. - * @param resource The service entity. + * @param serviceName The name of Azure API Center service. + * @param resource Resource create parameters. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -679,19 +566,15 @@ private Mono> createOrUpdateWithResponseAsync( * @return the service entity along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> createOrUpdateWithResponseAsync( - String resourceGroupName, String serviceName, ServiceInner resource, Context context) { + private Mono> createOrUpdateWithResponseAsync(String resourceGroupName, String serviceName, + ServiceInner resource, Context context) { if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (resourceGroupName == null) { return Mono @@ -700,46 +583,41 @@ private Mono> createOrUpdateWithResponseAsync( if (serviceName == null) { return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); } - if (resource != null) { + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { resource.validate(); } final String accept = "application/json"; context = this.client.mergeContext(context); - return service - .createOrUpdate( - this.client.getEndpoint(), - this.client.getApiVersion(), - this.client.getSubscriptionId(), - resourceGroupName, - serviceName, - resource, - accept, - context); + return service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, serviceName, resource, accept, context); } /** - * Create or update service. - * + * Creates new or updates existing API. + * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serviceName Service name. + * @param serviceName The name of Azure API Center service. + * @param resource Resource create parameters. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the service entity on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono createOrUpdateAsync(String resourceGroupName, String serviceName) { - final ServiceInner resource = null; + private Mono createOrUpdateAsync(String resourceGroupName, String serviceName, + ServiceInner resource) { return createOrUpdateWithResponseAsync(resourceGroupName, serviceName, resource) .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** - * Create or update service. - * + * Creates new or updates existing API. + * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serviceName Service name. - * @param resource The service entity. + * @param serviceName The name of Azure API Center service. + * @param resource Resource create parameters. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -747,52 +625,48 @@ private Mono createOrUpdateAsync(String resourceGroupName, String * @return the service entity along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response createOrUpdateWithResponse( - String resourceGroupName, String serviceName, ServiceInner resource, Context context) { + public Response createOrUpdateWithResponse(String resourceGroupName, String serviceName, + ServiceInner resource, Context context) { return createOrUpdateWithResponseAsync(resourceGroupName, serviceName, resource, context).block(); } /** - * Create or update service. - * + * Creates new or updates existing API. + * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serviceName Service name. + * @param serviceName The name of Azure API Center service. + * @param resource Resource create parameters. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the service entity. */ @ServiceMethod(returns = ReturnType.SINGLE) - public ServiceInner createOrUpdate(String resourceGroupName, String serviceName) { - final ServiceInner resource = null; + public ServiceInner createOrUpdate(String resourceGroupName, String serviceName, ServiceInner resource) { return createOrUpdateWithResponse(resourceGroupName, serviceName, resource, Context.NONE).getValue(); } /** - * Update service. - * + * Updates existing service. + * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serviceName Service name. - * @param parameters The service properties to be updated. + * @param serviceName The name of Azure API Center service. + * @param properties The resource properties to be updated. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the service entity along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> updateWithResponseAsync( - String resourceGroupName, String serviceName, ServiceUpdate parameters) { + private Mono> updateWithResponseAsync(String resourceGroupName, String serviceName, + ServiceUpdate properties) { if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (resourceGroupName == null) { return Mono @@ -801,32 +675,24 @@ private Mono> updateWithResponseAsync( if (serviceName == null) { return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); } - if (parameters != null) { - parameters.validate(); + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); } final String accept = "application/json"; return FluxUtil - .withContext( - context -> - service - .update( - this.client.getEndpoint(), - this.client.getApiVersion(), - this.client.getSubscriptionId(), - resourceGroupName, - serviceName, - parameters, - accept, - context)) + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, serviceName, properties, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * Update service. - * + * Updates existing service. + * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serviceName Service name. - * @param parameters The service properties to be updated. + * @param serviceName The name of Azure API Center service. + * @param properties The resource properties to be updated. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -834,19 +700,15 @@ private Mono> updateWithResponseAsync( * @return the service entity along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> updateWithResponseAsync( - String resourceGroupName, String serviceName, ServiceUpdate parameters, Context context) { + private Mono> updateWithResponseAsync(String resourceGroupName, String serviceName, + ServiceUpdate properties, Context context) { if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (resourceGroupName == null) { return Mono @@ -855,46 +717,40 @@ private Mono> updateWithResponseAsync( if (serviceName == null) { return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); } - if (parameters != null) { - parameters.validate(); + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); } final String accept = "application/json"; context = this.client.mergeContext(context); - return service - .update( - this.client.getEndpoint(), - this.client.getApiVersion(), - this.client.getSubscriptionId(), - resourceGroupName, - serviceName, - parameters, - accept, - context); + return service.update(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, serviceName, properties, accept, context); } /** - * Update service. - * + * Updates existing service. + * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serviceName Service name. + * @param serviceName The name of Azure API Center service. + * @param properties The resource properties to be updated. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the service entity on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono updateAsync(String resourceGroupName, String serviceName) { - final ServiceUpdate parameters = null; - return updateWithResponseAsync(resourceGroupName, serviceName, parameters) + private Mono updateAsync(String resourceGroupName, String serviceName, ServiceUpdate properties) { + return updateWithResponseAsync(resourceGroupName, serviceName, properties) .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** - * Update service. - * + * Updates existing service. + * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serviceName Service name. - * @param parameters The service properties to be updated. + * @param serviceName The name of Azure API Center service. + * @param properties The resource properties to be updated. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -902,32 +758,32 @@ private Mono updateAsync(String resourceGroupName, String serviceN * @return the service entity along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response updateWithResponse( - String resourceGroupName, String serviceName, ServiceUpdate parameters, Context context) { - return updateWithResponseAsync(resourceGroupName, serviceName, parameters, context).block(); + public Response updateWithResponse(String resourceGroupName, String serviceName, + ServiceUpdate properties, Context context) { + return updateWithResponseAsync(resourceGroupName, serviceName, properties, context).block(); } /** - * Update service. - * + * Updates existing service. + * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serviceName Service name. + * @param serviceName The name of Azure API Center service. + * @param properties The resource properties to be updated. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the service entity. */ @ServiceMethod(returns = ReturnType.SINGLE) - public ServiceInner update(String resourceGroupName, String serviceName) { - final ServiceUpdate parameters = null; - return updateWithResponse(resourceGroupName, serviceName, parameters, Context.NONE).getValue(); + public ServiceInner update(String resourceGroupName, String serviceName, ServiceUpdate properties) { + return updateWithResponse(resourceGroupName, serviceName, properties, Context.NONE).getValue(); } /** - * Delete service. - * + * Deletes specified service. + * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serviceName Service name. + * @param serviceName The name of Azure API Center service. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -936,16 +792,12 @@ public ServiceInner update(String resourceGroupName, String serviceName) { @ServiceMethod(returns = ReturnType.SINGLE) private Mono> deleteWithResponseAsync(String resourceGroupName, String serviceName) { if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (resourceGroupName == null) { return Mono @@ -956,25 +808,16 @@ private Mono> deleteWithResponseAsync(String resourceGroupName, S } final String accept = "application/json"; return FluxUtil - .withContext( - context -> - service - .delete( - this.client.getEndpoint(), - this.client.getApiVersion(), - this.client.getSubscriptionId(), - resourceGroupName, - serviceName, - accept, - context)) + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, serviceName, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * Delete service. - * + * Deletes specified service. + * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serviceName Service name. + * @param serviceName The name of Azure API Center service. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -982,19 +825,15 @@ private Mono> deleteWithResponseAsync(String resourceGroupName, S * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> deleteWithResponseAsync( - String resourceGroupName, String serviceName, Context context) { + private Mono> deleteWithResponseAsync(String resourceGroupName, String serviceName, + Context context) { if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (resourceGroupName == null) { return Mono @@ -1005,22 +844,15 @@ private Mono> deleteWithResponseAsync( } final String accept = "application/json"; context = this.client.mergeContext(context); - return service - .delete( - this.client.getEndpoint(), - this.client.getApiVersion(), - this.client.getSubscriptionId(), - resourceGroupName, - serviceName, - accept, - context); + return service.delete(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, serviceName, accept, context); } /** - * Delete service. - * + * Deletes specified service. + * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serviceName Service name. + * @param serviceName The name of Azure API Center service. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -1032,10 +864,10 @@ private Mono deleteAsync(String resourceGroupName, String serviceName) { } /** - * Delete service. - * + * Deletes specified service. + * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serviceName Service name. + * @param serviceName The name of Azure API Center service. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -1048,10 +880,10 @@ public Response deleteWithResponse(String resourceGroupName, String servic } /** - * Delete service. - * + * Deletes specified service. + * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serviceName Service name. + * @param serviceName The name of Azure API Center service. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -1061,16 +893,252 @@ public void delete(String resourceGroupName, String serviceName) { deleteWithResponse(resourceGroupName, serviceName, Context.NONE); } + /** + * Exports the effective metadata schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the metadata schema export result along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> exportMetadataSchemaWithResponseAsync(String resourceGroupName, + String serviceName, MetadataSchemaExportRequest body) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.exportMetadataSchema(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, serviceName, body, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Exports the effective metadata schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the metadata schema export result along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> exportMetadataSchemaWithResponseAsync(String resourceGroupName, + String serviceName, MetadataSchemaExportRequest body, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.exportMetadataSchema(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, serviceName, body, accept, context); + } + + /** + * Exports the effective metadata schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of the metadata schema export result. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, MetadataSchemaExportResultInner> + beginExportMetadataSchemaAsync(String resourceGroupName, String serviceName, MetadataSchemaExportRequest body) { + Mono>> mono + = exportMetadataSchemaWithResponseAsync(resourceGroupName, serviceName, body); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), MetadataSchemaExportResultInner.class, MetadataSchemaExportResultInner.class, + this.client.getContext()); + } + + /** + * Exports the effective metadata schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of the metadata schema export result. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, MetadataSchemaExportResultInner> + beginExportMetadataSchemaAsync(String resourceGroupName, String serviceName, MetadataSchemaExportRequest body, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = exportMetadataSchemaWithResponseAsync(resourceGroupName, serviceName, body, context); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), MetadataSchemaExportResultInner.class, MetadataSchemaExportResultInner.class, + context); + } + + /** + * Exports the effective metadata schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the metadata schema export result. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, MetadataSchemaExportResultInner> + beginExportMetadataSchema(String resourceGroupName, String serviceName, MetadataSchemaExportRequest body) { + return this.beginExportMetadataSchemaAsync(resourceGroupName, serviceName, body).getSyncPoller(); + } + + /** + * Exports the effective metadata schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the metadata schema export result. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, MetadataSchemaExportResultInner> + beginExportMetadataSchema(String resourceGroupName, String serviceName, MetadataSchemaExportRequest body, + Context context) { + return this.beginExportMetadataSchemaAsync(resourceGroupName, serviceName, body, context).getSyncPoller(); + } + + /** + * Exports the effective metadata schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the metadata schema export result on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono exportMetadataSchemaAsync(String resourceGroupName, + String serviceName, MetadataSchemaExportRequest body) { + return beginExportMetadataSchemaAsync(resourceGroupName, serviceName, body).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Exports the effective metadata schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the metadata schema export result on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono exportMetadataSchemaAsync(String resourceGroupName, + String serviceName, MetadataSchemaExportRequest body, Context context) { + return beginExportMetadataSchemaAsync(resourceGroupName, serviceName, body, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Exports the effective metadata schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the metadata schema export result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MetadataSchemaExportResultInner exportMetadataSchema(String resourceGroupName, String serviceName, + MetadataSchemaExportRequest body) { + return exportMetadataSchemaAsync(resourceGroupName, serviceName, body).block(); + } + + /** + * Exports the effective metadata schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the metadata schema export result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MetadataSchemaExportResultInner exportMetadataSchema(String resourceGroupName, String serviceName, + MetadataSchemaExportRequest body, Context context) { + return exportMetadataSchemaAsync(resourceGroupName, serviceName, body, context).block(); + } + /** * Get the next page of items. - * + * * @param nextLink The URL to get the next list of items - *

The nextLink parameter. + * + * The nextLink parameter. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response of a Service list operation along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listBySubscriptionNextSinglePageAsync(String nextLink) { @@ -1078,38 +1146,30 @@ private Mono> listBySubscriptionNextSinglePageAsync( return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); } if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); } final String accept = "application/json"; return FluxUtil .withContext( context -> service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) - .>map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().nextLink(), - null)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** * Get the next page of items. - * + * * @param nextLink The URL to get the next list of items - *

The nextLink parameter. + * + * The nextLink parameter. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response of a Service list operation along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listBySubscriptionNextSinglePageAsync(String nextLink, Context context) { @@ -1117,36 +1177,27 @@ private Mono> listBySubscriptionNextSinglePageAsync( return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); } if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); } final String accept = "application/json"; context = this.client.mergeContext(context); - return service - .listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context) - .map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().nextLink(), - null)); + return service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); } /** * Get the next page of items. - * + * * @param nextLink The URL to get the next list of items - *

The nextLink parameter. + * + * The nextLink parameter. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response of a Service list operation along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { @@ -1154,38 +1205,30 @@ private Mono> listByResourceGroupNextSinglePageAsync return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); } if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); } final String accept = "application/json"; return FluxUtil .withContext( context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) - .>map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().nextLink(), - null)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** * Get the next page of items. - * + * * @param nextLink The URL to get the next list of items - *

The nextLink parameter. + * + * The nextLink parameter. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response of a Service list operation along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listByResourceGroupNextSinglePageAsync(String nextLink, Context context) { @@ -1193,23 +1236,13 @@ private Mono> listByResourceGroupNextSinglePageAsync return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); } if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); } final String accept = "application/json"; context = this.client.mergeContext(context); - return service - .listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) - .map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().nextLink(), - null)); + return service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); } } diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/ServicesImpl.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/ServicesImpl.java index aca017d68b9fc..d2e0aa80a1e5e 100644 --- a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/ServicesImpl.java +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/ServicesImpl.java @@ -10,7 +10,10 @@ import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.apicenter.fluent.ServicesClient; +import com.azure.resourcemanager.apicenter.fluent.models.MetadataSchemaExportResultInner; import com.azure.resourcemanager.apicenter.fluent.models.ServiceInner; +import com.azure.resourcemanager.apicenter.models.MetadataSchemaExportRequest; +import com.azure.resourcemanager.apicenter.models.MetadataSchemaExportResult; import com.azure.resourcemanager.apicenter.models.Service; import com.azure.resourcemanager.apicenter.models.Services; @@ -21,41 +24,38 @@ public final class ServicesImpl implements Services { private final com.azure.resourcemanager.apicenter.ApiCenterManager serviceManager; - public ServicesImpl( - ServicesClient innerClient, com.azure.resourcemanager.apicenter.ApiCenterManager serviceManager) { + public ServicesImpl(ServicesClient innerClient, + com.azure.resourcemanager.apicenter.ApiCenterManager serviceManager) { this.innerClient = innerClient; this.serviceManager = serviceManager; } public PagedIterable list() { PagedIterable inner = this.serviceClient().list(); - return Utils.mapPage(inner, inner1 -> new ServiceImpl(inner1, this.manager())); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ServiceImpl(inner1, this.manager())); } public PagedIterable list(Context context) { PagedIterable inner = this.serviceClient().list(context); - return Utils.mapPage(inner, inner1 -> new ServiceImpl(inner1, this.manager())); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ServiceImpl(inner1, this.manager())); } public PagedIterable listByResourceGroup(String resourceGroupName) { PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); - return Utils.mapPage(inner, inner1 -> new ServiceImpl(inner1, this.manager())); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ServiceImpl(inner1, this.manager())); } public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); - return Utils.mapPage(inner, inner1 -> new ServiceImpl(inner1, this.manager())); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ServiceImpl(inner1, this.manager())); } - public Response getByResourceGroupWithResponse( - String resourceGroupName, String serviceName, Context context) { - Response inner = - this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, serviceName, context); + public Response getByResourceGroupWithResponse(String resourceGroupName, String serviceName, + Context context) { + Response inner + = this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, serviceName, context); if (inner != null) { - return new SimpleResponse<>( - inner.getRequest(), - inner.getStatusCode(), - inner.getHeaders(), + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), new ServiceImpl(inner.getValue(), this.manager())); } else { return null; @@ -71,8 +71,8 @@ public Service getByResourceGroup(String resourceGroupName, String serviceName) } } - public Response deleteByResourceGroupWithResponse( - String resourceGroupName, String serviceName, Context context) { + public Response deleteByResourceGroupWithResponse(String resourceGroupName, String serviceName, + Context context) { return this.serviceClient().deleteWithResponse(resourceGroupName, serviceName, context); } @@ -80,78 +80,80 @@ public void deleteByResourceGroup(String resourceGroupName, String serviceName) this.serviceClient().delete(resourceGroupName, serviceName); } + public MetadataSchemaExportResult exportMetadataSchema(String resourceGroupName, String serviceName, + MetadataSchemaExportRequest body) { + MetadataSchemaExportResultInner inner + = this.serviceClient().exportMetadataSchema(resourceGroupName, serviceName, body); + if (inner != null) { + return new MetadataSchemaExportResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public MetadataSchemaExportResult exportMetadataSchema(String resourceGroupName, String serviceName, + MetadataSchemaExportRequest body, Context context) { + MetadataSchemaExportResultInner inner + = this.serviceClient().exportMetadataSchema(resourceGroupName, serviceName, body, context); + if (inner != null) { + return new MetadataSchemaExportResultImpl(inner, this.manager()); + } else { + return null; + } + } + public Service getById(String id) { - String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); if (resourceGroupName == null) { - throw LOGGER - .logExceptionAsError( - new IllegalArgumentException( - String - .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); } - String serviceName = Utils.getValueFromIdByName(id, "services"); + String serviceName = ResourceManagerUtils.getValueFromIdByName(id, "services"); if (serviceName == null) { - throw LOGGER - .logExceptionAsError( - new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'services'.", id))); + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'services'.", id))); } return this.getByResourceGroupWithResponse(resourceGroupName, serviceName, Context.NONE).getValue(); } public Response getByIdWithResponse(String id, Context context) { - String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); if (resourceGroupName == null) { - throw LOGGER - .logExceptionAsError( - new IllegalArgumentException( - String - .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); } - String serviceName = Utils.getValueFromIdByName(id, "services"); + String serviceName = ResourceManagerUtils.getValueFromIdByName(id, "services"); if (serviceName == null) { - throw LOGGER - .logExceptionAsError( - new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'services'.", id))); + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'services'.", id))); } return this.getByResourceGroupWithResponse(resourceGroupName, serviceName, context); } public void deleteById(String id) { - String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); if (resourceGroupName == null) { - throw LOGGER - .logExceptionAsError( - new IllegalArgumentException( - String - .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); } - String serviceName = Utils.getValueFromIdByName(id, "services"); + String serviceName = ResourceManagerUtils.getValueFromIdByName(id, "services"); if (serviceName == null) { - throw LOGGER - .logExceptionAsError( - new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'services'.", id))); + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'services'.", id))); } this.deleteByResourceGroupWithResponse(resourceGroupName, serviceName, Context.NONE); } public Response deleteByIdWithResponse(String id, Context context) { - String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); if (resourceGroupName == null) { - throw LOGGER - .logExceptionAsError( - new IllegalArgumentException( - String - .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); } - String serviceName = Utils.getValueFromIdByName(id, "services"); + String serviceName = ResourceManagerUtils.getValueFromIdByName(id, "services"); if (serviceName == null) { - throw LOGGER - .logExceptionAsError( - new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'services'.", id))); + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'services'.", id))); } return this.deleteByResourceGroupWithResponse(resourceGroupName, serviceName, context); } diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/WorkspaceImpl.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/WorkspaceImpl.java new file mode 100644 index 0000000000000..e1612330c2926 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/WorkspaceImpl.java @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.apicenter.fluent.models.WorkspaceInner; +import com.azure.resourcemanager.apicenter.models.Workspace; +import com.azure.resourcemanager.apicenter.models.WorkspaceProperties; + +public final class WorkspaceImpl implements Workspace, Workspace.Definition, Workspace.Update { + private WorkspaceInner innerObject; + + private final com.azure.resourcemanager.apicenter.ApiCenterManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public WorkspaceProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public WorkspaceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.apicenter.ApiCenterManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serviceName; + + private String workspaceName; + + public WorkspaceImpl withExistingService(String resourceGroupName, String serviceName) { + this.resourceGroupName = resourceGroupName; + this.serviceName = serviceName; + return this; + } + + public Workspace create() { + this.innerObject = serviceManager.serviceClient().getWorkspaces() + .createOrUpdateWithResponse(resourceGroupName, serviceName, workspaceName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public Workspace create(Context context) { + this.innerObject = serviceManager.serviceClient().getWorkspaces() + .createOrUpdateWithResponse(resourceGroupName, serviceName, workspaceName, this.innerModel(), context) + .getValue(); + return this; + } + + WorkspaceImpl(String name, com.azure.resourcemanager.apicenter.ApiCenterManager serviceManager) { + this.innerObject = new WorkspaceInner(); + this.serviceManager = serviceManager; + this.workspaceName = name; + } + + public WorkspaceImpl update() { + return this; + } + + public Workspace apply() { + this.innerObject = serviceManager.serviceClient().getWorkspaces() + .createOrUpdateWithResponse(resourceGroupName, serviceName, workspaceName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public Workspace apply(Context context) { + this.innerObject = serviceManager.serviceClient().getWorkspaces() + .createOrUpdateWithResponse(resourceGroupName, serviceName, workspaceName, this.innerModel(), context) + .getValue(); + return this; + } + + WorkspaceImpl(WorkspaceInner innerObject, com.azure.resourcemanager.apicenter.ApiCenterManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serviceName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "services"); + this.workspaceName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "workspaces"); + } + + public Workspace refresh() { + this.innerObject = serviceManager.serviceClient().getWorkspaces() + .getWithResponse(resourceGroupName, serviceName, workspaceName, Context.NONE).getValue(); + return this; + } + + public Workspace refresh(Context context) { + this.innerObject = serviceManager.serviceClient().getWorkspaces() + .getWithResponse(resourceGroupName, serviceName, workspaceName, context).getValue(); + return this; + } + + public WorkspaceImpl withProperties(WorkspaceProperties properties) { + this.innerModel().withProperties(properties); + return this; + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/WorkspacesClientImpl.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/WorkspacesClientImpl.java new file mode 100644 index 0000000000000..c1f2bc8fbece7 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/WorkspacesClientImpl.java @@ -0,0 +1,879 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.Head; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.apicenter.fluent.WorkspacesClient; +import com.azure.resourcemanager.apicenter.fluent.models.WorkspaceInner; +import com.azure.resourcemanager.apicenter.models.WorkspaceListResult; +import com.azure.resourcemanager.apicenter.models.WorkspacesCreateOrUpdateResponse; +import com.azure.resourcemanager.apicenter.models.WorkspacesGetResponse; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in WorkspacesClient. + */ +public final class WorkspacesClientImpl implements WorkspacesClient { + /** + * The proxy service used to perform REST calls. + */ + private final WorkspacesService service; + + /** + * The service client containing this operation class. + */ + private final AzureApiCenterImpl client; + + /** + * Initializes an instance of WorkspacesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + WorkspacesClientImpl(AzureApiCenterImpl client) { + this.service + = RestProxy.create(WorkspacesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureApiCenterWorkspaces to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AzureApiCenterWorksp") + public interface WorkspacesService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("serviceName") String serviceName, + @QueryParam("$filter") String filter, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono get(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("serviceName") String serviceName, + @PathParam("workspaceName") String workspaceName, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono createOrUpdate(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("serviceName") String serviceName, + @PathParam("workspaceName") String workspaceName, @BodyParam("application/json") WorkspaceInner resource, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("serviceName") String serviceName, + @PathParam("workspaceName") String workspaceName, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Head("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> head(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("serviceName") String serviceName, + @PathParam("workspaceName") String workspaceName, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * Returns a collection of workspaces. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param filter OData filter parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Workspace list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, String serviceName, + String filter) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, serviceName, filter, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns a collection of workspaces. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param filter OData filter parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Workspace list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, String serviceName, + String filter, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, serviceName, filter, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Returns a collection of workspaces. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param filter OData filter parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Workspace list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String serviceName, String filter) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, serviceName, filter), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Returns a collection of workspaces. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Workspace list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String serviceName) { + final String filter = null; + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, serviceName, filter), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Returns a collection of workspaces. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param filter OData filter parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Workspace list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String serviceName, String filter, + Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, serviceName, filter, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Returns a collection of workspaces. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Workspace list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String serviceName) { + final String filter = null; + return new PagedIterable<>(listAsync(resourceGroupName, serviceName, filter)); + } + + /** + * Returns a collection of workspaces. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param filter OData filter parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Workspace list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String serviceName, String filter, + Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, serviceName, filter, context)); + } + + /** + * Returns details of the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workspace entity on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getWithResponseAsync(String resourceGroupName, String serviceName, + String workspaceName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, serviceName, workspaceName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns details of the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workspace entity on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getWithResponseAsync(String resourceGroupName, String serviceName, + String workspaceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, serviceName, workspaceName, accept, context); + } + + /** + * Returns details of the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workspace entity on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String serviceName, String workspaceName) { + return getWithResponseAsync(resourceGroupName, serviceName, workspaceName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Returns details of the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workspace entity. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WorkspacesGetResponse getWithResponse(String resourceGroupName, String serviceName, String workspaceName, + Context context) { + return getWithResponseAsync(resourceGroupName, serviceName, workspaceName, context).block(); + } + + /** + * Returns details of the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workspace entity. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WorkspaceInner get(String resourceGroupName, String serviceName, String workspaceName) { + return getWithResponse(resourceGroupName, serviceName, workspaceName, Context.NONE).getValue(); + } + + /** + * Creates new or updates existing workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workspace entity on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateWithResponseAsync(String resourceGroupName, + String serviceName, String workspaceName, WorkspaceInner resource) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, serviceName, workspaceName, resource, accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates new or updates existing workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workspace entity on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateWithResponseAsync(String resourceGroupName, + String serviceName, String workspaceName, WorkspaceInner resource, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, serviceName, workspaceName, resource, accept, context); + } + + /** + * Creates new or updates existing workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workspace entity on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String serviceName, String workspaceName, + WorkspaceInner resource) { + return createOrUpdateWithResponseAsync(resourceGroupName, serviceName, workspaceName, resource) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates new or updates existing workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workspace entity. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WorkspacesCreateOrUpdateResponse createOrUpdateWithResponse(String resourceGroupName, String serviceName, + String workspaceName, WorkspaceInner resource, Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, serviceName, workspaceName, resource, context) + .block(); + } + + /** + * Creates new or updates existing workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workspace entity. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WorkspaceInner createOrUpdate(String resourceGroupName, String serviceName, String workspaceName, + WorkspaceInner resource) { + return createOrUpdateWithResponse(resourceGroupName, serviceName, workspaceName, resource, Context.NONE) + .getValue(); + } + + /** + * Deletes specified workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String serviceName, + String workspaceName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, serviceName, workspaceName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes specified workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String serviceName, + String workspaceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, serviceName, workspaceName, accept, context); + } + + /** + * Deletes specified workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String serviceName, String workspaceName) { + return deleteWithResponseAsync(resourceGroupName, serviceName, workspaceName).flatMap(ignored -> Mono.empty()); + } + + /** + * Deletes specified workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String serviceName, String workspaceName, + Context context) { + return deleteWithResponseAsync(resourceGroupName, serviceName, workspaceName, context).block(); + } + + /** + * Deletes specified workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String serviceName, String workspaceName) { + deleteWithResponse(resourceGroupName, serviceName, workspaceName, Context.NONE); + } + + /** + * Checks if specified workspace exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> headWithResponseAsync(String resourceGroupName, String serviceName, + String workspaceName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.head(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, serviceName, workspaceName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Checks if specified workspace exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> headWithResponseAsync(String resourceGroupName, String serviceName, + String workspaceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.head(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, serviceName, workspaceName, accept, context); + } + + /** + * Checks if specified workspace exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono headAsync(String resourceGroupName, String serviceName, String workspaceName) { + return headWithResponseAsync(resourceGroupName, serviceName, workspaceName).flatMap(ignored -> Mono.empty()); + } + + /** + * Checks if specified workspace exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response headWithResponse(String resourceGroupName, String serviceName, String workspaceName, + Context context) { + return headWithResponseAsync(resourceGroupName, serviceName, workspaceName, context).block(); + } + + /** + * Checks if specified workspace exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void head(String resourceGroupName, String serviceName, String workspaceName) { + headWithResponse(resourceGroupName, serviceName, workspaceName, Context.NONE); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + * + * The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Workspace list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + * + * The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Workspace list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/WorkspacesImpl.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/WorkspacesImpl.java new file mode 100644 index 0000000000000..4a92ccf6faf72 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/WorkspacesImpl.java @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.apicenter.fluent.WorkspacesClient; +import com.azure.resourcemanager.apicenter.fluent.models.WorkspaceInner; +import com.azure.resourcemanager.apicenter.models.Workspace; +import com.azure.resourcemanager.apicenter.models.Workspaces; +import com.azure.resourcemanager.apicenter.models.WorkspacesGetResponse; + +public final class WorkspacesImpl implements Workspaces { + private static final ClientLogger LOGGER = new ClientLogger(WorkspacesImpl.class); + + private final WorkspacesClient innerClient; + + private final com.azure.resourcemanager.apicenter.ApiCenterManager serviceManager; + + public WorkspacesImpl(WorkspacesClient innerClient, + com.azure.resourcemanager.apicenter.ApiCenterManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String serviceName) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, serviceName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new WorkspaceImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String serviceName, String filter, Context context) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, serviceName, filter, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new WorkspaceImpl(inner1, this.manager())); + } + + public Response getWithResponse(String resourceGroupName, String serviceName, String workspaceName, + Context context) { + WorkspacesGetResponse inner + = this.serviceClient().getWithResponse(resourceGroupName, serviceName, workspaceName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new WorkspaceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Workspace get(String resourceGroupName, String serviceName, String workspaceName) { + WorkspaceInner inner = this.serviceClient().get(resourceGroupName, serviceName, workspaceName); + if (inner != null) { + return new WorkspaceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteWithResponse(String resourceGroupName, String serviceName, String workspaceName, + Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, serviceName, workspaceName, context); + } + + public void delete(String resourceGroupName, String serviceName, String workspaceName) { + this.serviceClient().delete(resourceGroupName, serviceName, workspaceName); + } + + public Response headWithResponse(String resourceGroupName, String serviceName, String workspaceName, + Context context) { + return this.serviceClient().headWithResponse(resourceGroupName, serviceName, workspaceName, context); + } + + public void head(String resourceGroupName, String serviceName, String workspaceName) { + this.serviceClient().head(resourceGroupName, serviceName, workspaceName); + } + + public Workspace getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serviceName = ResourceManagerUtils.getValueFromIdByName(id, "services"); + if (serviceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'services'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + return this.getWithResponse(resourceGroupName, serviceName, workspaceName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serviceName = ResourceManagerUtils.getValueFromIdByName(id, "services"); + if (serviceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'services'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + return this.getWithResponse(resourceGroupName, serviceName, workspaceName, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serviceName = ResourceManagerUtils.getValueFromIdByName(id, "services"); + if (serviceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'services'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + this.deleteWithResponse(resourceGroupName, serviceName, workspaceName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serviceName = ResourceManagerUtils.getValueFromIdByName(id, "services"); + if (serviceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'services'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + return this.deleteWithResponse(resourceGroupName, serviceName, workspaceName, context); + } + + private WorkspacesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.apicenter.ApiCenterManager manager() { + return this.serviceManager; + } + + public WorkspaceImpl define(String name) { + return new WorkspaceImpl(name, this.manager()); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/package-info.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/package-info.java index 55e5491fd69fc..84df9ddb71bd4 100644 --- a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/package-info.java +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/package-info.java @@ -2,5 +2,8 @@ // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. -/** Package containing the implementations for AzureApiCenter. Azure API Center Resource Provider. */ +/** + * Package containing the implementations for AzureApiCenter. + * Azure API Center Resource Provider. + */ package com.azure.resourcemanager.apicenter.implementation; diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ActionType.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ActionType.java index 46912e04d5931..7ae23553ccd87 100644 --- a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ActionType.java +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ActionType.java @@ -8,14 +8,18 @@ import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; -/** Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. */ +/** + * Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + */ public final class ActionType extends ExpandableStringEnum { - /** Static value Internal for ActionType. */ + /** + * Static value Internal for ActionType. + */ public static final ActionType INTERNAL = fromString("Internal"); /** * Creates a new instance of ActionType value. - * + * * @deprecated Use the {@link #fromString(String)} factory method. */ @Deprecated @@ -24,7 +28,7 @@ public ActionType() { /** * Creates or finds a ActionType from its string representation. - * + * * @param name a name to look for. * @return the corresponding ActionType. */ @@ -35,7 +39,7 @@ public static ActionType fromString(String name) { /** * Gets known ActionType values. - * + * * @return known ActionType values. */ public static Collection values() { diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/Api.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/Api.java new file mode 100644 index 0000000000000..f1a44efc859d4 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/Api.java @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.apicenter.fluent.models.ApiInner; + +/** + * An immutable client-side representation of Api. + */ +public interface Api { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + ApiProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.apicenter.fluent.models.ApiInner object. + * + * @return the inner object. + */ + ApiInner innerModel(); + + /** + * The entirety of the Api definition. + */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + + /** + * The Api definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the Api definition. + */ + interface Blank extends WithParentResource { + } + + /** + * The stage of the Api definition allowing to specify parent resource. + */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serviceName, workspaceName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @return the next definition stage. + */ + WithCreate withExistingWorkspace(String resourceGroupName, String serviceName, String workspaceName); + } + + /** + * The stage of the Api definition which contains all the minimum required properties for the resource to be + * created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + Api create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Api create(Context context); + } + + /** + * The stage of the Api definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + WithCreate withProperties(ApiProperties properties); + } + } + + /** + * Begins update for the Api resource. + * + * @return the stage of resource update. + */ + Api.Update update(); + + /** + * The template for Api update. + */ + interface Update { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Api apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Api apply(Context context); + } + + /** + * The Api update stages. + */ + interface UpdateStages { + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + Api refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Api refresh(Context context); +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiDefinition.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiDefinition.java new file mode 100644 index 0000000000000..228d413e42876 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiDefinition.java @@ -0,0 +1,222 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.apicenter.fluent.models.ApiDefinitionInner; + +/** + * An immutable client-side representation of ApiDefinition. + */ +public interface ApiDefinition { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + ApiDefinitionProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.apicenter.fluent.models.ApiDefinitionInner object. + * + * @return the inner object. + */ + ApiDefinitionInner innerModel(); + + /** + * The entirety of the ApiDefinition definition. + */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + + /** + * The ApiDefinition definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the ApiDefinition definition. + */ + interface Blank extends WithParentResource { + } + + /** + * The stage of the ApiDefinition definition allowing to specify parent resource. + */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serviceName, workspaceName, apiName, versionName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @return the next definition stage. + */ + WithCreate withExistingVersion(String resourceGroupName, String serviceName, String workspaceName, + String apiName, String versionName); + } + + /** + * The stage of the ApiDefinition definition which contains all the minimum required properties for the resource + * to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + ApiDefinition create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ApiDefinition create(Context context); + } + + /** + * The stage of the ApiDefinition definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + WithCreate withProperties(ApiDefinitionProperties properties); + } + } + + /** + * Begins update for the ApiDefinition resource. + * + * @return the stage of resource update. + */ + ApiDefinition.Update update(); + + /** + * The template for ApiDefinition update. + */ + interface Update { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ApiDefinition apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ApiDefinition apply(Context context); + } + + /** + * The ApiDefinition update stages. + */ + interface UpdateStages { + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ApiDefinition refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ApiDefinition refresh(Context context); + + /** + * Exports the API specification. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the API specification export result. + */ + ApiSpecExportResult exportSpecification(); + + /** + * Exports the API specification. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the API specification export result. + */ + ApiSpecExportResult exportSpecification(Context context); + + /** + * Imports the API specification. + * + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void importSpecification(ApiSpecImportRequest body); + + /** + * Imports the API specification. + * + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void importSpecification(ApiSpecImportRequest body, Context context); +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiDefinitionListResult.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiDefinitionListResult.java new file mode 100644 index 0000000000000..22f57dcbcce09 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiDefinitionListResult.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.apicenter.fluent.models.ApiDefinitionInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * The response of a ApiDefinition list operation. + */ +@Immutable +public final class ApiDefinitionListResult { + /* + * The ApiDefinition items on this page + */ + @JsonProperty(value = "value", required = true, access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * The link to the next page of items + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Creates an instance of ApiDefinitionListResult class. + */ + public ApiDefinitionListResult() { + } + + /** + * Get the value property: The ApiDefinition items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiDefinitionProperties.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiDefinitionProperties.java new file mode 100644 index 0000000000000..acac4c68b3565 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiDefinitionProperties.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * API definition properties entity. + */ +@Fluent +public final class ApiDefinitionProperties { + /* + * API definition title. + */ + @JsonProperty(value = "title", required = true) + private String title; + + /* + * API definition description. + */ + @JsonProperty(value = "description") + private String description; + + /* + * API specification details. + */ + @JsonProperty(value = "specification", access = JsonProperty.Access.WRITE_ONLY) + private ApiDefinitionPropertiesSpecification specification; + + /** + * Creates an instance of ApiDefinitionProperties class. + */ + public ApiDefinitionProperties() { + } + + /** + * Get the title property: API definition title. + * + * @return the title value. + */ + public String title() { + return this.title; + } + + /** + * Set the title property: API definition title. + * + * @param title the title value to set. + * @return the ApiDefinitionProperties object itself. + */ + public ApiDefinitionProperties withTitle(String title) { + this.title = title; + return this; + } + + /** + * Get the description property: API definition description. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: API definition description. + * + * @param description the description value to set. + * @return the ApiDefinitionProperties object itself. + */ + public ApiDefinitionProperties withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the specification property: API specification details. + * + * @return the specification value. + */ + public ApiDefinitionPropertiesSpecification specification() { + return this.specification; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (title() == null) { + throw LOGGER.logExceptionAsError( + new IllegalArgumentException("Missing required property title in model ApiDefinitionProperties")); + } + if (specification() != null) { + specification().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ApiDefinitionProperties.class); +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiDefinitionPropertiesSpecification.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiDefinitionPropertiesSpecification.java new file mode 100644 index 0000000000000..064ee1a178aac --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiDefinitionPropertiesSpecification.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * API specification details. + */ +@Fluent +public final class ApiDefinitionPropertiesSpecification { + /* + * Specification name. + */ + @JsonProperty(value = "name") + private String name; + + /* + * Specification version. + */ + @JsonProperty(value = "version") + private String version; + + /** + * Creates an instance of ApiDefinitionPropertiesSpecification class. + */ + public ApiDefinitionPropertiesSpecification() { + } + + /** + * Get the name property: Specification name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Specification name. + * + * @param name the name value to set. + * @return the ApiDefinitionPropertiesSpecification object itself. + */ + public ApiDefinitionPropertiesSpecification withName(String name) { + this.name = name; + return this; + } + + /** + * Get the version property: Specification version. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Set the version property: Specification version. + * + * @param version the version value to set. + * @return the ApiDefinitionPropertiesSpecification object itself. + */ + public ApiDefinitionPropertiesSpecification withVersion(String version) { + this.version = version; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiDefinitions.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiDefinitions.java new file mode 100644 index 0000000000000..ae4734e897c12 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiDefinitions.java @@ -0,0 +1,274 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of ApiDefinitions. + */ +public interface ApiDefinitions { + /** + * Returns a collection of API definitions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ApiDefinition list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String serviceName, String workspaceName, + String apiName, String versionName); + + /** + * Returns a collection of API definitions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param filter OData filter parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ApiDefinition list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String serviceName, String workspaceName, + String apiName, String versionName, String filter, Context context); + + /** + * Returns details of the API definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param definitionName The name of the API definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aPI definition entity. + */ + Response getWithResponse(String resourceGroupName, String serviceName, String workspaceName, + String apiName, String versionName, String definitionName, Context context); + + /** + * Returns details of the API definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param definitionName The name of the API definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aPI definition entity. + */ + ApiDefinition get(String resourceGroupName, String serviceName, String workspaceName, String apiName, + String versionName, String definitionName); + + /** + * Deletes specified API definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param definitionName The name of the API definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteWithResponse(String resourceGroupName, String serviceName, String workspaceName, + String apiName, String versionName, String definitionName, Context context); + + /** + * Deletes specified API definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param definitionName The name of the API definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String serviceName, String workspaceName, String apiName, String versionName, + String definitionName); + + /** + * Checks if specified API definition exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param definitionName The name of the API definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response headWithResponse(String resourceGroupName, String serviceName, String workspaceName, String apiName, + String versionName, String definitionName, Context context); + + /** + * Checks if specified API definition exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param definitionName The name of the API definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void head(String resourceGroupName, String serviceName, String workspaceName, String apiName, String versionName, + String definitionName); + + /** + * Exports the API specification. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param definitionName The name of the API definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the API specification export result. + */ + ApiSpecExportResult exportSpecification(String resourceGroupName, String serviceName, String workspaceName, + String apiName, String versionName, String definitionName); + + /** + * Exports the API specification. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param definitionName The name of the API definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the API specification export result. + */ + ApiSpecExportResult exportSpecification(String resourceGroupName, String serviceName, String workspaceName, + String apiName, String versionName, String definitionName, Context context); + + /** + * Imports the API specification. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param definitionName The name of the API definition. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void importSpecification(String resourceGroupName, String serviceName, String workspaceName, String apiName, + String versionName, String definitionName, ApiSpecImportRequest body); + + /** + * Imports the API specification. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param definitionName The name of the API definition. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void importSpecification(String resourceGroupName, String serviceName, String workspaceName, String apiName, + String versionName, String definitionName, ApiSpecImportRequest body, Context context); + + /** + * Returns details of the API definition. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aPI definition entity. + */ + ApiDefinition getById(String id); + + /** + * Returns details of the API definition. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aPI definition entity. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes specified API definition. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes specified API definition. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ApiDefinition resource. + * + * @param name resource name. + * @return the first stage of the new ApiDefinition definition. + */ + ApiDefinition.DefinitionStages.Blank define(String name); +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiDefinitionsCreateOrUpdateHeaders.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiDefinitionsCreateOrUpdateHeaders.java new file mode 100644 index 0000000000000..14dbc78dc27d5 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiDefinitionsCreateOrUpdateHeaders.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.HttpHeaders; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The ApiDefinitionsCreateOrUpdateHeaders model. + */ +@Fluent +public final class ApiDefinitionsCreateOrUpdateHeaders { + /* + * The Etag property. + */ + @JsonProperty(value = "Etag") + private String etag; + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of ApiDefinitionsCreateOrUpdateHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public ApiDefinitionsCreateOrUpdateHeaders(HttpHeaders rawHeaders) { + this.etag = rawHeaders.getValue(HttpHeaderName.ETAG); + } + + /** + * Get the etag property: The Etag property. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** + * Set the etag property: The Etag property. + * + * @param etag the etag value to set. + * @return the ApiDefinitionsCreateOrUpdateHeaders object itself. + */ + public ApiDefinitionsCreateOrUpdateHeaders withEtag(String etag) { + this.etag = etag; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiDefinitionsCreateOrUpdateResponse.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiDefinitionsCreateOrUpdateResponse.java new file mode 100644 index 0000000000000..15acc9f49ad6c --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiDefinitionsCreateOrUpdateResponse.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; +import com.azure.resourcemanager.apicenter.fluent.models.ApiDefinitionInner; + +/** + * Contains all response data for the createOrUpdate operation. + */ +public final class ApiDefinitionsCreateOrUpdateResponse + extends ResponseBase { + /** + * Creates an instance of ApiDefinitionsCreateOrUpdateResponse. + * + * @param request the request which resulted in this ApiDefinitionsCreateOrUpdateResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public ApiDefinitionsCreateOrUpdateResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, + ApiDefinitionInner value, ApiDefinitionsCreateOrUpdateHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } + + /** + * Gets the deserialized response body. + * + * @return the deserialized response body. + */ + @Override + public ApiDefinitionInner getValue() { + return super.getValue(); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiDefinitionsGetHeaders.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiDefinitionsGetHeaders.java new file mode 100644 index 0000000000000..4077c1eb79f63 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiDefinitionsGetHeaders.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.HttpHeaders; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The ApiDefinitionsGetHeaders model. + */ +@Fluent +public final class ApiDefinitionsGetHeaders { + /* + * The Etag property. + */ + @JsonProperty(value = "Etag") + private String etag; + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of ApiDefinitionsGetHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public ApiDefinitionsGetHeaders(HttpHeaders rawHeaders) { + this.etag = rawHeaders.getValue(HttpHeaderName.ETAG); + } + + /** + * Get the etag property: The Etag property. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** + * Set the etag property: The Etag property. + * + * @param etag the etag value to set. + * @return the ApiDefinitionsGetHeaders object itself. + */ + public ApiDefinitionsGetHeaders withEtag(String etag) { + this.etag = etag; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiDefinitionsGetResponse.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiDefinitionsGetResponse.java new file mode 100644 index 0000000000000..9ca830198021d --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiDefinitionsGetResponse.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; +import com.azure.resourcemanager.apicenter.fluent.models.ApiDefinitionInner; + +/** + * Contains all response data for the get operation. + */ +public final class ApiDefinitionsGetResponse extends ResponseBase { + /** + * Creates an instance of ApiDefinitionsGetResponse. + * + * @param request the request which resulted in this ApiDefinitionsGetResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public ApiDefinitionsGetResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, + ApiDefinitionInner value, ApiDefinitionsGetHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } + + /** + * Gets the deserialized response body. + * + * @return the deserialized response body. + */ + @Override + public ApiDefinitionInner getValue() { + return super.getValue(); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiKind.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiKind.java new file mode 100644 index 0000000000000..eef5a74ba0b95 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiKind.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * The kind of the API. + */ +public final class ApiKind extends ExpandableStringEnum { + /** + * Static value rest for ApiKind. + */ + public static final ApiKind REST = fromString("rest"); + + /** + * Static value graphql for ApiKind. + */ + public static final ApiKind GRAPHQL = fromString("graphql"); + + /** + * Static value grpc for ApiKind. + */ + public static final ApiKind GRPC = fromString("grpc"); + + /** + * Static value soap for ApiKind. + */ + public static final ApiKind SOAP = fromString("soap"); + + /** + * Static value webhook for ApiKind. + */ + public static final ApiKind WEBHOOK = fromString("webhook"); + + /** + * Static value websocket for ApiKind. + */ + public static final ApiKind WEBSOCKET = fromString("websocket"); + + /** + * Creates a new instance of ApiKind value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ApiKind() { + } + + /** + * Creates or finds a ApiKind from its string representation. + * + * @param name a name to look for. + * @return the corresponding ApiKind. + */ + @JsonCreator + public static ApiKind fromString(String name) { + return fromString(name, ApiKind.class); + } + + /** + * Gets known ApiKind values. + * + * @return known ApiKind values. + */ + public static Collection values() { + return values(ApiKind.class); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiListResult.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiListResult.java new file mode 100644 index 0000000000000..b1f326f1bbb52 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiListResult.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.apicenter.fluent.models.ApiInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * The response of a Api list operation. + */ +@Immutable +public final class ApiListResult { + /* + * The Api items on this page + */ + @JsonProperty(value = "value", required = true, access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * The link to the next page of items + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Creates an instance of ApiListResult class. + */ + public ApiListResult() { + } + + /** + * Get the value property: The Api items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiProperties.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiProperties.java new file mode 100644 index 0000000000000..daaed68900cf1 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiProperties.java @@ -0,0 +1,301 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * API properties. + */ +@Fluent +public final class ApiProperties { + /* + * API title. + */ + @JsonProperty(value = "title", required = true) + private String title; + + /* + * Kind of API. For example, REST or GraphQL. + */ + @JsonProperty(value = "kind", required = true) + private ApiKind kind; + + /* + * Description of the API. + */ + @JsonProperty(value = "description") + private String description; + + /* + * Short description of the API. + */ + @JsonProperty(value = "summary") + private String summary; + + /* + * Current lifecycle stage of the API. + */ + @JsonProperty(value = "lifecycleStage", access = JsonProperty.Access.WRITE_ONLY) + private LifecycleStage lifecycleStage; + + /* + * Terms of service for the API. + */ + @JsonProperty(value = "termsOfService") + private TermsOfService termsOfService; + + /* + * The set of external documentation + */ + @JsonProperty(value = "externalDocumentation") + private List externalDocumentation; + + /* + * The set of contacts + */ + @JsonProperty(value = "contacts") + private List contacts; + + /* + * The license information for the API. + */ + @JsonProperty(value = "license") + private License license; + + /* + * The custom metadata defined for API catalog entities. + */ + @JsonProperty(value = "customProperties") + private Object customProperties; + + /** + * Creates an instance of ApiProperties class. + */ + public ApiProperties() { + } + + /** + * Get the title property: API title. + * + * @return the title value. + */ + public String title() { + return this.title; + } + + /** + * Set the title property: API title. + * + * @param title the title value to set. + * @return the ApiProperties object itself. + */ + public ApiProperties withTitle(String title) { + this.title = title; + return this; + } + + /** + * Get the kind property: Kind of API. For example, REST or GraphQL. + * + * @return the kind value. + */ + public ApiKind kind() { + return this.kind; + } + + /** + * Set the kind property: Kind of API. For example, REST or GraphQL. + * + * @param kind the kind value to set. + * @return the ApiProperties object itself. + */ + public ApiProperties withKind(ApiKind kind) { + this.kind = kind; + return this; + } + + /** + * Get the description property: Description of the API. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Description of the API. + * + * @param description the description value to set. + * @return the ApiProperties object itself. + */ + public ApiProperties withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the summary property: Short description of the API. + * + * @return the summary value. + */ + public String summary() { + return this.summary; + } + + /** + * Set the summary property: Short description of the API. + * + * @param summary the summary value to set. + * @return the ApiProperties object itself. + */ + public ApiProperties withSummary(String summary) { + this.summary = summary; + return this; + } + + /** + * Get the lifecycleStage property: Current lifecycle stage of the API. + * + * @return the lifecycleStage value. + */ + public LifecycleStage lifecycleStage() { + return this.lifecycleStage; + } + + /** + * Get the termsOfService property: Terms of service for the API. + * + * @return the termsOfService value. + */ + public TermsOfService termsOfService() { + return this.termsOfService; + } + + /** + * Set the termsOfService property: Terms of service for the API. + * + * @param termsOfService the termsOfService value to set. + * @return the ApiProperties object itself. + */ + public ApiProperties withTermsOfService(TermsOfService termsOfService) { + this.termsOfService = termsOfService; + return this; + } + + /** + * Get the externalDocumentation property: The set of external documentation. + * + * @return the externalDocumentation value. + */ + public List externalDocumentation() { + return this.externalDocumentation; + } + + /** + * Set the externalDocumentation property: The set of external documentation. + * + * @param externalDocumentation the externalDocumentation value to set. + * @return the ApiProperties object itself. + */ + public ApiProperties withExternalDocumentation(List externalDocumentation) { + this.externalDocumentation = externalDocumentation; + return this; + } + + /** + * Get the contacts property: The set of contacts. + * + * @return the contacts value. + */ + public List contacts() { + return this.contacts; + } + + /** + * Set the contacts property: The set of contacts. + * + * @param contacts the contacts value to set. + * @return the ApiProperties object itself. + */ + public ApiProperties withContacts(List contacts) { + this.contacts = contacts; + return this; + } + + /** + * Get the license property: The license information for the API. + * + * @return the license value. + */ + public License license() { + return this.license; + } + + /** + * Set the license property: The license information for the API. + * + * @param license the license value to set. + * @return the ApiProperties object itself. + */ + public ApiProperties withLicense(License license) { + this.license = license; + return this; + } + + /** + * Get the customProperties property: The custom metadata defined for API catalog entities. + * + * @return the customProperties value. + */ + public Object customProperties() { + return this.customProperties; + } + + /** + * Set the customProperties property: The custom metadata defined for API catalog entities. + * + * @param customProperties the customProperties value to set. + * @return the ApiProperties object itself. + */ + public ApiProperties withCustomProperties(Object customProperties) { + this.customProperties = customProperties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (title() == null) { + throw LOGGER.logExceptionAsError( + new IllegalArgumentException("Missing required property title in model ApiProperties")); + } + if (kind() == null) { + throw LOGGER.logExceptionAsError( + new IllegalArgumentException("Missing required property kind in model ApiProperties")); + } + if (termsOfService() != null) { + termsOfService().validate(); + } + if (externalDocumentation() != null) { + externalDocumentation().forEach(e -> e.validate()); + } + if (contacts() != null) { + contacts().forEach(e -> e.validate()); + } + if (license() != null) { + license().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ApiProperties.class); +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiSpecExportResult.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiSpecExportResult.java new file mode 100644 index 0000000000000..ffc5f35c5ec31 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiSpecExportResult.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.models; + +import com.azure.resourcemanager.apicenter.fluent.models.ApiSpecExportResultInner; + +/** + * An immutable client-side representation of ApiSpecExportResult. + */ +public interface ApiSpecExportResult { + /** + * Gets the format property: The format of exported result. + * + * @return the format value. + */ + ApiSpecExportResultFormat format(); + + /** + * Gets the value property: The result of the export operation. + * + * @return the value value. + */ + String value(); + + /** + * Gets the inner com.azure.resourcemanager.apicenter.fluent.models.ApiSpecExportResultInner object. + * + * @return the inner object. + */ + ApiSpecExportResultInner innerModel(); +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiSpecExportResultFormat.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiSpecExportResultFormat.java new file mode 100644 index 0000000000000..7a7208d39c344 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiSpecExportResultFormat.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * Result format for exported Api spec. + */ +public final class ApiSpecExportResultFormat extends ExpandableStringEnum { + /** + * Static value inline for ApiSpecExportResultFormat. + */ + public static final ApiSpecExportResultFormat INLINE = fromString("inline"); + + /** + * Static value link for ApiSpecExportResultFormat. + */ + public static final ApiSpecExportResultFormat LINK = fromString("link"); + + /** + * Creates a new instance of ApiSpecExportResultFormat value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ApiSpecExportResultFormat() { + } + + /** + * Creates or finds a ApiSpecExportResultFormat from its string representation. + * + * @param name a name to look for. + * @return the corresponding ApiSpecExportResultFormat. + */ + @JsonCreator + public static ApiSpecExportResultFormat fromString(String name) { + return fromString(name, ApiSpecExportResultFormat.class); + } + + /** + * Gets known ApiSpecExportResultFormat values. + * + * @return known ApiSpecExportResultFormat values. + */ + public static Collection values() { + return values(ApiSpecExportResultFormat.class); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiSpecImportRequest.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiSpecImportRequest.java new file mode 100644 index 0000000000000..ef904cc04e61b --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiSpecImportRequest.java @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The API specification source entity properties. + */ +@Fluent +public final class ApiSpecImportRequest { + /* + * Value of the API specification source. + */ + @JsonProperty(value = "value") + private String value; + + /* + * Format of the API specification source. + */ + @JsonProperty(value = "format") + private ApiSpecImportSourceFormat format; + + /* + * API specification details. + */ + @JsonProperty(value = "specification") + private ApiSpecImportRequestSpecification specification; + + /** + * Creates an instance of ApiSpecImportRequest class. + */ + public ApiSpecImportRequest() { + } + + /** + * Get the value property: Value of the API specification source. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Set the value property: Value of the API specification source. + * + * @param value the value value to set. + * @return the ApiSpecImportRequest object itself. + */ + public ApiSpecImportRequest withValue(String value) { + this.value = value; + return this; + } + + /** + * Get the format property: Format of the API specification source. + * + * @return the format value. + */ + public ApiSpecImportSourceFormat format() { + return this.format; + } + + /** + * Set the format property: Format of the API specification source. + * + * @param format the format value to set. + * @return the ApiSpecImportRequest object itself. + */ + public ApiSpecImportRequest withFormat(ApiSpecImportSourceFormat format) { + this.format = format; + return this; + } + + /** + * Get the specification property: API specification details. + * + * @return the specification value. + */ + public ApiSpecImportRequestSpecification specification() { + return this.specification; + } + + /** + * Set the specification property: API specification details. + * + * @param specification the specification value to set. + * @return the ApiSpecImportRequest object itself. + */ + public ApiSpecImportRequest withSpecification(ApiSpecImportRequestSpecification specification) { + this.specification = specification; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (specification() != null) { + specification().validate(); + } + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiSpecImportRequestSpecification.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiSpecImportRequestSpecification.java new file mode 100644 index 0000000000000..5b03e4d943f73 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiSpecImportRequestSpecification.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * API specification details. + */ +@Fluent +public final class ApiSpecImportRequestSpecification { + /* + * Specification name. + */ + @JsonProperty(value = "name") + private String name; + + /* + * Specification version. + */ + @JsonProperty(value = "version") + private String version; + + /** + * Creates an instance of ApiSpecImportRequestSpecification class. + */ + public ApiSpecImportRequestSpecification() { + } + + /** + * Get the name property: Specification name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Specification name. + * + * @param name the name value to set. + * @return the ApiSpecImportRequestSpecification object itself. + */ + public ApiSpecImportRequestSpecification withName(String name) { + this.name = name; + return this; + } + + /** + * Get the version property: Specification version. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Set the version property: Specification version. + * + * @param version the version value to set. + * @return the ApiSpecImportRequestSpecification object itself. + */ + public ApiSpecImportRequestSpecification withVersion(String version) { + this.version = version; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiSpecImportSourceFormat.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiSpecImportSourceFormat.java new file mode 100644 index 0000000000000..60c9e93b0068d --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiSpecImportSourceFormat.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * Source format for imported Api spec. + */ +public final class ApiSpecImportSourceFormat extends ExpandableStringEnum { + /** + * Static value inline for ApiSpecImportSourceFormat. + */ + public static final ApiSpecImportSourceFormat INLINE = fromString("inline"); + + /** + * Static value link for ApiSpecImportSourceFormat. + */ + public static final ApiSpecImportSourceFormat LINK = fromString("link"); + + /** + * Creates a new instance of ApiSpecImportSourceFormat value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ApiSpecImportSourceFormat() { + } + + /** + * Creates or finds a ApiSpecImportSourceFormat from its string representation. + * + * @param name a name to look for. + * @return the corresponding ApiSpecImportSourceFormat. + */ + @JsonCreator + public static ApiSpecImportSourceFormat fromString(String name) { + return fromString(name, ApiSpecImportSourceFormat.class); + } + + /** + * Gets known ApiSpecImportSourceFormat values. + * + * @return known ApiSpecImportSourceFormat values. + */ + public static Collection values() { + return values(ApiSpecImportSourceFormat.class); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiVersion.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiVersion.java new file mode 100644 index 0000000000000..83874890a2513 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiVersion.java @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.apicenter.fluent.models.ApiVersionInner; + +/** + * An immutable client-side representation of ApiVersion. + */ +public interface ApiVersion { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + ApiVersionProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.apicenter.fluent.models.ApiVersionInner object. + * + * @return the inner object. + */ + ApiVersionInner innerModel(); + + /** + * The entirety of the ApiVersion definition. + */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + + /** + * The ApiVersion definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the ApiVersion definition. + */ + interface Blank extends WithParentResource { + } + + /** + * The stage of the ApiVersion definition allowing to specify parent resource. + */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serviceName, workspaceName, apiName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @return the next definition stage. + */ + WithCreate withExistingApi(String resourceGroupName, String serviceName, String workspaceName, + String apiName); + } + + /** + * The stage of the ApiVersion definition which contains all the minimum required properties for the resource to + * be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + ApiVersion create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ApiVersion create(Context context); + } + + /** + * The stage of the ApiVersion definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + WithCreate withProperties(ApiVersionProperties properties); + } + } + + /** + * Begins update for the ApiVersion resource. + * + * @return the stage of resource update. + */ + ApiVersion.Update update(); + + /** + * The template for ApiVersion update. + */ + interface Update { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ApiVersion apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ApiVersion apply(Context context); + } + + /** + * The ApiVersion update stages. + */ + interface UpdateStages { + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ApiVersion refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ApiVersion refresh(Context context); +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiVersionListResult.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiVersionListResult.java new file mode 100644 index 0000000000000..4554dde528efc --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiVersionListResult.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.apicenter.fluent.models.ApiVersionInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * The response of a ApiVersion list operation. + */ +@Immutable +public final class ApiVersionListResult { + /* + * The ApiVersion items on this page + */ + @JsonProperty(value = "value", required = true, access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * The link to the next page of items + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Creates an instance of ApiVersionListResult class. + */ + public ApiVersionListResult() { + } + + /** + * Get the value property: The ApiVersion items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiVersionProperties.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiVersionProperties.java new file mode 100644 index 0000000000000..883e3384130aa --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiVersionProperties.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * API version properties entity. + */ +@Fluent +public final class ApiVersionProperties { + /* + * API version title. + */ + @JsonProperty(value = "title", required = true) + private String title; + + /* + * Current lifecycle stage of the API. + */ + @JsonProperty(value = "lifecycleStage", required = true) + private LifecycleStage lifecycleStage; + + /** + * Creates an instance of ApiVersionProperties class. + */ + public ApiVersionProperties() { + } + + /** + * Get the title property: API version title. + * + * @return the title value. + */ + public String title() { + return this.title; + } + + /** + * Set the title property: API version title. + * + * @param title the title value to set. + * @return the ApiVersionProperties object itself. + */ + public ApiVersionProperties withTitle(String title) { + this.title = title; + return this; + } + + /** + * Get the lifecycleStage property: Current lifecycle stage of the API. + * + * @return the lifecycleStage value. + */ + public LifecycleStage lifecycleStage() { + return this.lifecycleStage; + } + + /** + * Set the lifecycleStage property: Current lifecycle stage of the API. + * + * @param lifecycleStage the lifecycleStage value to set. + * @return the ApiVersionProperties object itself. + */ + public ApiVersionProperties withLifecycleStage(LifecycleStage lifecycleStage) { + this.lifecycleStage = lifecycleStage; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (title() == null) { + throw LOGGER.logExceptionAsError( + new IllegalArgumentException("Missing required property title in model ApiVersionProperties")); + } + if (lifecycleStage() == null) { + throw LOGGER.logExceptionAsError( + new IllegalArgumentException("Missing required property lifecycleStage in model ApiVersionProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ApiVersionProperties.class); +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiVersions.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiVersions.java new file mode 100644 index 0000000000000..d4d447e5e8218 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiVersions.java @@ -0,0 +1,193 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of ApiVersions. + */ +public interface ApiVersions { + /** + * Returns a collection of API versions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ApiVersion list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String serviceName, String workspaceName, String apiName); + + /** + * Returns a collection of API versions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param filter OData filter parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ApiVersion list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String serviceName, String workspaceName, String apiName, + String filter, Context context); + + /** + * Returns details of the API version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aPI version entity. + */ + Response getWithResponse(String resourceGroupName, String serviceName, String workspaceName, + String apiName, String versionName, Context context); + + /** + * Returns details of the API version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aPI version entity. + */ + ApiVersion get(String resourceGroupName, String serviceName, String workspaceName, String apiName, + String versionName); + + /** + * Deletes specified API version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteWithResponse(String resourceGroupName, String serviceName, String workspaceName, + String apiName, String versionName, Context context); + + /** + * Deletes specified API version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String serviceName, String workspaceName, String apiName, String versionName); + + /** + * Checks if specified API version exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response headWithResponse(String resourceGroupName, String serviceName, String workspaceName, String apiName, + String versionName, Context context); + + /** + * Checks if specified API version exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void head(String resourceGroupName, String serviceName, String workspaceName, String apiName, String versionName); + + /** + * Returns details of the API version. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aPI version entity. + */ + ApiVersion getById(String id); + + /** + * Returns details of the API version. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aPI version entity. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes specified API version. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes specified API version. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ApiVersion resource. + * + * @param name resource name. + * @return the first stage of the new ApiVersion definition. + */ + ApiVersion.DefinitionStages.Blank define(String name); +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiVersionsCreateOrUpdateHeaders.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiVersionsCreateOrUpdateHeaders.java new file mode 100644 index 0000000000000..cf1754a33ccc5 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiVersionsCreateOrUpdateHeaders.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.HttpHeaders; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The ApiVersionsCreateOrUpdateHeaders model. + */ +@Fluent +public final class ApiVersionsCreateOrUpdateHeaders { + /* + * The Etag property. + */ + @JsonProperty(value = "Etag") + private String etag; + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of ApiVersionsCreateOrUpdateHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public ApiVersionsCreateOrUpdateHeaders(HttpHeaders rawHeaders) { + this.etag = rawHeaders.getValue(HttpHeaderName.ETAG); + } + + /** + * Get the etag property: The Etag property. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** + * Set the etag property: The Etag property. + * + * @param etag the etag value to set. + * @return the ApiVersionsCreateOrUpdateHeaders object itself. + */ + public ApiVersionsCreateOrUpdateHeaders withEtag(String etag) { + this.etag = etag; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiVersionsCreateOrUpdateResponse.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiVersionsCreateOrUpdateResponse.java new file mode 100644 index 0000000000000..6933168391fee --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiVersionsCreateOrUpdateResponse.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; +import com.azure.resourcemanager.apicenter.fluent.models.ApiVersionInner; + +/** + * Contains all response data for the createOrUpdate operation. + */ +public final class ApiVersionsCreateOrUpdateResponse + extends ResponseBase { + /** + * Creates an instance of ApiVersionsCreateOrUpdateResponse. + * + * @param request the request which resulted in this ApiVersionsCreateOrUpdateResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public ApiVersionsCreateOrUpdateResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, + ApiVersionInner value, ApiVersionsCreateOrUpdateHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } + + /** + * Gets the deserialized response body. + * + * @return the deserialized response body. + */ + @Override + public ApiVersionInner getValue() { + return super.getValue(); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiVersionsGetHeaders.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiVersionsGetHeaders.java new file mode 100644 index 0000000000000..d82ace1941307 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiVersionsGetHeaders.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.HttpHeaders; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The ApiVersionsGetHeaders model. + */ +@Fluent +public final class ApiVersionsGetHeaders { + /* + * The Etag property. + */ + @JsonProperty(value = "Etag") + private String etag; + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of ApiVersionsGetHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public ApiVersionsGetHeaders(HttpHeaders rawHeaders) { + this.etag = rawHeaders.getValue(HttpHeaderName.ETAG); + } + + /** + * Get the etag property: The Etag property. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** + * Set the etag property: The Etag property. + * + * @param etag the etag value to set. + * @return the ApiVersionsGetHeaders object itself. + */ + public ApiVersionsGetHeaders withEtag(String etag) { + this.etag = etag; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiVersionsGetResponse.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiVersionsGetResponse.java new file mode 100644 index 0000000000000..6f0a418a60beb --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiVersionsGetResponse.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; +import com.azure.resourcemanager.apicenter.fluent.models.ApiVersionInner; + +/** + * Contains all response data for the get operation. + */ +public final class ApiVersionsGetResponse extends ResponseBase { + /** + * Creates an instance of ApiVersionsGetResponse. + * + * @param request the request which resulted in this ApiVersionsGetResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public ApiVersionsGetResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, ApiVersionInner value, + ApiVersionsGetHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } + + /** + * Gets the deserialized response body. + * + * @return the deserialized response body. + */ + @Override + public ApiVersionInner getValue() { + return super.getValue(); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/Apis.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/Apis.java new file mode 100644 index 0000000000000..69badbb15006a --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/Apis.java @@ -0,0 +1,184 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of Apis. + */ +public interface Apis { + /** + * Returns a collection of APIs. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Api list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String serviceName, String workspaceName); + + /** + * Returns a collection of APIs. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param filter OData filter parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Api list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String serviceName, String workspaceName, String filter, + Context context); + + /** + * Returns details of the API. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aPI entity. + */ + Response getWithResponse(String resourceGroupName, String serviceName, String workspaceName, String apiName, + Context context); + + /** + * Returns details of the API. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aPI entity. + */ + Api get(String resourceGroupName, String serviceName, String workspaceName, String apiName); + + /** + * Deletes specified API. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteWithResponse(String resourceGroupName, String serviceName, String workspaceName, + String apiName, Context context); + + /** + * Deletes specified API. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String serviceName, String workspaceName, String apiName); + + /** + * Checks if specified API exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response headWithResponse(String resourceGroupName, String serviceName, String workspaceName, String apiName, + Context context); + + /** + * Checks if specified API exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void head(String resourceGroupName, String serviceName, String workspaceName, String apiName); + + /** + * Returns details of the API. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aPI entity. + */ + Api getById(String id); + + /** + * Returns details of the API. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aPI entity. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes specified API. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes specified API. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new Api resource. + * + * @param name resource name. + * @return the first stage of the new Api definition. + */ + Api.DefinitionStages.Blank define(String name); +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApisCreateOrUpdateHeaders.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApisCreateOrUpdateHeaders.java new file mode 100644 index 0000000000000..2c09627d1b3a0 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApisCreateOrUpdateHeaders.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.HttpHeaders; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The ApisCreateOrUpdateHeaders model. + */ +@Fluent +public final class ApisCreateOrUpdateHeaders { + /* + * The Etag property. + */ + @JsonProperty(value = "Etag") + private String etag; + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of ApisCreateOrUpdateHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public ApisCreateOrUpdateHeaders(HttpHeaders rawHeaders) { + this.etag = rawHeaders.getValue(HttpHeaderName.ETAG); + } + + /** + * Get the etag property: The Etag property. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** + * Set the etag property: The Etag property. + * + * @param etag the etag value to set. + * @return the ApisCreateOrUpdateHeaders object itself. + */ + public ApisCreateOrUpdateHeaders withEtag(String etag) { + this.etag = etag; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApisCreateOrUpdateResponse.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApisCreateOrUpdateResponse.java new file mode 100644 index 0000000000000..43392787c1c34 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApisCreateOrUpdateResponse.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; +import com.azure.resourcemanager.apicenter.fluent.models.ApiInner; + +/** + * Contains all response data for the createOrUpdate operation. + */ +public final class ApisCreateOrUpdateResponse extends ResponseBase { + /** + * Creates an instance of ApisCreateOrUpdateResponse. + * + * @param request the request which resulted in this ApisCreateOrUpdateResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public ApisCreateOrUpdateResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, ApiInner value, + ApisCreateOrUpdateHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } + + /** + * Gets the deserialized response body. + * + * @return the deserialized response body. + */ + @Override + public ApiInner getValue() { + return super.getValue(); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApisGetHeaders.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApisGetHeaders.java new file mode 100644 index 0000000000000..fb0c34ae86e42 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApisGetHeaders.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.HttpHeaders; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The ApisGetHeaders model. + */ +@Fluent +public final class ApisGetHeaders { + /* + * The Etag property. + */ + @JsonProperty(value = "Etag") + private String etag; + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of ApisGetHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public ApisGetHeaders(HttpHeaders rawHeaders) { + this.etag = rawHeaders.getValue(HttpHeaderName.ETAG); + } + + /** + * Get the etag property: The Etag property. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** + * Set the etag property: The Etag property. + * + * @param etag the etag value to set. + * @return the ApisGetHeaders object itself. + */ + public ApisGetHeaders withEtag(String etag) { + this.etag = etag; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApisGetResponse.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApisGetResponse.java new file mode 100644 index 0000000000000..bf5c5e81a84d0 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApisGetResponse.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; +import com.azure.resourcemanager.apicenter.fluent.models.ApiInner; + +/** + * Contains all response data for the get operation. + */ +public final class ApisGetResponse extends ResponseBase { + /** + * Creates an instance of ApisGetResponse. + * + * @param request the request which resulted in this ApisGetResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public ApisGetResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, ApiInner value, + ApisGetHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } + + /** + * Gets the deserialized response body. + * + * @return the deserialized response body. + */ + @Override + public ApiInner getValue() { + return super.getValue(); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/Contact.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/Contact.java new file mode 100644 index 0000000000000..cf83e41327a84 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/Contact.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Contact information. + */ +@Fluent +public final class Contact { + /* + * Name of the contact. + */ + @JsonProperty(value = "name") + private String name; + + /* + * URL for the contact. + */ + @JsonProperty(value = "url") + private String url; + + /* + * Email address of the contact. + */ + @JsonProperty(value = "email") + private String email; + + /** + * Creates an instance of Contact class. + */ + public Contact() { + } + + /** + * Get the name property: Name of the contact. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name of the contact. + * + * @param name the name value to set. + * @return the Contact object itself. + */ + public Contact withName(String name) { + this.name = name; + return this; + } + + /** + * Get the url property: URL for the contact. + * + * @return the url value. + */ + public String url() { + return this.url; + } + + /** + * Set the url property: URL for the contact. + * + * @param url the url value to set. + * @return the Contact object itself. + */ + public Contact withUrl(String url) { + this.url = url; + return this; + } + + /** + * Get the email property: Email address of the contact. + * + * @return the email value. + */ + public String email() { + return this.email; + } + + /** + * Set the email property: Email address of the contact. + * + * @param email the email value to set. + * @return the Contact object itself. + */ + public Contact withEmail(String email) { + this.email = email; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/Deployment.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/Deployment.java new file mode 100644 index 0000000000000..fba5260e3728f --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/Deployment.java @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.apicenter.fluent.models.DeploymentInner; + +/** + * An immutable client-side representation of Deployment. + */ +public interface Deployment { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + DeploymentProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.apicenter.fluent.models.DeploymentInner object. + * + * @return the inner object. + */ + DeploymentInner innerModel(); + + /** + * The entirety of the Deployment definition. + */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + + /** + * The Deployment definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the Deployment definition. + */ + interface Blank extends WithParentResource { + } + + /** + * The stage of the Deployment definition allowing to specify parent resource. + */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serviceName, workspaceName, apiName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @return the next definition stage. + */ + WithCreate withExistingApi(String resourceGroupName, String serviceName, String workspaceName, + String apiName); + } + + /** + * The stage of the Deployment definition which contains all the minimum required properties for the resource to + * be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + Deployment create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Deployment create(Context context); + } + + /** + * The stage of the Deployment definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + WithCreate withProperties(DeploymentProperties properties); + } + } + + /** + * Begins update for the Deployment resource. + * + * @return the stage of resource update. + */ + Deployment.Update update(); + + /** + * The template for Deployment update. + */ + interface Update { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Deployment apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Deployment apply(Context context); + } + + /** + * The Deployment update stages. + */ + interface UpdateStages { + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + Deployment refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Deployment refresh(Context context); +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/DeploymentListResult.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/DeploymentListResult.java new file mode 100644 index 0000000000000..6676f1f5a9b69 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/DeploymentListResult.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.apicenter.fluent.models.DeploymentInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * The response of a Deployment list operation. + */ +@Immutable +public final class DeploymentListResult { + /* + * The Deployment items on this page + */ + @JsonProperty(value = "value", required = true, access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * The link to the next page of items + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Creates an instance of DeploymentListResult class. + */ + public DeploymentListResult() { + } + + /** + * Get the value property: The Deployment items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/DeploymentProperties.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/DeploymentProperties.java new file mode 100644 index 0000000000000..85b9126dce0d1 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/DeploymentProperties.java @@ -0,0 +1,213 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * API deployment entity properties. + */ +@Fluent +public final class DeploymentProperties { + /* + * API deployment title + */ + @JsonProperty(value = "title") + private String title; + + /* + * Description of the deployment. + */ + @JsonProperty(value = "description") + private String description; + + /* + * API center-scoped environment resource ID. + */ + @JsonProperty(value = "environmentId") + private String environmentId; + + /* + * API center-scoped definition resource ID. + */ + @JsonProperty(value = "definitionId") + private String definitionId; + + /* + * State of API deployment. + */ + @JsonProperty(value = "state") + private DeploymentState state; + + /* + * The deployment server + */ + @JsonProperty(value = "server") + private DeploymentServer server; + + /* + * The custom metadata defined for API catalog entities. + */ + @JsonProperty(value = "customProperties") + private Object customProperties; + + /** + * Creates an instance of DeploymentProperties class. + */ + public DeploymentProperties() { + } + + /** + * Get the title property: API deployment title. + * + * @return the title value. + */ + public String title() { + return this.title; + } + + /** + * Set the title property: API deployment title. + * + * @param title the title value to set. + * @return the DeploymentProperties object itself. + */ + public DeploymentProperties withTitle(String title) { + this.title = title; + return this; + } + + /** + * Get the description property: Description of the deployment. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Description of the deployment. + * + * @param description the description value to set. + * @return the DeploymentProperties object itself. + */ + public DeploymentProperties withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the environmentId property: API center-scoped environment resource ID. + * + * @return the environmentId value. + */ + public String environmentId() { + return this.environmentId; + } + + /** + * Set the environmentId property: API center-scoped environment resource ID. + * + * @param environmentId the environmentId value to set. + * @return the DeploymentProperties object itself. + */ + public DeploymentProperties withEnvironmentId(String environmentId) { + this.environmentId = environmentId; + return this; + } + + /** + * Get the definitionId property: API center-scoped definition resource ID. + * + * @return the definitionId value. + */ + public String definitionId() { + return this.definitionId; + } + + /** + * Set the definitionId property: API center-scoped definition resource ID. + * + * @param definitionId the definitionId value to set. + * @return the DeploymentProperties object itself. + */ + public DeploymentProperties withDefinitionId(String definitionId) { + this.definitionId = definitionId; + return this; + } + + /** + * Get the state property: State of API deployment. + * + * @return the state value. + */ + public DeploymentState state() { + return this.state; + } + + /** + * Set the state property: State of API deployment. + * + * @param state the state value to set. + * @return the DeploymentProperties object itself. + */ + public DeploymentProperties withState(DeploymentState state) { + this.state = state; + return this; + } + + /** + * Get the server property: The deployment server. + * + * @return the server value. + */ + public DeploymentServer server() { + return this.server; + } + + /** + * Set the server property: The deployment server. + * + * @param server the server value to set. + * @return the DeploymentProperties object itself. + */ + public DeploymentProperties withServer(DeploymentServer server) { + this.server = server; + return this; + } + + /** + * Get the customProperties property: The custom metadata defined for API catalog entities. + * + * @return the customProperties value. + */ + public Object customProperties() { + return this.customProperties; + } + + /** + * Set the customProperties property: The custom metadata defined for API catalog entities. + * + * @param customProperties the customProperties value to set. + * @return the DeploymentProperties object itself. + */ + public DeploymentProperties withCustomProperties(Object customProperties) { + this.customProperties = customProperties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (server() != null) { + server().validate(); + } + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/DeploymentServer.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/DeploymentServer.java new file mode 100644 index 0000000000000..a3d2e826ad0a9 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/DeploymentServer.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * Server. + */ +@Fluent +public final class DeploymentServer { + /* + * Base runtime URLs for this deployment. + */ + @JsonProperty(value = "runtimeUri") + private List runtimeUri; + + /** + * Creates an instance of DeploymentServer class. + */ + public DeploymentServer() { + } + + /** + * Get the runtimeUri property: Base runtime URLs for this deployment. + * + * @return the runtimeUri value. + */ + public List runtimeUri() { + return this.runtimeUri; + } + + /** + * Set the runtimeUri property: Base runtime URLs for this deployment. + * + * @param runtimeUri the runtimeUri value to set. + * @return the DeploymentServer object itself. + */ + public DeploymentServer withRuntimeUri(List runtimeUri) { + this.runtimeUri = runtimeUri; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/DeploymentState.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/DeploymentState.java new file mode 100644 index 0000000000000..3125c158658cd --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/DeploymentState.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * State of the Deployment. + */ +public final class DeploymentState extends ExpandableStringEnum { + /** + * Static value active for DeploymentState. + */ + public static final DeploymentState ACTIVE = fromString("active"); + + /** + * Static value inactive for DeploymentState. + */ + public static final DeploymentState INACTIVE = fromString("inactive"); + + /** + * Creates a new instance of DeploymentState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public DeploymentState() { + } + + /** + * Creates or finds a DeploymentState from its string representation. + * + * @param name a name to look for. + * @return the corresponding DeploymentState. + */ + @JsonCreator + public static DeploymentState fromString(String name) { + return fromString(name, DeploymentState.class); + } + + /** + * Gets known DeploymentState values. + * + * @return known DeploymentState values. + */ + public static Collection values() { + return values(DeploymentState.class); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/Deployments.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/Deployments.java new file mode 100644 index 0000000000000..270654dd2c3c5 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/Deployments.java @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of Deployments. + */ +public interface Deployments { + /** + * Returns a collection of API deployments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Deployment list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String serviceName, String workspaceName, String apiName); + + /** + * Returns a collection of API deployments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param filter OData filter parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Deployment list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String serviceName, String workspaceName, String apiName, + String filter, Context context); + + /** + * Returns details of the API deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param deploymentName The name of the API deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aPI deployment entity. + */ + Response getWithResponse(String resourceGroupName, String serviceName, String workspaceName, + String apiName, String deploymentName, Context context); + + /** + * Returns details of the API deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param deploymentName The name of the API deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aPI deployment entity. + */ + Deployment get(String resourceGroupName, String serviceName, String workspaceName, String apiName, + String deploymentName); + + /** + * Deletes API deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param deploymentName The name of the API deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteWithResponse(String resourceGroupName, String serviceName, String workspaceName, + String apiName, String deploymentName, Context context); + + /** + * Deletes API deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param deploymentName The name of the API deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String serviceName, String workspaceName, String apiName, + String deploymentName); + + /** + * Checks if specified API deployment exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param deploymentName The name of the API deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response headWithResponse(String resourceGroupName, String serviceName, String workspaceName, String apiName, + String deploymentName, Context context); + + /** + * Checks if specified API deployment exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param deploymentName The name of the API deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void head(String resourceGroupName, String serviceName, String workspaceName, String apiName, + String deploymentName); + + /** + * Returns details of the API deployment. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aPI deployment entity. + */ + Deployment getById(String id); + + /** + * Returns details of the API deployment. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return aPI deployment entity. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes API deployment. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes API deployment. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new Deployment resource. + * + * @param name resource name. + * @return the first stage of the new Deployment definition. + */ + Deployment.DefinitionStages.Blank define(String name); +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/DeploymentsCreateOrUpdateHeaders.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/DeploymentsCreateOrUpdateHeaders.java new file mode 100644 index 0000000000000..1784782035995 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/DeploymentsCreateOrUpdateHeaders.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.HttpHeaders; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The DeploymentsCreateOrUpdateHeaders model. + */ +@Fluent +public final class DeploymentsCreateOrUpdateHeaders { + /* + * The Etag property. + */ + @JsonProperty(value = "Etag") + private String etag; + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of DeploymentsCreateOrUpdateHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public DeploymentsCreateOrUpdateHeaders(HttpHeaders rawHeaders) { + this.etag = rawHeaders.getValue(HttpHeaderName.ETAG); + } + + /** + * Get the etag property: The Etag property. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** + * Set the etag property: The Etag property. + * + * @param etag the etag value to set. + * @return the DeploymentsCreateOrUpdateHeaders object itself. + */ + public DeploymentsCreateOrUpdateHeaders withEtag(String etag) { + this.etag = etag; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/DeploymentsCreateOrUpdateResponse.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/DeploymentsCreateOrUpdateResponse.java new file mode 100644 index 0000000000000..5b1189945320c --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/DeploymentsCreateOrUpdateResponse.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; +import com.azure.resourcemanager.apicenter.fluent.models.DeploymentInner; + +/** + * Contains all response data for the createOrUpdate operation. + */ +public final class DeploymentsCreateOrUpdateResponse + extends ResponseBase { + /** + * Creates an instance of DeploymentsCreateOrUpdateResponse. + * + * @param request the request which resulted in this DeploymentsCreateOrUpdateResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public DeploymentsCreateOrUpdateResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, + DeploymentInner value, DeploymentsCreateOrUpdateHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } + + /** + * Gets the deserialized response body. + * + * @return the deserialized response body. + */ + @Override + public DeploymentInner getValue() { + return super.getValue(); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/DeploymentsGetHeaders.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/DeploymentsGetHeaders.java new file mode 100644 index 0000000000000..5464b2168bb60 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/DeploymentsGetHeaders.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.HttpHeaders; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The DeploymentsGetHeaders model. + */ +@Fluent +public final class DeploymentsGetHeaders { + /* + * The Etag property. + */ + @JsonProperty(value = "Etag") + private String etag; + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of DeploymentsGetHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public DeploymentsGetHeaders(HttpHeaders rawHeaders) { + this.etag = rawHeaders.getValue(HttpHeaderName.ETAG); + } + + /** + * Get the etag property: The Etag property. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** + * Set the etag property: The Etag property. + * + * @param etag the etag value to set. + * @return the DeploymentsGetHeaders object itself. + */ + public DeploymentsGetHeaders withEtag(String etag) { + this.etag = etag; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/DeploymentsGetResponse.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/DeploymentsGetResponse.java new file mode 100644 index 0000000000000..e3b713085a96b --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/DeploymentsGetResponse.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; +import com.azure.resourcemanager.apicenter.fluent.models.DeploymentInner; + +/** + * Contains all response data for the get operation. + */ +public final class DeploymentsGetResponse extends ResponseBase { + /** + * Creates an instance of DeploymentsGetResponse. + * + * @param request the request which resulted in this DeploymentsGetResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public DeploymentsGetResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, DeploymentInner value, + DeploymentsGetHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } + + /** + * Gets the deserialized response body. + * + * @return the deserialized response body. + */ + @Override + public DeploymentInner getValue() { + return super.getValue(); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/Environment.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/Environment.java new file mode 100644 index 0000000000000..27e47be4408b4 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/Environment.java @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.apicenter.fluent.models.EnvironmentInner; + +/** + * An immutable client-side representation of Environment. + */ +public interface Environment { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + EnvironmentProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.apicenter.fluent.models.EnvironmentInner object. + * + * @return the inner object. + */ + EnvironmentInner innerModel(); + + /** + * The entirety of the Environment definition. + */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + + /** + * The Environment definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the Environment definition. + */ + interface Blank extends WithParentResource { + } + + /** + * The stage of the Environment definition allowing to specify parent resource. + */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serviceName, workspaceName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @return the next definition stage. + */ + WithCreate withExistingWorkspace(String resourceGroupName, String serviceName, String workspaceName); + } + + /** + * The stage of the Environment definition which contains all the minimum required properties for the resource + * to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + Environment create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Environment create(Context context); + } + + /** + * The stage of the Environment definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + WithCreate withProperties(EnvironmentProperties properties); + } + } + + /** + * Begins update for the Environment resource. + * + * @return the stage of resource update. + */ + Environment.Update update(); + + /** + * The template for Environment update. + */ + interface Update { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Environment apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Environment apply(Context context); + } + + /** + * The Environment update stages. + */ + interface UpdateStages { + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + Environment refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Environment refresh(Context context); +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/EnvironmentKind.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/EnvironmentKind.java new file mode 100644 index 0000000000000..dac4a4beaa8df --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/EnvironmentKind.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * The kind of environment. + */ +public final class EnvironmentKind extends ExpandableStringEnum { + /** + * Static value development for EnvironmentKind. + */ + public static final EnvironmentKind DEVELOPMENT = fromString("development"); + + /** + * Static value testing for EnvironmentKind. + */ + public static final EnvironmentKind TESTING = fromString("testing"); + + /** + * Static value staging for EnvironmentKind. + */ + public static final EnvironmentKind STAGING = fromString("staging"); + + /** + * Static value production for EnvironmentKind. + */ + public static final EnvironmentKind PRODUCTION = fromString("production"); + + /** + * Creates a new instance of EnvironmentKind value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public EnvironmentKind() { + } + + /** + * Creates or finds a EnvironmentKind from its string representation. + * + * @param name a name to look for. + * @return the corresponding EnvironmentKind. + */ + @JsonCreator + public static EnvironmentKind fromString(String name) { + return fromString(name, EnvironmentKind.class); + } + + /** + * Gets known EnvironmentKind values. + * + * @return known EnvironmentKind values. + */ + public static Collection values() { + return values(EnvironmentKind.class); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/EnvironmentListResult.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/EnvironmentListResult.java new file mode 100644 index 0000000000000..28a14cb612e79 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/EnvironmentListResult.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.apicenter.fluent.models.EnvironmentInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * The response of a Environment list operation. + */ +@Immutable +public final class EnvironmentListResult { + /* + * The Environment items on this page + */ + @JsonProperty(value = "value", required = true, access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * The link to the next page of items + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Creates an instance of EnvironmentListResult class. + */ + public EnvironmentListResult() { + } + + /** + * Get the value property: The Environment items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/EnvironmentProperties.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/EnvironmentProperties.java new file mode 100644 index 0000000000000..0df8391a1ffae --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/EnvironmentProperties.java @@ -0,0 +1,201 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Environment properties entity. + */ +@Fluent +public final class EnvironmentProperties { + /* + * Environment title. + */ + @JsonProperty(value = "title", required = true) + private String title; + + /* + * The environment description. + */ + @JsonProperty(value = "description") + private String description; + + /* + * Environment kind. + */ + @JsonProperty(value = "kind", required = true) + private EnvironmentKind kind; + + /* + * Server information of the environment. + */ + @JsonProperty(value = "server") + private EnvironmentServer server; + + /* + * Environment onboarding information + */ + @JsonProperty(value = "onboarding") + private Onboarding onboarding; + + /* + * The custom metadata defined for API catalog entities. + */ + @JsonProperty(value = "customProperties") + private Object customProperties; + + /** + * Creates an instance of EnvironmentProperties class. + */ + public EnvironmentProperties() { + } + + /** + * Get the title property: Environment title. + * + * @return the title value. + */ + public String title() { + return this.title; + } + + /** + * Set the title property: Environment title. + * + * @param title the title value to set. + * @return the EnvironmentProperties object itself. + */ + public EnvironmentProperties withTitle(String title) { + this.title = title; + return this; + } + + /** + * Get the description property: The environment description. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The environment description. + * + * @param description the description value to set. + * @return the EnvironmentProperties object itself. + */ + public EnvironmentProperties withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the kind property: Environment kind. + * + * @return the kind value. + */ + public EnvironmentKind kind() { + return this.kind; + } + + /** + * Set the kind property: Environment kind. + * + * @param kind the kind value to set. + * @return the EnvironmentProperties object itself. + */ + public EnvironmentProperties withKind(EnvironmentKind kind) { + this.kind = kind; + return this; + } + + /** + * Get the server property: Server information of the environment. + * + * @return the server value. + */ + public EnvironmentServer server() { + return this.server; + } + + /** + * Set the server property: Server information of the environment. + * + * @param server the server value to set. + * @return the EnvironmentProperties object itself. + */ + public EnvironmentProperties withServer(EnvironmentServer server) { + this.server = server; + return this; + } + + /** + * Get the onboarding property: Environment onboarding information. + * + * @return the onboarding value. + */ + public Onboarding onboarding() { + return this.onboarding; + } + + /** + * Set the onboarding property: Environment onboarding information. + * + * @param onboarding the onboarding value to set. + * @return the EnvironmentProperties object itself. + */ + public EnvironmentProperties withOnboarding(Onboarding onboarding) { + this.onboarding = onboarding; + return this; + } + + /** + * Get the customProperties property: The custom metadata defined for API catalog entities. + * + * @return the customProperties value. + */ + public Object customProperties() { + return this.customProperties; + } + + /** + * Set the customProperties property: The custom metadata defined for API catalog entities. + * + * @param customProperties the customProperties value to set. + * @return the EnvironmentProperties object itself. + */ + public EnvironmentProperties withCustomProperties(Object customProperties) { + this.customProperties = customProperties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (title() == null) { + throw LOGGER.logExceptionAsError( + new IllegalArgumentException("Missing required property title in model EnvironmentProperties")); + } + if (kind() == null) { + throw LOGGER.logExceptionAsError( + new IllegalArgumentException("Missing required property kind in model EnvironmentProperties")); + } + if (server() != null) { + server().validate(); + } + if (onboarding() != null) { + onboarding().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(EnvironmentProperties.class); +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/EnvironmentServer.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/EnvironmentServer.java new file mode 100644 index 0000000000000..37e90008e3a10 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/EnvironmentServer.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * Server information of the environment. + */ +@Fluent +public final class EnvironmentServer { + /* + * Type of the server that represents the environment. + */ + @JsonProperty(value = "type") + private EnvironmentServerType type; + + /* + * The location of the management portal + */ + @JsonProperty(value = "managementPortalUri") + private List managementPortalUri; + + /** + * Creates an instance of EnvironmentServer class. + */ + public EnvironmentServer() { + } + + /** + * Get the type property: Type of the server that represents the environment. + * + * @return the type value. + */ + public EnvironmentServerType type() { + return this.type; + } + + /** + * Set the type property: Type of the server that represents the environment. + * + * @param type the type value to set. + * @return the EnvironmentServer object itself. + */ + public EnvironmentServer withType(EnvironmentServerType type) { + this.type = type; + return this; + } + + /** + * Get the managementPortalUri property: The location of the management portal. + * + * @return the managementPortalUri value. + */ + public List managementPortalUri() { + return this.managementPortalUri; + } + + /** + * Set the managementPortalUri property: The location of the management portal. + * + * @param managementPortalUri the managementPortalUri value to set. + * @return the EnvironmentServer object itself. + */ + public EnvironmentServer withManagementPortalUri(List managementPortalUri) { + this.managementPortalUri = managementPortalUri; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/EnvironmentServerType.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/EnvironmentServerType.java new file mode 100644 index 0000000000000..364f0e633bf34 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/EnvironmentServerType.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * The type of environment server. + */ +public final class EnvironmentServerType extends ExpandableStringEnum { + /** + * Static value Azure API Management for EnvironmentServerType. + */ + public static final EnvironmentServerType AZURE_API_MANAGEMENT = fromString("Azure API Management"); + + /** + * Static value Azure compute service for EnvironmentServerType. + */ + public static final EnvironmentServerType AZURE_COMPUTE_SERVICE = fromString("Azure compute service"); + + /** + * Static value Apigee API Management for EnvironmentServerType. + */ + public static final EnvironmentServerType APIGEE_API_MANAGEMENT = fromString("Apigee API Management"); + + /** + * Static value AWS API Gateway for EnvironmentServerType. + */ + public static final EnvironmentServerType AWS_API_GATEWAY = fromString("AWS API Gateway"); + + /** + * Static value Kong API Gateway for EnvironmentServerType. + */ + public static final EnvironmentServerType KONG_API_GATEWAY = fromString("Kong API Gateway"); + + /** + * Static value Kubernetes for EnvironmentServerType. + */ + public static final EnvironmentServerType KUBERNETES = fromString("Kubernetes"); + + /** + * Static value MuleSoft API Management for EnvironmentServerType. + */ + public static final EnvironmentServerType MULE_SOFT_API_MANAGEMENT = fromString("MuleSoft API Management"); + + /** + * Creates a new instance of EnvironmentServerType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public EnvironmentServerType() { + } + + /** + * Creates or finds a EnvironmentServerType from its string representation. + * + * @param name a name to look for. + * @return the corresponding EnvironmentServerType. + */ + @JsonCreator + public static EnvironmentServerType fromString(String name) { + return fromString(name, EnvironmentServerType.class); + } + + /** + * Gets known EnvironmentServerType values. + * + * @return known EnvironmentServerType values. + */ + public static Collection values() { + return values(EnvironmentServerType.class); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/Environments.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/Environments.java new file mode 100644 index 0000000000000..e67ab06a73208 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/Environments.java @@ -0,0 +1,184 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of Environments. + */ +public interface Environments { + /** + * Returns a collection of environments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Environment list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String serviceName, String workspaceName); + + /** + * Returns a collection of environments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param filter OData filter parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Environment list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String serviceName, String workspaceName, String filter, + Context context); + + /** + * Returns details of the environment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param environmentName The name of the environment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return environment entity. + */ + Response getWithResponse(String resourceGroupName, String serviceName, String workspaceName, + String environmentName, Context context); + + /** + * Returns details of the environment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param environmentName The name of the environment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return environment entity. + */ + Environment get(String resourceGroupName, String serviceName, String workspaceName, String environmentName); + + /** + * Deletes the environment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param environmentName The name of the environment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteWithResponse(String resourceGroupName, String serviceName, String workspaceName, + String environmentName, Context context); + + /** + * Deletes the environment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param environmentName The name of the environment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String serviceName, String workspaceName, String environmentName); + + /** + * Checks if specified environment exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param environmentName The name of the environment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response headWithResponse(String resourceGroupName, String serviceName, String workspaceName, + String environmentName, Context context); + + /** + * Checks if specified environment exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param environmentName The name of the environment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void head(String resourceGroupName, String serviceName, String workspaceName, String environmentName); + + /** + * Returns details of the environment. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return environment entity. + */ + Environment getById(String id); + + /** + * Returns details of the environment. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return environment entity. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes the environment. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes the environment. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new Environment resource. + * + * @param name resource name. + * @return the first stage of the new Environment definition. + */ + Environment.DefinitionStages.Blank define(String name); +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/EnvironmentsCreateOrUpdateHeaders.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/EnvironmentsCreateOrUpdateHeaders.java new file mode 100644 index 0000000000000..2dec056dbb46f --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/EnvironmentsCreateOrUpdateHeaders.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.HttpHeaders; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The EnvironmentsCreateOrUpdateHeaders model. + */ +@Fluent +public final class EnvironmentsCreateOrUpdateHeaders { + /* + * The Etag property. + */ + @JsonProperty(value = "Etag") + private String etag; + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of EnvironmentsCreateOrUpdateHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public EnvironmentsCreateOrUpdateHeaders(HttpHeaders rawHeaders) { + this.etag = rawHeaders.getValue(HttpHeaderName.ETAG); + } + + /** + * Get the etag property: The Etag property. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** + * Set the etag property: The Etag property. + * + * @param etag the etag value to set. + * @return the EnvironmentsCreateOrUpdateHeaders object itself. + */ + public EnvironmentsCreateOrUpdateHeaders withEtag(String etag) { + this.etag = etag; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/EnvironmentsCreateOrUpdateResponse.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/EnvironmentsCreateOrUpdateResponse.java new file mode 100644 index 0000000000000..23b5dcdee28ec --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/EnvironmentsCreateOrUpdateResponse.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; +import com.azure.resourcemanager.apicenter.fluent.models.EnvironmentInner; + +/** + * Contains all response data for the createOrUpdate operation. + */ +public final class EnvironmentsCreateOrUpdateResponse + extends ResponseBase { + /** + * Creates an instance of EnvironmentsCreateOrUpdateResponse. + * + * @param request the request which resulted in this EnvironmentsCreateOrUpdateResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public EnvironmentsCreateOrUpdateResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, + EnvironmentInner value, EnvironmentsCreateOrUpdateHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } + + /** + * Gets the deserialized response body. + * + * @return the deserialized response body. + */ + @Override + public EnvironmentInner getValue() { + return super.getValue(); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/EnvironmentsGetHeaders.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/EnvironmentsGetHeaders.java new file mode 100644 index 0000000000000..d0db9609756bf --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/EnvironmentsGetHeaders.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.HttpHeaders; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The EnvironmentsGetHeaders model. + */ +@Fluent +public final class EnvironmentsGetHeaders { + /* + * The Etag property. + */ + @JsonProperty(value = "Etag") + private String etag; + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of EnvironmentsGetHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public EnvironmentsGetHeaders(HttpHeaders rawHeaders) { + this.etag = rawHeaders.getValue(HttpHeaderName.ETAG); + } + + /** + * Get the etag property: The Etag property. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** + * Set the etag property: The Etag property. + * + * @param etag the etag value to set. + * @return the EnvironmentsGetHeaders object itself. + */ + public EnvironmentsGetHeaders withEtag(String etag) { + this.etag = etag; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/EnvironmentsGetResponse.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/EnvironmentsGetResponse.java new file mode 100644 index 0000000000000..3e321d1edaaf9 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/EnvironmentsGetResponse.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; +import com.azure.resourcemanager.apicenter.fluent.models.EnvironmentInner; + +/** + * Contains all response data for the get operation. + */ +public final class EnvironmentsGetResponse extends ResponseBase { + /** + * Creates an instance of EnvironmentsGetResponse. + * + * @param request the request which resulted in this EnvironmentsGetResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public EnvironmentsGetResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, EnvironmentInner value, + EnvironmentsGetHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } + + /** + * Gets the deserialized response body. + * + * @return the deserialized response body. + */ + @Override + public EnvironmentInner getValue() { + return super.getValue(); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ExternalDocumentation.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ExternalDocumentation.java new file mode 100644 index 0000000000000..1d832fb9c1588 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ExternalDocumentation.java @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional, external documentation for the API. + */ +@Fluent +public final class ExternalDocumentation { + /* + * Title of the documentation. + */ + @JsonProperty(value = "title") + private String title; + + /* + * Description of the documentation. + */ + @JsonProperty(value = "description") + private String description; + + /* + * URL pointing to the documentation. + */ + @JsonProperty(value = "url", required = true) + private String url; + + /** + * Creates an instance of ExternalDocumentation class. + */ + public ExternalDocumentation() { + } + + /** + * Get the title property: Title of the documentation. + * + * @return the title value. + */ + public String title() { + return this.title; + } + + /** + * Set the title property: Title of the documentation. + * + * @param title the title value to set. + * @return the ExternalDocumentation object itself. + */ + public ExternalDocumentation withTitle(String title) { + this.title = title; + return this; + } + + /** + * Get the description property: Description of the documentation. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Description of the documentation. + * + * @param description the description value to set. + * @return the ExternalDocumentation object itself. + */ + public ExternalDocumentation withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the url property: URL pointing to the documentation. + * + * @return the url value. + */ + public String url() { + return this.url; + } + + /** + * Set the url property: URL pointing to the documentation. + * + * @param url the url value to set. + * @return the ExternalDocumentation object itself. + */ + public ExternalDocumentation withUrl(String url) { + this.url = url; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (url() == null) { + throw LOGGER.logExceptionAsError( + new IllegalArgumentException("Missing required property url in model ExternalDocumentation")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ExternalDocumentation.class); +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/License.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/License.java new file mode 100644 index 0000000000000..94b1df41d1cc3 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/License.java @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The license information for the API. + */ +@Fluent +public final class License { + /* + * Name of the license. + */ + @JsonProperty(value = "name") + private String name; + + /* + * URL pointing to the license details. The URL field is mutually exclusive of the + * identifier field. + */ + @JsonProperty(value = "url") + private String url; + + /* + * SPDX license information for the API. The identifier field is mutually + * exclusive of the URL field. + */ + @JsonProperty(value = "identifier") + private String identifier; + + /** + * Creates an instance of License class. + */ + public License() { + } + + /** + * Get the name property: Name of the license. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name of the license. + * + * @param name the name value to set. + * @return the License object itself. + */ + public License withName(String name) { + this.name = name; + return this; + } + + /** + * Get the url property: URL pointing to the license details. The URL field is mutually exclusive of the + * identifier field. + * + * @return the url value. + */ + public String url() { + return this.url; + } + + /** + * Set the url property: URL pointing to the license details. The URL field is mutually exclusive of the + * identifier field. + * + * @param url the url value to set. + * @return the License object itself. + */ + public License withUrl(String url) { + this.url = url; + return this; + } + + /** + * Get the identifier property: SPDX license information for the API. The identifier field is mutually + * exclusive of the URL field. + * + * @return the identifier value. + */ + public String identifier() { + return this.identifier; + } + + /** + * Set the identifier property: SPDX license information for the API. The identifier field is mutually + * exclusive of the URL field. + * + * @param identifier the identifier value to set. + * @return the License object itself. + */ + public License withIdentifier(String identifier) { + this.identifier = identifier; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/LifecycleStage.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/LifecycleStage.java new file mode 100644 index 0000000000000..e0bb88db7d7ce --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/LifecycleStage.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * The stage of the Api development lifecycle. + */ +public final class LifecycleStage extends ExpandableStringEnum { + /** + * Static value design for LifecycleStage. + */ + public static final LifecycleStage DESIGN = fromString("design"); + + /** + * Static value development for LifecycleStage. + */ + public static final LifecycleStage DEVELOPMENT = fromString("development"); + + /** + * Static value testing for LifecycleStage. + */ + public static final LifecycleStage TESTING = fromString("testing"); + + /** + * Static value preview for LifecycleStage. + */ + public static final LifecycleStage PREVIEW = fromString("preview"); + + /** + * Static value production for LifecycleStage. + */ + public static final LifecycleStage PRODUCTION = fromString("production"); + + /** + * Static value deprecated for LifecycleStage. + */ + public static final LifecycleStage DEPRECATED = fromString("deprecated"); + + /** + * Static value retired for LifecycleStage. + */ + public static final LifecycleStage RETIRED = fromString("retired"); + + /** + * Creates a new instance of LifecycleStage value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public LifecycleStage() { + } + + /** + * Creates or finds a LifecycleStage from its string representation. + * + * @param name a name to look for. + * @return the corresponding LifecycleStage. + */ + @JsonCreator + public static LifecycleStage fromString(String name) { + return fromString(name, LifecycleStage.class); + } + + /** + * Gets known LifecycleStage values. + * + * @return known LifecycleStage values. + */ + public static Collection values() { + return values(LifecycleStage.class); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ManagedServiceIdentity.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ManagedServiceIdentity.java index c92f01cd74109..d4ab12e83f608 100644 --- a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ManagedServiceIdentity.java +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ManagedServiceIdentity.java @@ -11,7 +11,9 @@ import java.util.Map; import java.util.UUID; -/** Managed service identity (system assigned and/or user assigned identities). */ +/** + * Managed service identity (system assigned and/or user assigned identities). + */ @Fluent public final class ManagedServiceIdentity { /* @@ -37,21 +39,24 @@ public final class ManagedServiceIdentity { /* * The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys * will be ARM resource ids in the form: - * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/ + * userAssignedIdentities/{identityName}. * The dictionary values can be empty objects ({}) in requests. */ @JsonProperty(value = "userAssignedIdentities") @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) private Map userAssignedIdentities; - /** Creates an instance of ManagedServiceIdentity class. */ + /** + * Creates an instance of ManagedServiceIdentity class. + */ public ManagedServiceIdentity() { } /** * Get the principalId property: The service principal ID of the system assigned identity. This property will only * be provided for a system assigned identity. - * + * * @return the principalId value. */ public UUID principalId() { @@ -59,9 +64,9 @@ public UUID principalId() { } /** - * Get the tenantId property: The tenant ID of the system assigned identity. This property will only be provided for - * a system assigned identity. - * + * Get the tenantId property: The tenant ID of the system assigned identity. This property will only be provided + * for a system assigned identity. + * * @return the tenantId value. */ public UUID tenantId() { @@ -71,7 +76,7 @@ public UUID tenantId() { /** * Get the type property: Type of managed service identity (where both SystemAssigned and UserAssigned types are * allowed). - * + * * @return the type value. */ public ManagedServiceIdentityType type() { @@ -81,7 +86,7 @@ public ManagedServiceIdentityType type() { /** * Set the type property: Type of managed service identity (where both SystemAssigned and UserAssigned types are * allowed). - * + * * @param type the type value to set. * @return the ManagedServiceIdentity object itself. */ @@ -95,7 +100,7 @@ public ManagedServiceIdentity withType(ManagedServiceIdentityType type) { * userAssignedIdentities dictionary keys will be ARM resource ids in the form: * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. * The dictionary values can be empty objects ({}) in requests. - * + * * @return the userAssignedIdentities value. */ public Map userAssignedIdentities() { @@ -107,7 +112,7 @@ public Map userAssignedIdentities() { * userAssignedIdentities dictionary keys will be ARM resource ids in the form: * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. * The dictionary values can be empty objects ({}) in requests. - * + * * @param userAssignedIdentities the userAssignedIdentities value to set. * @return the ManagedServiceIdentity object itself. */ @@ -118,24 +123,20 @@ public ManagedServiceIdentity withUserAssignedIdentities(Map { - if (e != null) { - e.validate(); - } - }); + userAssignedIdentities().values().forEach(e -> { + if (e != null) { + e.validate(); + } + }); } } diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ManagedServiceIdentityType.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ManagedServiceIdentityType.java index 6958fa5f75a18..2145c14bce061 100644 --- a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ManagedServiceIdentityType.java +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ManagedServiceIdentityType.java @@ -8,24 +8,34 @@ import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; -/** Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). */ +/** + * Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). + */ public final class ManagedServiceIdentityType extends ExpandableStringEnum { - /** Static value None for ManagedServiceIdentityType. */ + /** + * Static value None for ManagedServiceIdentityType. + */ public static final ManagedServiceIdentityType NONE = fromString("None"); - /** Static value SystemAssigned for ManagedServiceIdentityType. */ + /** + * Static value SystemAssigned for ManagedServiceIdentityType. + */ public static final ManagedServiceIdentityType SYSTEM_ASSIGNED = fromString("SystemAssigned"); - /** Static value UserAssigned for ManagedServiceIdentityType. */ + /** + * Static value UserAssigned for ManagedServiceIdentityType. + */ public static final ManagedServiceIdentityType USER_ASSIGNED = fromString("UserAssigned"); - /** Static value SystemAssigned,UserAssigned for ManagedServiceIdentityType. */ - public static final ManagedServiceIdentityType SYSTEM_ASSIGNED_USER_ASSIGNED = - fromString("SystemAssigned,UserAssigned"); + /** + * Static value SystemAssigned,UserAssigned for ManagedServiceIdentityType. + */ + public static final ManagedServiceIdentityType SYSTEM_ASSIGNED_USER_ASSIGNED + = fromString("SystemAssigned,UserAssigned"); /** * Creates a new instance of ManagedServiceIdentityType value. - * + * * @deprecated Use the {@link #fromString(String)} factory method. */ @Deprecated @@ -34,7 +44,7 @@ public ManagedServiceIdentityType() { /** * Creates or finds a ManagedServiceIdentityType from its string representation. - * + * * @param name a name to look for. * @return the corresponding ManagedServiceIdentityType. */ @@ -45,7 +55,7 @@ public static ManagedServiceIdentityType fromString(String name) { /** * Gets known ManagedServiceIdentityType values. - * + * * @return known ManagedServiceIdentityType values. */ public static Collection values() { diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/MetadataAssignment.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/MetadataAssignment.java new file mode 100644 index 0000000000000..b523df78d3483 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/MetadataAssignment.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Assignment metadata. + */ +@Fluent +public final class MetadataAssignment { + /* + * The entities this metadata schema component gets applied to. + */ + @JsonProperty(value = "entity") + private MetadataAssignmentEntity entity; + + /* + * Required assignment + */ + @JsonProperty(value = "required") + private Boolean required; + + /* + * Deprecated assignment + */ + @JsonProperty(value = "deprecated") + private Boolean deprecated; + + /** + * Creates an instance of MetadataAssignment class. + */ + public MetadataAssignment() { + } + + /** + * Get the entity property: The entities this metadata schema component gets applied to. + * + * @return the entity value. + */ + public MetadataAssignmentEntity entity() { + return this.entity; + } + + /** + * Set the entity property: The entities this metadata schema component gets applied to. + * + * @param entity the entity value to set. + * @return the MetadataAssignment object itself. + */ + public MetadataAssignment withEntity(MetadataAssignmentEntity entity) { + this.entity = entity; + return this; + } + + /** + * Get the required property: Required assignment. + * + * @return the required value. + */ + public Boolean required() { + return this.required; + } + + /** + * Set the required property: Required assignment. + * + * @param required the required value to set. + * @return the MetadataAssignment object itself. + */ + public MetadataAssignment withRequired(Boolean required) { + this.required = required; + return this; + } + + /** + * Get the deprecated property: Deprecated assignment. + * + * @return the deprecated value. + */ + public Boolean deprecated() { + return this.deprecated; + } + + /** + * Set the deprecated property: Deprecated assignment. + * + * @param deprecated the deprecated value to set. + * @return the MetadataAssignment object itself. + */ + public MetadataAssignment withDeprecated(Boolean deprecated) { + this.deprecated = deprecated; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/MetadataAssignmentEntity.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/MetadataAssignmentEntity.java new file mode 100644 index 0000000000000..6c68149d8bdec --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/MetadataAssignmentEntity.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * Assignment entity for Metadata. + */ +public final class MetadataAssignmentEntity extends ExpandableStringEnum { + /** + * Static value api for MetadataAssignmentEntity. + */ + public static final MetadataAssignmentEntity API = fromString("api"); + + /** + * Static value environment for MetadataAssignmentEntity. + */ + public static final MetadataAssignmentEntity ENVIRONMENT = fromString("environment"); + + /** + * Static value deployment for MetadataAssignmentEntity. + */ + public static final MetadataAssignmentEntity DEPLOYMENT = fromString("deployment"); + + /** + * Creates a new instance of MetadataAssignmentEntity value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public MetadataAssignmentEntity() { + } + + /** + * Creates or finds a MetadataAssignmentEntity from its string representation. + * + * @param name a name to look for. + * @return the corresponding MetadataAssignmentEntity. + */ + @JsonCreator + public static MetadataAssignmentEntity fromString(String name) { + return fromString(name, MetadataAssignmentEntity.class); + } + + /** + * Gets known MetadataAssignmentEntity values. + * + * @return known MetadataAssignmentEntity values. + */ + public static Collection values() { + return values(MetadataAssignmentEntity.class); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/MetadataSchema.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/MetadataSchema.java new file mode 100644 index 0000000000000..ffe59a849a772 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/MetadataSchema.java @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.apicenter.fluent.models.MetadataSchemaInner; + +/** + * An immutable client-side representation of MetadataSchema. + */ +public interface MetadataSchema { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + MetadataSchemaProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.apicenter.fluent.models.MetadataSchemaInner object. + * + * @return the inner object. + */ + MetadataSchemaInner innerModel(); + + /** + * The entirety of the MetadataSchema definition. + */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + + /** + * The MetadataSchema definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the MetadataSchema definition. + */ + interface Blank extends WithParentResource { + } + + /** + * The stage of the MetadataSchema definition allowing to specify parent resource. + */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serviceName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @return the next definition stage. + */ + WithCreate withExistingService(String resourceGroupName, String serviceName); + } + + /** + * The stage of the MetadataSchema definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + MetadataSchema create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + MetadataSchema create(Context context); + } + + /** + * The stage of the MetadataSchema definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + WithCreate withProperties(MetadataSchemaProperties properties); + } + } + + /** + * Begins update for the MetadataSchema resource. + * + * @return the stage of resource update. + */ + MetadataSchema.Update update(); + + /** + * The template for MetadataSchema update. + */ + interface Update { + /** + * Executes the update request. + * + * @return the updated resource. + */ + MetadataSchema apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + MetadataSchema apply(Context context); + } + + /** + * The MetadataSchema update stages. + */ + interface UpdateStages { + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + MetadataSchema refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + MetadataSchema refresh(Context context); +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/MetadataSchemaExportFormat.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/MetadataSchemaExportFormat.java new file mode 100644 index 0000000000000..c6e2064264698 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/MetadataSchemaExportFormat.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * The format for schema export. + */ +public final class MetadataSchemaExportFormat extends ExpandableStringEnum { + /** + * Static value inline for MetadataSchemaExportFormat. + */ + public static final MetadataSchemaExportFormat INLINE = fromString("inline"); + + /** + * Static value link for MetadataSchemaExportFormat. + */ + public static final MetadataSchemaExportFormat LINK = fromString("link"); + + /** + * Creates a new instance of MetadataSchemaExportFormat value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public MetadataSchemaExportFormat() { + } + + /** + * Creates or finds a MetadataSchemaExportFormat from its string representation. + * + * @param name a name to look for. + * @return the corresponding MetadataSchemaExportFormat. + */ + @JsonCreator + public static MetadataSchemaExportFormat fromString(String name) { + return fromString(name, MetadataSchemaExportFormat.class); + } + + /** + * Gets known MetadataSchemaExportFormat values. + * + * @return known MetadataSchemaExportFormat values. + */ + public static Collection values() { + return values(MetadataSchemaExportFormat.class); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/MetadataSchemaExportRequest.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/MetadataSchemaExportRequest.java new file mode 100644 index 0000000000000..971b809ddbf74 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/MetadataSchemaExportRequest.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The metadata schema export request. + */ +@Fluent +public final class MetadataSchemaExportRequest { + /* + * An entity the metadata schema is requested for. + */ + @JsonProperty(value = "assignedTo") + private MetadataAssignmentEntity assignedTo; + + /** + * Creates an instance of MetadataSchemaExportRequest class. + */ + public MetadataSchemaExportRequest() { + } + + /** + * Get the assignedTo property: An entity the metadata schema is requested for. + * + * @return the assignedTo value. + */ + public MetadataAssignmentEntity assignedTo() { + return this.assignedTo; + } + + /** + * Set the assignedTo property: An entity the metadata schema is requested for. + * + * @param assignedTo the assignedTo value to set. + * @return the MetadataSchemaExportRequest object itself. + */ + public MetadataSchemaExportRequest withAssignedTo(MetadataAssignmentEntity assignedTo) { + this.assignedTo = assignedTo; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/MetadataSchemaExportResult.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/MetadataSchemaExportResult.java new file mode 100644 index 0000000000000..e3f138662b474 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/MetadataSchemaExportResult.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.models; + +import com.azure.resourcemanager.apicenter.fluent.models.MetadataSchemaExportResultInner; + +/** + * An immutable client-side representation of MetadataSchemaExportResult. + */ +public interface MetadataSchemaExportResult { + /** + * Gets the format property: The export format for the schema. + * + * @return the format value. + */ + MetadataSchemaExportFormat format(); + + /** + * Gets the value property: The result of the export operation. + * + * @return the value value. + */ + String value(); + + /** + * Gets the inner com.azure.resourcemanager.apicenter.fluent.models.MetadataSchemaExportResultInner object. + * + * @return the inner object. + */ + MetadataSchemaExportResultInner innerModel(); +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/MetadataSchemaListResult.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/MetadataSchemaListResult.java new file mode 100644 index 0000000000000..98f120adba605 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/MetadataSchemaListResult.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.apicenter.fluent.models.MetadataSchemaInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * The response of a MetadataSchema list operation. + */ +@Immutable +public final class MetadataSchemaListResult { + /* + * The MetadataSchema items on this page + */ + @JsonProperty(value = "value", required = true, access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * The link to the next page of items + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Creates an instance of MetadataSchemaListResult class. + */ + public MetadataSchemaListResult() { + } + + /** + * Get the value property: The MetadataSchema items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/MetadataSchemaProperties.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/MetadataSchemaProperties.java new file mode 100644 index 0000000000000..aa56d0119e3e6 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/MetadataSchemaProperties.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * Metadata schema properties. + */ +@Fluent +public final class MetadataSchemaProperties { + /* + * The schema defining the type. + */ + @JsonProperty(value = "schema", required = true) + private String schema; + + /* + * The assignees + */ + @JsonProperty(value = "assignedTo") + private List assignedTo; + + /** + * Creates an instance of MetadataSchemaProperties class. + */ + public MetadataSchemaProperties() { + } + + /** + * Get the schema property: The schema defining the type. + * + * @return the schema value. + */ + public String schema() { + return this.schema; + } + + /** + * Set the schema property: The schema defining the type. + * + * @param schema the schema value to set. + * @return the MetadataSchemaProperties object itself. + */ + public MetadataSchemaProperties withSchema(String schema) { + this.schema = schema; + return this; + } + + /** + * Get the assignedTo property: The assignees. + * + * @return the assignedTo value. + */ + public List assignedTo() { + return this.assignedTo; + } + + /** + * Set the assignedTo property: The assignees. + * + * @param assignedTo the assignedTo value to set. + * @return the MetadataSchemaProperties object itself. + */ + public MetadataSchemaProperties withAssignedTo(List assignedTo) { + this.assignedTo = assignedTo; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (schema() == null) { + throw LOGGER.logExceptionAsError( + new IllegalArgumentException("Missing required property schema in model MetadataSchemaProperties")); + } + if (assignedTo() != null) { + assignedTo().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(MetadataSchemaProperties.class); +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/MetadataSchemas.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/MetadataSchemas.java new file mode 100644 index 0000000000000..4c719d3296f9e --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/MetadataSchemas.java @@ -0,0 +1,175 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of MetadataSchemas. + */ +public interface MetadataSchemas { + /** + * Returns a collection of metadata schemas. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a MetadataSchema list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String serviceName); + + /** + * Returns a collection of metadata schemas. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param filter OData filter parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a MetadataSchema list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String serviceName, String filter, Context context); + + /** + * Returns details of the metadata schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param metadataSchemaName The name of the metadata schema. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metadata schema entity. + */ + Response getWithResponse(String resourceGroupName, String serviceName, String metadataSchemaName, + Context context); + + /** + * Returns details of the metadata schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param metadataSchemaName The name of the metadata schema. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metadata schema entity. + */ + MetadataSchema get(String resourceGroupName, String serviceName, String metadataSchemaName); + + /** + * Deletes specified metadata schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param metadataSchemaName The name of the metadata schema. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteWithResponse(String resourceGroupName, String serviceName, String metadataSchemaName, + Context context); + + /** + * Deletes specified metadata schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param metadataSchemaName The name of the metadata schema. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String serviceName, String metadataSchemaName); + + /** + * Checks if specified metadata schema exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param metadataSchemaName The name of the metadata schema. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response headWithResponse(String resourceGroupName, String serviceName, String metadataSchemaName, + Context context); + + /** + * Checks if specified metadata schema exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param metadataSchemaName The name of the metadata schema. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void head(String resourceGroupName, String serviceName, String metadataSchemaName); + + /** + * Returns details of the metadata schema. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metadata schema entity. + */ + MetadataSchema getById(String id); + + /** + * Returns details of the metadata schema. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metadata schema entity. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes specified metadata schema. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes specified metadata schema. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new MetadataSchema resource. + * + * @param name resource name. + * @return the first stage of the new MetadataSchema definition. + */ + MetadataSchema.DefinitionStages.Blank define(String name); +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/MetadataSchemasCreateOrUpdateHeaders.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/MetadataSchemasCreateOrUpdateHeaders.java new file mode 100644 index 0000000000000..0a16a34ed89da --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/MetadataSchemasCreateOrUpdateHeaders.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.HttpHeaders; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The MetadataSchemasCreateOrUpdateHeaders model. + */ +@Fluent +public final class MetadataSchemasCreateOrUpdateHeaders { + /* + * The Etag property. + */ + @JsonProperty(value = "Etag") + private String etag; + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of MetadataSchemasCreateOrUpdateHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public MetadataSchemasCreateOrUpdateHeaders(HttpHeaders rawHeaders) { + this.etag = rawHeaders.getValue(HttpHeaderName.ETAG); + } + + /** + * Get the etag property: The Etag property. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** + * Set the etag property: The Etag property. + * + * @param etag the etag value to set. + * @return the MetadataSchemasCreateOrUpdateHeaders object itself. + */ + public MetadataSchemasCreateOrUpdateHeaders withEtag(String etag) { + this.etag = etag; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/MetadataSchemasCreateOrUpdateResponse.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/MetadataSchemasCreateOrUpdateResponse.java new file mode 100644 index 0000000000000..077a24c81de1f --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/MetadataSchemasCreateOrUpdateResponse.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; +import com.azure.resourcemanager.apicenter.fluent.models.MetadataSchemaInner; + +/** + * Contains all response data for the createOrUpdate operation. + */ +public final class MetadataSchemasCreateOrUpdateResponse + extends ResponseBase { + /** + * Creates an instance of MetadataSchemasCreateOrUpdateResponse. + * + * @param request the request which resulted in this MetadataSchemasCreateOrUpdateResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public MetadataSchemasCreateOrUpdateResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, + MetadataSchemaInner value, MetadataSchemasCreateOrUpdateHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } + + /** + * Gets the deserialized response body. + * + * @return the deserialized response body. + */ + @Override + public MetadataSchemaInner getValue() { + return super.getValue(); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/MetadataSchemasGetHeaders.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/MetadataSchemasGetHeaders.java new file mode 100644 index 0000000000000..24f908652dc62 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/MetadataSchemasGetHeaders.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.HttpHeaders; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The MetadataSchemasGetHeaders model. + */ +@Fluent +public final class MetadataSchemasGetHeaders { + /* + * The Etag property. + */ + @JsonProperty(value = "Etag") + private String etag; + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of MetadataSchemasGetHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public MetadataSchemasGetHeaders(HttpHeaders rawHeaders) { + this.etag = rawHeaders.getValue(HttpHeaderName.ETAG); + } + + /** + * Get the etag property: The Etag property. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** + * Set the etag property: The Etag property. + * + * @param etag the etag value to set. + * @return the MetadataSchemasGetHeaders object itself. + */ + public MetadataSchemasGetHeaders withEtag(String etag) { + this.etag = etag; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/MetadataSchemasGetResponse.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/MetadataSchemasGetResponse.java new file mode 100644 index 0000000000000..d632c66cccfe0 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/MetadataSchemasGetResponse.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; +import com.azure.resourcemanager.apicenter.fluent.models.MetadataSchemaInner; + +/** + * Contains all response data for the get operation. + */ +public final class MetadataSchemasGetResponse extends ResponseBase { + /** + * Creates an instance of MetadataSchemasGetResponse. + * + * @param request the request which resulted in this MetadataSchemasGetResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public MetadataSchemasGetResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, + MetadataSchemaInner value, MetadataSchemasGetHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } + + /** + * Gets the deserialized response body. + * + * @return the deserialized response body. + */ + @Override + public MetadataSchemaInner getValue() { + return super.getValue(); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/Onboarding.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/Onboarding.java new file mode 100644 index 0000000000000..f2bc40ccf9ae9 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/Onboarding.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * Onboarding information. + */ +@Fluent +public final class Onboarding { + /* + * Onboarding guide. + */ + @JsonProperty(value = "instructions") + private String instructions; + + /* + * The location of the development portal + */ + @JsonProperty(value = "developerPortalUri") + private List developerPortalUri; + + /** + * Creates an instance of Onboarding class. + */ + public Onboarding() { + } + + /** + * Get the instructions property: Onboarding guide. + * + * @return the instructions value. + */ + public String instructions() { + return this.instructions; + } + + /** + * Set the instructions property: Onboarding guide. + * + * @param instructions the instructions value to set. + * @return the Onboarding object itself. + */ + public Onboarding withInstructions(String instructions) { + this.instructions = instructions; + return this; + } + + /** + * Get the developerPortalUri property: The location of the development portal. + * + * @return the developerPortalUri value. + */ + public List developerPortalUri() { + return this.developerPortalUri; + } + + /** + * Set the developerPortalUri property: The location of the development portal. + * + * @param developerPortalUri the developerPortalUri value to set. + * @return the Onboarding object itself. + */ + public Onboarding withDeveloperPortalUri(List developerPortalUri) { + this.developerPortalUri = developerPortalUri; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/Operation.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/Operation.java index 15f07c57b61c5..d87bb6af48257 100644 --- a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/Operation.java +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/Operation.java @@ -6,12 +6,14 @@ import com.azure.resourcemanager.apicenter.fluent.models.OperationInner; -/** An immutable client-side representation of Operation. */ +/** + * An immutable client-side representation of Operation. + */ public interface Operation { /** * Gets the name property: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". - * + * * @return the name value. */ String name(); @@ -19,14 +21,14 @@ public interface Operation { /** * Gets the isDataAction property: Whether the operation applies to data-plane. This is "true" for data-plane * operations and "false" for ARM/control-plane operations. - * + * * @return the isDataAction value. */ Boolean isDataAction(); /** * Gets the display property: Localized display information for this particular operation. - * + * * @return the display value. */ OperationDisplay display(); @@ -34,7 +36,7 @@ public interface Operation { /** * Gets the origin property: The intended executor of the operation; as in Resource Based Access Control (RBAC) and * audit logs UX. Default value is "user,system". - * + * * @return the origin value. */ Origin origin(); @@ -42,14 +44,14 @@ public interface Operation { /** * Gets the actionType property: Enum. Indicates the action type. "Internal" refers to actions that are for internal * only APIs. - * + * * @return the actionType value. */ ActionType actionType(); /** * Gets the inner com.azure.resourcemanager.apicenter.fluent.models.OperationInner object. - * + * * @return the inner object. */ OperationInner innerModel(); diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/OperationDisplay.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/OperationDisplay.java index ce01b8bb8b2cd..4a7aac3d38e06 100644 --- a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/OperationDisplay.java +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/OperationDisplay.java @@ -7,7 +7,9 @@ import com.azure.core.annotation.Immutable; import com.fasterxml.jackson.annotation.JsonProperty; -/** Localized display information for this particular operation. */ +/** + * Localized display information for this particular operation. + */ @Immutable public final class OperationDisplay { /* @@ -37,14 +39,16 @@ public final class OperationDisplay { @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) private String description; - /** Creates an instance of OperationDisplay class. */ + /** + * Creates an instance of OperationDisplay class. + */ public OperationDisplay() { } /** * Get the provider property: The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring * Insights" or "Microsoft Compute". - * + * * @return the provider value. */ public String provider() { @@ -54,7 +58,7 @@ public String provider() { /** * Get the resource property: The localized friendly name of the resource type related to this operation. E.g. * "Virtual Machines" or "Job Schedule Collections". - * + * * @return the resource value. */ public String resource() { @@ -64,7 +68,7 @@ public String resource() { /** * Get the operation property: The concise, localized friendly name for the operation; suitable for dropdowns. E.g. * "Create or Update Virtual Machine", "Restart Virtual Machine". - * + * * @return the operation value. */ public String operation() { @@ -74,7 +78,7 @@ public String operation() { /** * Get the description property: The short, localized friendly description of the operation; suitable for tool tips * and detailed views. - * + * * @return the description value. */ public String description() { @@ -83,7 +87,7 @@ public String description() { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/OperationListResult.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/OperationListResult.java index bb3ef363abecb..acabdbe9cbab8 100644 --- a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/OperationListResult.java +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/OperationListResult.java @@ -10,8 +10,8 @@ import java.util.List; /** - * A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of - * results. + * A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set + * of results. */ @Immutable public final class OperationListResult { @@ -27,13 +27,15 @@ public final class OperationListResult { @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) private String nextLink; - /** Creates an instance of OperationListResult class. */ + /** + * Creates an instance of OperationListResult class. + */ public OperationListResult() { } /** * Get the value property: List of operations supported by the resource provider. - * + * * @return the value value. */ public List value() { @@ -42,7 +44,7 @@ public List value() { /** * Get the nextLink property: URL to get the next set of operation list results (if there are any). - * + * * @return the nextLink value. */ public String nextLink() { @@ -51,7 +53,7 @@ public String nextLink() { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/Operations.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/Operations.java index 049d2761d2226..43039e70e8b27 100644 --- a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/Operations.java +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/Operations.java @@ -7,27 +7,29 @@ import com.azure.core.http.rest.PagedIterable; import com.azure.core.util.Context; -/** Resource collection API of Operations. */ +/** + * Resource collection API of Operations. + */ public interface Operations { /** * List the operations for the provider. - * + * * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with {@link - * PagedIterable}. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. */ PagedIterable list(); /** * List the operations for the provider. - * + * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with {@link - * PagedIterable}. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. */ PagedIterable list(Context context); } diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/Origin.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/Origin.java index 5e7670497b23f..1df173efdb126 100644 --- a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/Origin.java +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/Origin.java @@ -13,18 +13,24 @@ * is "user,system". */ public final class Origin extends ExpandableStringEnum { - /** Static value user for Origin. */ + /** + * Static value user for Origin. + */ public static final Origin USER = fromString("user"); - /** Static value system for Origin. */ + /** + * Static value system for Origin. + */ public static final Origin SYSTEM = fromString("system"); - /** Static value user,system for Origin. */ + /** + * Static value user,system for Origin. + */ public static final Origin USER_SYSTEM = fromString("user,system"); /** * Creates a new instance of Origin value. - * + * * @deprecated Use the {@link #fromString(String)} factory method. */ @Deprecated @@ -33,7 +39,7 @@ public Origin() { /** * Creates or finds a Origin from its string representation. - * + * * @param name a name to look for. * @return the corresponding Origin. */ @@ -44,7 +50,7 @@ public static Origin fromString(String name) { /** * Gets known Origin values. - * + * * @return known Origin values. */ public static Collection values() { diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ProvisioningState.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ProvisioningState.java index 0e31526e60d87..3716d12c64d54 100644 --- a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ProvisioningState.java +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ProvisioningState.java @@ -8,20 +8,28 @@ import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; -/** Provisioning state of the service. */ +/** + * The provisioning state of the resource. + */ public final class ProvisioningState extends ExpandableStringEnum { - /** Static value Succeeded for ProvisioningState. */ + /** + * Static value Succeeded for ProvisioningState. + */ public static final ProvisioningState SUCCEEDED = fromString("Succeeded"); - /** Static value Failed for ProvisioningState. */ + /** + * Static value Failed for ProvisioningState. + */ public static final ProvisioningState FAILED = fromString("Failed"); - /** Static value Canceled for ProvisioningState. */ + /** + * Static value Canceled for ProvisioningState. + */ public static final ProvisioningState CANCELED = fromString("Canceled"); /** * Creates a new instance of ProvisioningState value. - * + * * @deprecated Use the {@link #fromString(String)} factory method. */ @Deprecated @@ -30,7 +38,7 @@ public ProvisioningState() { /** * Creates or finds a ProvisioningState from its string representation. - * + * * @param name a name to look for. * @return the corresponding ProvisioningState. */ @@ -41,7 +49,7 @@ public static ProvisioningState fromString(String name) { /** * Gets known ProvisioningState values. - * + * * @return known ProvisioningState values. */ public static Collection values() { diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/Service.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/Service.java index 86b20a1e8565e..261849627913b 100644 --- a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/Service.java +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/Service.java @@ -10,111 +10,118 @@ import com.azure.resourcemanager.apicenter.fluent.models.ServiceInner; import java.util.Map; -/** An immutable client-side representation of Service. */ +/** + * An immutable client-side representation of Service. + */ public interface Service { /** * Gets the id property: Fully qualified resource Id for the resource. - * + * * @return the id value. */ String id(); /** * Gets the name property: The name of the resource. - * + * * @return the name value. */ String name(); /** * Gets the type property: The type of the resource. - * + * * @return the type value. */ String type(); /** * Gets the location property: The geo-location where the resource lives. - * + * * @return the location value. */ String location(); /** * Gets the tags property: Resource tags. - * + * * @return the tags value. */ Map tags(); /** - * Gets the identity property: The identity of the service. - * + * Gets the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + ServiceProperties properties(); + + /** + * Gets the identity property: The managed service identities assigned to this resource. + * * @return the identity value. */ ManagedServiceIdentity identity(); /** * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. - * + * * @return the systemData value. */ SystemData systemData(); - /** - * Gets the provisioningState property: The status of the last operation. - * - * @return the provisioningState value. - */ - ProvisioningState provisioningState(); - /** * Gets the region of the resource. - * + * * @return the region of the resource. */ Region region(); /** * Gets the name of the resource region. - * + * * @return the name of the resource region. */ String regionName(); /** * Gets the name of the resource group. - * + * * @return the name of the resource group. */ String resourceGroupName(); /** * Gets the inner com.azure.resourcemanager.apicenter.fluent.models.ServiceInner object. - * + * * @return the inner object. */ ServiceInner innerModel(); - /** The entirety of the Service definition. */ - interface Definition - extends DefinitionStages.Blank, - DefinitionStages.WithLocation, - DefinitionStages.WithResourceGroup, - DefinitionStages.WithCreate { + /** + * The entirety of the Service definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { } - /** The Service definition stages. */ + /** + * The Service definition stages. + */ interface DefinitionStages { - /** The first stage of the Service definition. */ + /** + * The first stage of the Service definition. + */ interface Blank extends WithLocation { } - /** The stage of the Service definition allowing to specify location. */ + /** + * The stage of the Service definition allowing to specify location. + */ interface WithLocation { /** * Specifies the region for the resource. - * + * * @param location The geo-location where the resource lives. * @return the next definition stage. */ @@ -122,18 +129,20 @@ interface WithLocation { /** * Specifies the region for the resource. - * + * * @param location The geo-location where the resource lives. * @return the next definition stage. */ WithResourceGroup withRegion(String location); } - /** The stage of the Service definition allowing to specify parent resource. */ + /** + * The stage of the Service definition allowing to specify parent resource. + */ interface WithResourceGroup { /** * Specifies resourceGroupName. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @return the next definition stage. */ @@ -144,40 +153,58 @@ interface WithResourceGroup { * The stage of the Service definition which contains all the minimum required properties for the resource to be * created, but also allows for any other optional properties to be specified. */ - interface WithCreate extends DefinitionStages.WithTags, DefinitionStages.WithIdentity { + interface WithCreate + extends DefinitionStages.WithTags, DefinitionStages.WithProperties, DefinitionStages.WithIdentity { /** * Executes the create request. - * + * * @return the created resource. */ Service create(); /** * Executes the create request. - * + * * @param context The context to associate with this operation. * @return the created resource. */ Service create(Context context); } - /** The stage of the Service definition allowing to specify tags. */ + /** + * The stage of the Service definition allowing to specify tags. + */ interface WithTags { /** * Specifies the tags property: Resource tags.. - * + * * @param tags Resource tags. * @return the next definition stage. */ WithCreate withTags(Map tags); } - /** The stage of the Service definition allowing to specify identity. */ + /** + * The stage of the Service definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + WithCreate withProperties(ServiceProperties properties); + } + + /** + * The stage of the Service definition allowing to specify identity. + */ interface WithIdentity { /** - * Specifies the identity property: The identity of the service.. - * - * @param identity The identity of the service. + * Specifies the identity property: The managed service identities assigned to this resource.. + * + * @param identity The managed service identities assigned to this resource. * @return the next definition stage. */ WithCreate withIdentity(ManagedServiceIdentity identity); @@ -186,45 +213,97 @@ interface WithIdentity { /** * Begins update for the Service resource. - * + * * @return the stage of resource update. */ Service.Update update(); - /** The template for Service update. */ - interface Update { + /** + * The template for Service update. + */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithIdentity { /** * Executes the update request. - * + * * @return the updated resource. */ Service apply(); /** * Executes the update request. - * + * * @param context The context to associate with this operation. * @return the updated resource. */ Service apply(Context context); } - /** The Service update stages. */ + /** + * The Service update stages. + */ interface UpdateStages { + /** + * The stage of the Service update allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + + /** + * The stage of the Service update allowing to specify identity. + */ + interface WithIdentity { + /** + * Specifies the identity property: The managed service identities assigned to this resource.. + * + * @param identity The managed service identities assigned to this resource. + * @return the next definition stage. + */ + Update withIdentity(ManagedServiceIdentity identity); + } } /** * Refreshes the resource to sync with Azure. - * + * * @return the refreshed resource. */ Service refresh(); /** * Refreshes the resource to sync with Azure. - * + * * @param context The context to associate with this operation. * @return the refreshed resource. */ Service refresh(Context context); + + /** + * Exports the effective metadata schema. + * + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the metadata schema export result. + */ + MetadataSchemaExportResult exportMetadataSchema(MetadataSchemaExportRequest body); + + /** + * Exports the effective metadata schema. + * + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the metadata schema export result. + */ + MetadataSchemaExportResult exportMetadataSchema(MetadataSchemaExportRequest body, Context context); } diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ServiceCollection.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ServiceCollection.java deleted file mode 100644 index d202c51970a91..0000000000000 --- a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ServiceCollection.java +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.apicenter.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.apicenter.fluent.models.ServiceInner; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.List; - -/** The response of a Service list operation. */ -@Fluent -public final class ServiceCollection { - /* - * The Service items on this page - */ - @JsonProperty(value = "value", required = true) - private List value; - - /* - * The link to the next page of items - */ - @JsonProperty(value = "nextLink") - private String nextLink; - - /** Creates an instance of ServiceCollection class. */ - public ServiceCollection() { - } - - /** - * Get the value property: The Service items on this page. - * - * @return the value value. - */ - public List value() { - return this.value; - } - - /** - * Set the value property: The Service items on this page. - * - * @param value the value value to set. - * @return the ServiceCollection object itself. - */ - public ServiceCollection withValue(List value) { - this.value = value; - return this; - } - - /** - * Get the nextLink property: The link to the next page of items. - * - * @return the nextLink value. - */ - public String nextLink() { - return this.nextLink; - } - - /** - * Set the nextLink property: The link to the next page of items. - * - * @param nextLink the nextLink value to set. - * @return the ServiceCollection object itself. - */ - public ServiceCollection withNextLink(String nextLink) { - this.nextLink = nextLink; - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (value() == null) { - throw LOGGER - .logExceptionAsError( - new IllegalArgumentException("Missing required property value in model ServiceCollection")); - } else { - value().forEach(e -> e.validate()); - } - } - - private static final ClientLogger LOGGER = new ClientLogger(ServiceCollection.class); -} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ServiceListResult.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ServiceListResult.java new file mode 100644 index 0000000000000..df9f5b834b686 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ServiceListResult.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.apicenter.fluent.models.ServiceInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * The response of a Service list operation. + */ +@Immutable +public final class ServiceListResult { + /* + * The Service items on this page + */ + @JsonProperty(value = "value", required = true, access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * The link to the next page of items + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Creates an instance of ServiceListResult class. + */ + public ServiceListResult() { + } + + /** + * Get the value property: The Service items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/models/ServiceProperties.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ServiceProperties.java similarity index 69% rename from sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/models/ServiceProperties.java rename to sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ServiceProperties.java index eb486532f809a..3cba9f5ed0b89 100644 --- a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/models/ServiceProperties.java +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ServiceProperties.java @@ -2,28 +2,31 @@ // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. -package com.azure.resourcemanager.apicenter.fluent.models; +package com.azure.resourcemanager.apicenter.models; import com.azure.core.annotation.Immutable; -import com.azure.resourcemanager.apicenter.models.ProvisioningState; import com.fasterxml.jackson.annotation.JsonProperty; -/** The properties of the service. */ +/** + * The properties of the service. + */ @Immutable public final class ServiceProperties { /* - * The status of the last operation. + * Provisioning state of the service. */ @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) private ProvisioningState provisioningState; - /** Creates an instance of ServiceProperties class. */ + /** + * Creates an instance of ServiceProperties class. + */ public ServiceProperties() { } /** - * Get the provisioningState property: The status of the last operation. - * + * Get the provisioningState property: Provisioning state of the service. + * * @return the provisioningState value. */ public ProvisioningState provisioningState() { @@ -32,7 +35,7 @@ public ProvisioningState provisioningState() { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ServiceUpdate.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ServiceUpdate.java index a932027b70915..e9a3b6484cf07 100644 --- a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ServiceUpdate.java +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ServiceUpdate.java @@ -4,49 +4,83 @@ package com.azure.resourcemanager.apicenter.models; -import com.azure.core.annotation.Immutable; -import com.azure.resourcemanager.apicenter.fluent.models.ServiceProperties; +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; -/** The service properties to be updated. */ -@Immutable +/** + * The type used for update operations of the Service. + */ +@Fluent public final class ServiceUpdate { /* - * The properties of the service. + * The managed service identities assigned to this resource. */ - @JsonProperty(value = "properties") - private ServiceProperties innerProperties; + @JsonProperty(value = "identity") + private ManagedServiceIdentity identity; - /** Creates an instance of ServiceUpdate class. */ + /* + * Resource tags. + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /** + * Creates an instance of ServiceUpdate class. + */ public ServiceUpdate() { } /** - * Get the innerProperties property: The properties of the service. - * - * @return the innerProperties value. + * Get the identity property: The managed service identities assigned to this resource. + * + * @return the identity value. + */ + public ManagedServiceIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: The managed service identities assigned to this resource. + * + * @param identity the identity value to set. + * @return the ServiceUpdate object itself. + */ + public ServiceUpdate withIdentity(ManagedServiceIdentity identity) { + this.identity = identity; + return this; + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. */ - private ServiceProperties innerProperties() { - return this.innerProperties; + public Map tags() { + return this.tags; } /** - * Get the provisioningState property: The status of the last operation. - * - * @return the provisioningState value. + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the ServiceUpdate object itself. */ - public ProvisioningState provisioningState() { - return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + public ServiceUpdate withTags(Map tags) { + this.tags = tags; + return this; } /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { - if (innerProperties() != null) { - innerProperties().validate(); + if (identity() != null) { + identity().validate(); } } } diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/Services.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/Services.java index a4f7f6ebb559c..7d754fe5a204f 100644 --- a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/Services.java +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/Services.java @@ -8,11 +8,13 @@ import com.azure.core.http.rest.Response; import com.azure.core.util.Context; -/** Resource collection API of Services. */ +/** + * Resource collection API of Services. + */ public interface Services { /** * Lists services within an Azure subscription. - * + * * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response of a Service list operation as paginated response with {@link PagedIterable}. @@ -21,7 +23,7 @@ public interface Services { /** * Lists services within an Azure subscription. - * + * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -31,8 +33,8 @@ public interface Services { PagedIterable list(Context context); /** - * Lists services within a resource group. - * + * Returns a collection of services within the resource group. + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -42,8 +44,8 @@ public interface Services { PagedIterable listByResourceGroup(String resourceGroupName); /** - * Lists services within a resource group. - * + * Returns a collection of services within the resource group. + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -54,35 +56,35 @@ public interface Services { PagedIterable listByResourceGroup(String resourceGroupName, Context context); /** - * Get service. - * + * Returns details of the service. + * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serviceName Service name. + * @param serviceName The name of Azure API Center service. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return service along with {@link Response}. + * @return the service entity along with {@link Response}. */ Response getByResourceGroupWithResponse(String resourceGroupName, String serviceName, Context context); /** - * Get service. - * + * Returns details of the service. + * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serviceName Service name. + * @param serviceName The name of Azure API Center service. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return service. + * @return the service entity. */ Service getByResourceGroup(String resourceGroupName, String serviceName); /** - * Delete service. - * + * Deletes specified service. + * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serviceName Service name. + * @param serviceName The name of Azure API Center service. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -92,10 +94,10 @@ public interface Services { Response deleteByResourceGroupWithResponse(String resourceGroupName, String serviceName, Context context); /** - * Delete service. - * + * Deletes specified service. + * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serviceName Service name. + * @param serviceName The name of Azure API Center service. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -103,31 +105,60 @@ public interface Services { void deleteByResourceGroup(String resourceGroupName, String serviceName); /** - * Get service. - * + * Exports the effective metadata schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the metadata schema export result. + */ + MetadataSchemaExportResult exportMetadataSchema(String resourceGroupName, String serviceName, + MetadataSchemaExportRequest body); + + /** + * Exports the effective metadata schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the metadata schema export result. + */ + MetadataSchemaExportResult exportMetadataSchema(String resourceGroupName, String serviceName, + MetadataSchemaExportRequest body, Context context); + + /** + * Returns details of the service. + * * @param id the resource ID. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return service along with {@link Response}. + * @return the service entity along with {@link Response}. */ Service getById(String id); /** - * Get service. - * + * Returns details of the service. + * * @param id the resource ID. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return service along with {@link Response}. + * @return the service entity along with {@link Response}. */ Response getByIdWithResponse(String id, Context context); /** - * Delete service. - * + * Deletes specified service. + * * @param id the resource ID. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -136,8 +167,8 @@ public interface Services { void deleteById(String id); /** - * Delete service. - * + * Deletes specified service. + * * @param id the resource ID. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -149,7 +180,7 @@ public interface Services { /** * Begins definition for a new Service resource. - * + * * @param name resource name. * @return the first stage of the new Service definition. */ diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/TermsOfService.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/TermsOfService.java new file mode 100644 index 0000000000000..70f03eb69fb3e --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/TermsOfService.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Terms of service for the API. + */ +@Fluent +public final class TermsOfService { + /* + * URL pointing to the terms of service. + */ + @JsonProperty(value = "url", required = true) + private String url; + + /** + * Creates an instance of TermsOfService class. + */ + public TermsOfService() { + } + + /** + * Get the url property: URL pointing to the terms of service. + * + * @return the url value. + */ + public String url() { + return this.url; + } + + /** + * Set the url property: URL pointing to the terms of service. + * + * @param url the url value to set. + * @return the TermsOfService object itself. + */ + public TermsOfService withUrl(String url) { + this.url = url; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (url() == null) { + throw LOGGER.logExceptionAsError( + new IllegalArgumentException("Missing required property url in model TermsOfService")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(TermsOfService.class); +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/UserAssignedIdentity.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/UserAssignedIdentity.java index 89945cd634e90..44555f6def421 100644 --- a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/UserAssignedIdentity.java +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/UserAssignedIdentity.java @@ -8,7 +8,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import java.util.UUID; -/** User assigned identity properties. */ +/** + * User assigned identity properties. + */ @Immutable public final class UserAssignedIdentity { /* @@ -23,13 +25,15 @@ public final class UserAssignedIdentity { @JsonProperty(value = "clientId", access = JsonProperty.Access.WRITE_ONLY) private UUID clientId; - /** Creates an instance of UserAssignedIdentity class. */ + /** + * Creates an instance of UserAssignedIdentity class. + */ public UserAssignedIdentity() { } /** * Get the principalId property: The principal ID of the assigned identity. - * + * * @return the principalId value. */ public UUID principalId() { @@ -38,7 +42,7 @@ public UUID principalId() { /** * Get the clientId property: The client ID of the assigned identity. - * + * * @return the clientId value. */ public UUID clientId() { @@ -47,7 +51,7 @@ public UUID clientId() { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/Workspace.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/Workspace.java new file mode 100644 index 0000000000000..6e69cfe9c5c08 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/Workspace.java @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.apicenter.fluent.models.WorkspaceInner; + +/** + * An immutable client-side representation of Workspace. + */ +public interface Workspace { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + WorkspaceProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.apicenter.fluent.models.WorkspaceInner object. + * + * @return the inner object. + */ + WorkspaceInner innerModel(); + + /** + * The entirety of the Workspace definition. + */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + + /** + * The Workspace definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the Workspace definition. + */ + interface Blank extends WithParentResource { + } + + /** + * The stage of the Workspace definition allowing to specify parent resource. + */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serviceName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @return the next definition stage. + */ + WithCreate withExistingService(String resourceGroupName, String serviceName); + } + + /** + * The stage of the Workspace definition which contains all the minimum required properties for the resource to + * be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + Workspace create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Workspace create(Context context); + } + + /** + * The stage of the Workspace definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + WithCreate withProperties(WorkspaceProperties properties); + } + } + + /** + * Begins update for the Workspace resource. + * + * @return the stage of resource update. + */ + Workspace.Update update(); + + /** + * The template for Workspace update. + */ + interface Update { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Workspace apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Workspace apply(Context context); + } + + /** + * The Workspace update stages. + */ + interface UpdateStages { + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + Workspace refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Workspace refresh(Context context); +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/WorkspaceListResult.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/WorkspaceListResult.java new file mode 100644 index 0000000000000..ebf36901f5ccb --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/WorkspaceListResult.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.apicenter.fluent.models.WorkspaceInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * The response of a Workspace list operation. + */ +@Immutable +public final class WorkspaceListResult { + /* + * The Workspace items on this page + */ + @JsonProperty(value = "value", required = true, access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * The link to the next page of items + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Creates an instance of WorkspaceListResult class. + */ + public WorkspaceListResult() { + } + + /** + * Get the value property: The Workspace items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/WorkspaceProperties.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/WorkspaceProperties.java new file mode 100644 index 0000000000000..f337955c231d6 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/WorkspaceProperties.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Workspace properties. + */ +@Fluent +public final class WorkspaceProperties { + /* + * Workspace title. + */ + @JsonProperty(value = "title", required = true) + private String title; + + /* + * Workspace description. + */ + @JsonProperty(value = "description") + private String description; + + /** + * Creates an instance of WorkspaceProperties class. + */ + public WorkspaceProperties() { + } + + /** + * Get the title property: Workspace title. + * + * @return the title value. + */ + public String title() { + return this.title; + } + + /** + * Set the title property: Workspace title. + * + * @param title the title value to set. + * @return the WorkspaceProperties object itself. + */ + public WorkspaceProperties withTitle(String title) { + this.title = title; + return this; + } + + /** + * Get the description property: Workspace description. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Workspace description. + * + * @param description the description value to set. + * @return the WorkspaceProperties object itself. + */ + public WorkspaceProperties withDescription(String description) { + this.description = description; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (title() == null) { + throw LOGGER.logExceptionAsError( + new IllegalArgumentException("Missing required property title in model WorkspaceProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(WorkspaceProperties.class); +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/Workspaces.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/Workspaces.java new file mode 100644 index 0000000000000..9f00fb3eacde5 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/Workspaces.java @@ -0,0 +1,175 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of Workspaces. + */ +public interface Workspaces { + /** + * Returns a collection of workspaces. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Workspace list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String serviceName); + + /** + * Returns a collection of workspaces. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param filter OData filter parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Workspace list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String serviceName, String filter, Context context); + + /** + * Returns details of the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workspace entity. + */ + Response getWithResponse(String resourceGroupName, String serviceName, String workspaceName, + Context context); + + /** + * Returns details of the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workspace entity. + */ + Workspace get(String resourceGroupName, String serviceName, String workspaceName); + + /** + * Deletes specified workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteWithResponse(String resourceGroupName, String serviceName, String workspaceName, + Context context); + + /** + * Deletes specified workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String serviceName, String workspaceName); + + /** + * Checks if specified workspace exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response headWithResponse(String resourceGroupName, String serviceName, String workspaceName, + Context context); + + /** + * Checks if specified workspace exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void head(String resourceGroupName, String serviceName, String workspaceName); + + /** + * Returns details of the workspace. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workspace entity. + */ + Workspace getById(String id); + + /** + * Returns details of the workspace. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workspace entity. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes specified workspace. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes specified workspace. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new Workspace resource. + * + * @param name resource name. + * @return the first stage of the new Workspace definition. + */ + Workspace.DefinitionStages.Blank define(String name); +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/WorkspacesCreateOrUpdateHeaders.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/WorkspacesCreateOrUpdateHeaders.java new file mode 100644 index 0000000000000..9c2ba3f69eee5 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/WorkspacesCreateOrUpdateHeaders.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.HttpHeaders; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The WorkspacesCreateOrUpdateHeaders model. + */ +@Fluent +public final class WorkspacesCreateOrUpdateHeaders { + /* + * The Etag property. + */ + @JsonProperty(value = "Etag") + private String etag; + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of WorkspacesCreateOrUpdateHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public WorkspacesCreateOrUpdateHeaders(HttpHeaders rawHeaders) { + this.etag = rawHeaders.getValue(HttpHeaderName.ETAG); + } + + /** + * Get the etag property: The Etag property. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** + * Set the etag property: The Etag property. + * + * @param etag the etag value to set. + * @return the WorkspacesCreateOrUpdateHeaders object itself. + */ + public WorkspacesCreateOrUpdateHeaders withEtag(String etag) { + this.etag = etag; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/WorkspacesCreateOrUpdateResponse.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/WorkspacesCreateOrUpdateResponse.java new file mode 100644 index 0000000000000..cad9b8e494516 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/WorkspacesCreateOrUpdateResponse.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; +import com.azure.resourcemanager.apicenter.fluent.models.WorkspaceInner; + +/** + * Contains all response data for the createOrUpdate operation. + */ +public final class WorkspacesCreateOrUpdateResponse + extends ResponseBase { + /** + * Creates an instance of WorkspacesCreateOrUpdateResponse. + * + * @param request the request which resulted in this WorkspacesCreateOrUpdateResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public WorkspacesCreateOrUpdateResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, + WorkspaceInner value, WorkspacesCreateOrUpdateHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } + + /** + * Gets the deserialized response body. + * + * @return the deserialized response body. + */ + @Override + public WorkspaceInner getValue() { + return super.getValue(); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/WorkspacesGetHeaders.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/WorkspacesGetHeaders.java new file mode 100644 index 0000000000000..500d80517e0e8 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/WorkspacesGetHeaders.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.HttpHeaders; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The WorkspacesGetHeaders model. + */ +@Fluent +public final class WorkspacesGetHeaders { + /* + * The Etag property. + */ + @JsonProperty(value = "Etag") + private String etag; + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of WorkspacesGetHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public WorkspacesGetHeaders(HttpHeaders rawHeaders) { + this.etag = rawHeaders.getValue(HttpHeaderName.ETAG); + } + + /** + * Get the etag property: The Etag property. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** + * Set the etag property: The Etag property. + * + * @param etag the etag value to set. + * @return the WorkspacesGetHeaders object itself. + */ + public WorkspacesGetHeaders withEtag(String etag) { + this.etag = etag; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/WorkspacesGetResponse.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/WorkspacesGetResponse.java new file mode 100644 index 0000000000000..56607a6850ac9 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/WorkspacesGetResponse.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; +import com.azure.resourcemanager.apicenter.fluent.models.WorkspaceInner; + +/** + * Contains all response data for the get operation. + */ +public final class WorkspacesGetResponse extends ResponseBase { + /** + * Creates an instance of WorkspacesGetResponse. + * + * @param request the request which resulted in this WorkspacesGetResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public WorkspacesGetResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, WorkspaceInner value, + WorkspacesGetHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } + + /** + * Gets the deserialized response body. + * + * @return the deserialized response body. + */ + @Override + public WorkspaceInner getValue() { + return super.getValue(); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/package-info.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/package-info.java index 0474f53c4aa7a..5fb117f6d7251 100644 --- a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/package-info.java +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/package-info.java @@ -2,5 +2,8 @@ // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. -/** Package containing the data models for AzureApiCenter. Azure API Center Resource Provider. */ +/** + * Package containing the data models for AzureApiCenter. + * Azure API Center Resource Provider. + */ package com.azure.resourcemanager.apicenter.models; diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/package-info.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/package-info.java index e71f322a5c4ba..5a147e28cc34e 100644 --- a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/package-info.java +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/package-info.java @@ -2,5 +2,8 @@ // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. -/** Package containing the classes for AzureApiCenter. Azure API Center Resource Provider. */ +/** + * Package containing the classes for AzureApiCenter. + * Azure API Center Resource Provider. + */ package com.azure.resourcemanager.apicenter; diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/module-info.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/module-info.java index cdc22f9564e62..b44b0e69d3cf4 100644 --- a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/module-info.java +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/module-info.java @@ -4,16 +4,10 @@ module com.azure.resourcemanager.apicenter { requires transitive com.azure.core.management; - exports com.azure.resourcemanager.apicenter; exports com.azure.resourcemanager.apicenter.fluent; exports com.azure.resourcemanager.apicenter.fluent.models; exports com.azure.resourcemanager.apicenter.models; - - opens com.azure.resourcemanager.apicenter.fluent.models to - com.azure.core, - com.fasterxml.jackson.databind; - opens com.azure.resourcemanager.apicenter.models to - com.azure.core, - com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.apicenter.fluent.models to com.azure.core, com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.apicenter.models to com.azure.core, com.fasterxml.jackson.databind; } diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-apicenter/proxy-config.json b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-apicenter/proxy-config.json new file mode 100644 index 0000000000000..453cca952b5d4 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-apicenter/proxy-config.json @@ -0,0 +1 @@ +[ [ "com.azure.resourcemanager.apicenter.implementation.OperationsClientImpl$OperationsService" ], [ "com.azure.resourcemanager.apicenter.implementation.ServicesClientImpl$ServicesService" ], [ "com.azure.resourcemanager.apicenter.implementation.MetadataSchemasClientImpl$MetadataSchemasService" ], [ "com.azure.resourcemanager.apicenter.implementation.WorkspacesClientImpl$WorkspacesService" ], [ "com.azure.resourcemanager.apicenter.implementation.ApisClientImpl$ApisService" ], [ "com.azure.resourcemanager.apicenter.implementation.DeploymentsClientImpl$DeploymentsService" ], [ "com.azure.resourcemanager.apicenter.implementation.ApiVersionsClientImpl$ApiVersionsService" ], [ "com.azure.resourcemanager.apicenter.implementation.ApiDefinitionsClientImpl$ApiDefinitionsService" ], [ "com.azure.resourcemanager.apicenter.implementation.EnvironmentsClientImpl$EnvironmentsService" ] ] \ No newline at end of file diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-apicenter/reflect-config.json b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-apicenter/reflect-config.json new file mode 100644 index 0000000000000..796944961bb07 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-apicenter/reflect-config.json @@ -0,0 +1,356 @@ +[ { + "name" : "com.azure.resourcemanager.apicenter.models.OperationListResult", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.apicenter.fluent.models.OperationInner", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.apicenter.models.OperationDisplay", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.apicenter.models.ServiceListResult", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.apicenter.fluent.models.ServiceInner", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.apicenter.models.ServiceProperties", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.apicenter.models.ManagedServiceIdentity", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.apicenter.models.UserAssignedIdentity", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.apicenter.models.ServiceUpdate", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.apicenter.models.MetadataSchemaExportRequest", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.apicenter.fluent.models.MetadataSchemaExportResultInner", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.apicenter.models.MetadataSchemaListResult", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.apicenter.fluent.models.MetadataSchemaInner", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.apicenter.models.MetadataSchemaProperties", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.apicenter.models.MetadataAssignment", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.apicenter.models.WorkspaceListResult", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.apicenter.fluent.models.WorkspaceInner", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.apicenter.models.WorkspaceProperties", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.apicenter.models.ApiListResult", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.apicenter.fluent.models.ApiInner", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.apicenter.models.ApiProperties", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.apicenter.models.TermsOfService", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.apicenter.models.ExternalDocumentation", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.apicenter.models.Contact", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.apicenter.models.License", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.apicenter.models.DeploymentListResult", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.apicenter.fluent.models.DeploymentInner", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.apicenter.models.DeploymentProperties", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.apicenter.models.DeploymentServer", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.apicenter.models.ApiVersionListResult", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.apicenter.fluent.models.ApiVersionInner", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.apicenter.models.ApiVersionProperties", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.apicenter.models.ApiDefinitionListResult", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.apicenter.fluent.models.ApiDefinitionInner", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.apicenter.models.ApiDefinitionProperties", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.apicenter.models.ApiDefinitionPropertiesSpecification", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.apicenter.fluent.models.ApiSpecExportResultInner", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.apicenter.models.ApiSpecImportRequest", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.apicenter.models.ApiSpecImportRequestSpecification", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.apicenter.models.EnvironmentListResult", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.apicenter.fluent.models.EnvironmentInner", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.apicenter.models.EnvironmentProperties", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.apicenter.models.EnvironmentServer", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.apicenter.models.Onboarding", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.apicenter.models.MetadataSchemasGetHeaders", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.apicenter.models.MetadataSchemasCreateOrUpdateHeaders", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.apicenter.models.WorkspacesGetHeaders", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.apicenter.models.WorkspacesCreateOrUpdateHeaders", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.apicenter.models.ApisGetHeaders", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.apicenter.models.ApisCreateOrUpdateHeaders", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.apicenter.models.DeploymentsGetHeaders", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.apicenter.models.DeploymentsCreateOrUpdateHeaders", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.apicenter.models.ApiVersionsGetHeaders", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.apicenter.models.ApiVersionsCreateOrUpdateHeaders", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.apicenter.models.ApiDefinitionsGetHeaders", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.apicenter.models.ApiDefinitionsCreateOrUpdateHeaders", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.apicenter.models.EnvironmentsGetHeaders", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.apicenter.models.EnvironmentsCreateOrUpdateHeaders", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.apicenter.models.Origin", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.apicenter.models.ActionType", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.apicenter.models.ProvisioningState", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.apicenter.models.ManagedServiceIdentityType", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.apicenter.models.MetadataAssignmentEntity", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.apicenter.models.MetadataSchemaExportFormat", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.apicenter.models.ApiKind", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.apicenter.models.LifecycleStage", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.apicenter.models.DeploymentState", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.apicenter.models.ApiSpecExportResultFormat", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.apicenter.models.ApiSpecImportSourceFormat", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.apicenter.models.EnvironmentKind", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.apicenter.models.EnvironmentServerType", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +} ] \ No newline at end of file diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ApiDefinitionsCreateOrUpdateSamples.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ApiDefinitionsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..e33d81aa2470c --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ApiDefinitionsCreateOrUpdateSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +/** + * Samples for ApiDefinitions CreateOrUpdate. + */ +public final class ApiDefinitionsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/ + * ApiDefinitions_CreateOrUpdate.json + */ + /** + * Sample code: ApiDefinitions_CreateOrUpdate. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void apiDefinitionsCreateOrUpdate(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { + manager.apiDefinitions().define("openapi") + .withExistingVersion("contoso-resources", "contoso", "default", "openapi", "2023-01-01").create(); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ApiDefinitionsDeleteSamples.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ApiDefinitionsDeleteSamples.java new file mode 100644 index 0000000000000..6ce662a75ed51 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ApiDefinitionsDeleteSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +/** + * Samples for ApiDefinitions Delete. + */ +public final class ApiDefinitionsDeleteSamples { + /* + * x-ms-original-file: + * specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/ApiDefinitions_Delete. + * json + */ + /** + * Sample code: ApiDefinitions_Delete. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void apiDefinitionsDelete(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { + manager.apiDefinitions().deleteWithResponse("contoso-resources", "contoso", "default", "echo-api", "2023-01-01", + "openapi", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ApiDefinitionsExportSpecificationSamples.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ApiDefinitionsExportSpecificationSamples.java new file mode 100644 index 0000000000000..4ec49680ed32b --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ApiDefinitionsExportSpecificationSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +/** + * Samples for ApiDefinitions ExportSpecification. + */ +public final class ApiDefinitionsExportSpecificationSamples { + /* + * x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/ + * ApiDefinitions_ExportSpecification.json + */ + /** + * Sample code: ApiDefinitions_ExportSpecification. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void apiDefinitionsExportSpecification(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { + manager.apiDefinitions().exportSpecification("contoso-resources", "contoso", "default", "echo-api", + "2023-01-01", "openapi", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ApiDefinitionsGetSamples.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ApiDefinitionsGetSamples.java new file mode 100644 index 0000000000000..fff12abee7ae5 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ApiDefinitionsGetSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +/** + * Samples for ApiDefinitions Get. + */ +public final class ApiDefinitionsGetSamples { + /* + * x-ms-original-file: + * specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/ApiDefinitions_Get.json + */ + /** + * Sample code: ApiDefinitions_Get. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void apiDefinitionsGet(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { + manager.apiDefinitions().getWithResponse("contoso-resources", "contoso", "default", "echo-api", "2023-01-01", + "openapi", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ApiDefinitionsHeadSamples.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ApiDefinitionsHeadSamples.java new file mode 100644 index 0000000000000..6a7d3b82c763c --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ApiDefinitionsHeadSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +/** + * Samples for ApiDefinitions Head. + */ +public final class ApiDefinitionsHeadSamples { + /* + * x-ms-original-file: + * specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/ApiDefinitions_Head.json + */ + /** + * Sample code: ApiDefinitions_Head. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void apiDefinitionsHead(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { + manager.apiDefinitions().headWithResponse("contoso-resources", "contoso", "default", "echo-api", "2023-01-01", + "openapi", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ApiDefinitionsImportSpecificationSamples.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ApiDefinitionsImportSpecificationSamples.java new file mode 100644 index 0000000000000..43119f06f293b --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ApiDefinitionsImportSpecificationSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +/** + * Samples for ApiDefinitions ImportSpecification. + */ +public final class ApiDefinitionsImportSpecificationSamples { + /* + * x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/ + * ApiDefinitions_ImportSpecification.json + */ + /** + * Sample code: ApiDefinitions_ImportSpecification. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void apiDefinitionsImportSpecification(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { + manager.apiDefinitions().importSpecification("contoso-resources", "contoso", "default", "echo-api", + "2023-01-01", "openapi", null, com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ApiDefinitionsListSamples.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ApiDefinitionsListSamples.java new file mode 100644 index 0000000000000..40aa7ace7e7d6 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ApiDefinitionsListSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +/** + * Samples for ApiDefinitions List. + */ +public final class ApiDefinitionsListSamples { + /* + * x-ms-original-file: + * specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/ApiDefinitions_List.json + */ + /** + * Sample code: ApiDefinitions_ListByApiVersion. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void apiDefinitionsListByApiVersion(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { + manager.apiDefinitions().list("contoso-resources", "contoso", "default", "echo-api", "2023-01-01", null, + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ApiVersionsCreateOrUpdateSamples.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ApiVersionsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..e4d35328dd954 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ApiVersionsCreateOrUpdateSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +/** + * Samples for ApiVersions CreateOrUpdate. + */ +public final class ApiVersionsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/ + * ApiVersions_CreateOrUpdate.json + */ + /** + * Sample code: ApiVersions_CreateOrUpdate. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void apiVersionsCreateOrUpdate(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { + manager.apiVersions().define("2023-01-01") + .withExistingApi("contoso-resources", "contoso", "default", "echo-api").create(); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ApiVersionsDeleteSamples.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ApiVersionsDeleteSamples.java new file mode 100644 index 0000000000000..79569c420fda7 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ApiVersionsDeleteSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +/** + * Samples for ApiVersions Delete. + */ +public final class ApiVersionsDeleteSamples { + /* + * x-ms-original-file: + * specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/ApiVersions_Delete.json + */ + /** + * Sample code: ApiVersions_Delete. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void apiVersionsDelete(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { + manager.apiVersions().deleteWithResponse("contoso-resources", "contoso", "default", "echo-api", "2023-01-01", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ApiVersionsGetSamples.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ApiVersionsGetSamples.java new file mode 100644 index 0000000000000..3887b093f6376 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ApiVersionsGetSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +/** + * Samples for ApiVersions Get. + */ +public final class ApiVersionsGetSamples { + /* + * x-ms-original-file: + * specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/ApiVersions_Get.json + */ + /** + * Sample code: ApiVersions_Get. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void apiVersionsGet(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { + manager.apiVersions().getWithResponse("contoso-resources", "contoso", "default", "echo-api", "2023-01-01", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ApiVersionsHeadSamples.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ApiVersionsHeadSamples.java new file mode 100644 index 0000000000000..e8b999ac47f73 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ApiVersionsHeadSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +/** + * Samples for ApiVersions Head. + */ +public final class ApiVersionsHeadSamples { + /* + * x-ms-original-file: + * specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/ApiVersions_Head.json + */ + /** + * Sample code: ApiVersions_Head. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void apiVersionsHead(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { + manager.apiVersions().headWithResponse("contoso-resources", "contoso", "default", "echo-api", "2023-01-01", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ApiVersionsListSamples.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ApiVersionsListSamples.java new file mode 100644 index 0000000000000..5e35462666db6 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ApiVersionsListSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +/** + * Samples for ApiVersions List. + */ +public final class ApiVersionsListSamples { + /* + * x-ms-original-file: + * specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/ApiVersions_List.json + */ + /** + * Sample code: ApiVersions_ListByApi. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void apiVersionsListByApi(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { + manager.apiVersions().list("contoso-resources", "contoso", "default", "echo-api", null, + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ApisCreateOrUpdateSamples.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ApisCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..fbf5fb6cad4cf --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ApisCreateOrUpdateSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +/** + * Samples for Apis CreateOrUpdate. + */ +public final class ApisCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Apis_CreateOrUpdate.json + */ + /** + * Sample code: Apis_CreateOrUpdate. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void apisCreateOrUpdate(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { + manager.apis().define("echo-api").withExistingWorkspace("contoso-resources", "contoso", "default").create(); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ApisDeleteSamples.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ApisDeleteSamples.java new file mode 100644 index 0000000000000..ccd48bd1553be --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ApisDeleteSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +/** + * Samples for Apis Delete. + */ +public final class ApisDeleteSamples { + /* + * x-ms-original-file: + * specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Apis_Delete.json + */ + /** + * Sample code: Apis_Delete. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void apisDelete(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { + manager.apis().deleteWithResponse("contoso-resources", "contoso", "default", "echo-api", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ApisGetSamples.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ApisGetSamples.java new file mode 100644 index 0000000000000..766eccae40be5 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ApisGetSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +/** + * Samples for Apis Get. + */ +public final class ApisGetSamples { + /* + * x-ms-original-file: + * specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Apis_Get.json + */ + /** + * Sample code: Apis_Get. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void apisGet(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { + manager.apis().getWithResponse("contoso-resources", "contoso", "default", "echo-api", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ApisHeadSamples.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ApisHeadSamples.java new file mode 100644 index 0000000000000..4e9daf18cc4b1 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ApisHeadSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +/** + * Samples for Apis Head. + */ +public final class ApisHeadSamples { + /* + * x-ms-original-file: + * specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Apis_Head.json + */ + /** + * Sample code: Apis_Head. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void apisHead(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { + manager.apis().headWithResponse("contoso-resources", "contoso", "default", "echo-api", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ApisListSamples.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ApisListSamples.java new file mode 100644 index 0000000000000..2ab53372c9856 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ApisListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +/** + * Samples for Apis List. + */ +public final class ApisListSamples { + /* + * x-ms-original-file: + * specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Apis_List.json + */ + /** + * Sample code: Apis_ListByWorkspace. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void apisListByWorkspace(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { + manager.apis().list("contoso-resources", "contoso", "default", null, com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/DeploymentsCreateOrUpdateSamples.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/DeploymentsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..01053a1ff6997 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/DeploymentsCreateOrUpdateSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +/** + * Samples for Deployments CreateOrUpdate. + */ +public final class DeploymentsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/ + * Deployments_CreateOrUpdate.json + */ + /** + * Sample code: Deployments_CreateOrUpdate. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void deploymentsCreateOrUpdate(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { + manager.deployments().define("production") + .withExistingApi("contoso-resources", "contoso", "default", "echo-api").create(); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/DeploymentsDeleteSamples.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/DeploymentsDeleteSamples.java new file mode 100644 index 0000000000000..56a2e181ed302 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/DeploymentsDeleteSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +/** + * Samples for Deployments Delete. + */ +public final class DeploymentsDeleteSamples { + /* + * x-ms-original-file: + * specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Deployments_Delete.json + */ + /** + * Sample code: Deployments_Delete. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void deploymentsDelete(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { + manager.deployments().deleteWithResponse("contoso-resources", "contoso", "default", "echo-api", "production", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/DeploymentsGetSamples.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/DeploymentsGetSamples.java new file mode 100644 index 0000000000000..e6d0401194d1e --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/DeploymentsGetSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +/** + * Samples for Deployments Get. + */ +public final class DeploymentsGetSamples { + /* + * x-ms-original-file: + * specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Deployments_Get.json + */ + /** + * Sample code: Deployments_Get. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void deploymentsGet(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { + manager.deployments().getWithResponse("contoso-resources", "contoso", "default", "echo-api", "production", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/DeploymentsHeadSamples.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/DeploymentsHeadSamples.java new file mode 100644 index 0000000000000..5ae3014246f2f --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/DeploymentsHeadSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +/** + * Samples for Deployments Head. + */ +public final class DeploymentsHeadSamples { + /* + * x-ms-original-file: + * specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Deployments_Head.json + */ + /** + * Sample code: Deployments_Head. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void deploymentsHead(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { + manager.deployments().headWithResponse("contoso-resources", "contoso", "default", "echo-api", "production", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/DeploymentsListSamples.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/DeploymentsListSamples.java new file mode 100644 index 0000000000000..6ada05f145c5c --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/DeploymentsListSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +/** + * Samples for Deployments List. + */ +public final class DeploymentsListSamples { + /* + * x-ms-original-file: + * specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Deployments_List.json + */ + /** + * Sample code: Deployments_ListByApi. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void deploymentsListByApi(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { + manager.deployments().list("contoso-resources", "contoso", "default", "echo-api", null, + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/EnvironmentsCreateOrUpdateSamples.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/EnvironmentsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..71e04705b8379 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/EnvironmentsCreateOrUpdateSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +/** + * Samples for Environments CreateOrUpdate. + */ +public final class EnvironmentsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/ + * Environments_CreateOrUpdate.json + */ + /** + * Sample code: Environments_CreateOrUpdate. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void environmentsCreateOrUpdate(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { + manager.environments().define("public").withExistingWorkspace("contoso-resources", "contoso", "default") + .create(); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/EnvironmentsDeleteSamples.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/EnvironmentsDeleteSamples.java new file mode 100644 index 0000000000000..e699114bad36d --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/EnvironmentsDeleteSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +/** + * Samples for Environments Delete. + */ +public final class EnvironmentsDeleteSamples { + /* + * x-ms-original-file: + * specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Environments_Delete.json + */ + /** + * Sample code: Environments_Delete. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void environmentsDelete(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { + manager.environments().deleteWithResponse("contoso-resources", "contoso", "default", "public", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/EnvironmentsGetSamples.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/EnvironmentsGetSamples.java new file mode 100644 index 0000000000000..a228154ef968e --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/EnvironmentsGetSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +/** + * Samples for Environments Get. + */ +public final class EnvironmentsGetSamples { + /* + * x-ms-original-file: + * specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Environments_Get.json + */ + /** + * Sample code: Environments_Get. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void environmentsGet(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { + manager.environments().getWithResponse("contoso-resources", "contoso", "default", "public", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/EnvironmentsHeadSamples.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/EnvironmentsHeadSamples.java new file mode 100644 index 0000000000000..8b2a242c852f5 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/EnvironmentsHeadSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +/** + * Samples for Environments Head. + */ +public final class EnvironmentsHeadSamples { + /* + * x-ms-original-file: + * specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Environments_Head.json + */ + /** + * Sample code: Environments_Head. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void environmentsHead(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { + manager.environments().headWithResponse("contoso-resources", "contoso", "default", "public", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/EnvironmentsListSamples.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/EnvironmentsListSamples.java new file mode 100644 index 0000000000000..f22f16ae00ff1 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/EnvironmentsListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +/** + * Samples for Environments List. + */ +public final class EnvironmentsListSamples { + /* + * x-ms-original-file: + * specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Environments_List.json + */ + /** + * Sample code: Environments_ListByWorkspace. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void environmentsListByWorkspace(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { + manager.environments().list("contoso-resources", "contoso", "default", null, com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/MetadataSchemasCreateOrUpdateSamples.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/MetadataSchemasCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..d6c35356fb6b0 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/MetadataSchemasCreateOrUpdateSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +/** + * Samples for MetadataSchemas CreateOrUpdate. + */ +public final class MetadataSchemasCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/ + * MetadataSchemas_CreateOrUpdate.json + */ + /** + * Sample code: MetadataSchemas_CreateOrUpdate. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void metadataSchemasCreateOrUpdate(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { + manager.metadataSchemas().define("author").withExistingService("contoso-resources", "contoso").create(); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/MetadataSchemasDeleteSamples.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/MetadataSchemasDeleteSamples.java new file mode 100644 index 0000000000000..472c162abf21f --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/MetadataSchemasDeleteSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +/** + * Samples for MetadataSchemas Delete. + */ +public final class MetadataSchemasDeleteSamples { + /* + * x-ms-original-file: + * specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/MetadataSchemas_Delete. + * json + */ + /** + * Sample code: MetadataSchemas_Delete. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void metadataSchemasDelete(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { + manager.metadataSchemas().deleteWithResponse("contoso-resources", "contoso", "author", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/MetadataSchemasGetSamples.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/MetadataSchemasGetSamples.java new file mode 100644 index 0000000000000..54e358144076b --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/MetadataSchemasGetSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +/** + * Samples for MetadataSchemas Get. + */ +public final class MetadataSchemasGetSamples { + /* + * x-ms-original-file: + * specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/MetadataSchemas_Get.json + */ + /** + * Sample code: MetadataSchemas_Get. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void metadataSchemasGet(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { + manager.metadataSchemas().getWithResponse("contoso-resources", "contoso", "lastName", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/MetadataSchemasHeadSamples.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/MetadataSchemasHeadSamples.java new file mode 100644 index 0000000000000..e1c379e39c038 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/MetadataSchemasHeadSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +/** + * Samples for MetadataSchemas Head. + */ +public final class MetadataSchemasHeadSamples { + /* + * x-ms-original-file: + * specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/MetadataSchemas_Head.json + */ + /** + * Sample code: MetadataSchemas_Head. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void metadataSchemasHead(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { + manager.metadataSchemas().headWithResponse("contoso-resources", "contoso", "author", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/MetadataSchemasListSamples.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/MetadataSchemasListSamples.java new file mode 100644 index 0000000000000..16e229dd93fd3 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/MetadataSchemasListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +/** + * Samples for MetadataSchemas List. + */ +public final class MetadataSchemasListSamples { + /* + * x-ms-original-file: + * specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/MetadataSchemas_List.json + */ + /** + * Sample code: MetadataSchemas_ListByService. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void metadataSchemasListByService(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { + manager.metadataSchemas().list("contoso-resources", "contoso", null, com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/OperationsListSamples.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/OperationsListSamples.java index 1b5c42cc5034f..e33c057e701cd 100644 --- a/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/OperationsListSamples.java +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/OperationsListSamples.java @@ -4,17 +4,20 @@ package com.azure.resourcemanager.apicenter.generated; -/** Samples for Operations List. */ +/** + * Samples for Operations List. + */ public final class OperationsListSamples { /* - * x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/preview/2023-07-01-preview/examples/Operations_List.json + * x-ms-original-file: + * specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Operations_List.json */ /** - * Sample code: Operations_List. - * + * Sample code: List Provider Operations. + * * @param manager Entry point to ApiCenterManager. */ - public static void operationsList(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { + public static void listProviderOperations(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { manager.operations().list(com.azure.core.util.Context.NONE); } } diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ServicesCreateOrUpdateSamples.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ServicesCreateOrUpdateSamples.java index f769aa19f567b..33c5a3ad22f94 100644 --- a/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ServicesCreateOrUpdateSamples.java +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ServicesCreateOrUpdateSamples.java @@ -4,22 +4,47 @@ package com.azure.resourcemanager.apicenter.generated; -/** Samples for Services CreateOrUpdate. */ +import com.azure.resourcemanager.apicenter.models.ManagedServiceIdentity; +import com.azure.resourcemanager.apicenter.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.apicenter.models.ServiceProperties; +import com.azure.resourcemanager.apicenter.models.UserAssignedIdentity; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Services CreateOrUpdate. + */ public final class ServicesCreateOrUpdateSamples { /* - * x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/preview/2023-07-01-preview/examples/Services_CreateOrUpdate.json + * x-ms-original-file: + * specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Services_CreateOrUpdate. + * json */ /** - * Sample code: Services_Create. - * + * Sample code: Services_CreateOrUpdate. + * * @param manager Entry point to ApiCenterManager. */ - public static void servicesCreate(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { - manager - .services() - .define("contoso") - .withRegion((String) null) - .withExistingResourceGroup("contoso-resources") + public static void servicesCreateOrUpdate(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { + manager.services().define("contoso").withRegion("East US").withExistingResourceGroup("contoso-resources") + .withTags(mapOf()).withProperties(new ServiceProperties()) + .withIdentity(new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.fromString("SystemAssigned, UserAssigned")) + .withUserAssignedIdentities(mapOf( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso-resources/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-identity", + new UserAssignedIdentity()))) .create(); } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } } diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ServicesDeleteSamples.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ServicesDeleteSamples.java index 13a5aa6096c9d..7b1302530ebf6 100644 --- a/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ServicesDeleteSamples.java +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ServicesDeleteSamples.java @@ -4,19 +4,21 @@ package com.azure.resourcemanager.apicenter.generated; -/** Samples for Services Delete. */ +/** + * Samples for Services Delete. + */ public final class ServicesDeleteSamples { /* - * x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/preview/2023-07-01-preview/examples/Services_Delete.json + * x-ms-original-file: + * specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Services_Delete.json */ /** * Sample code: Services_Delete. - * + * * @param manager Entry point to ApiCenterManager. */ public static void servicesDelete(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { - manager - .services() - .deleteByResourceGroupWithResponse("contoso-resources", "contoso", com.azure.core.util.Context.NONE); + manager.services().deleteByResourceGroupWithResponse("contoso-resources", "contoso", + com.azure.core.util.Context.NONE); } } diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ServicesExportMetadataSchemaSamples.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ServicesExportMetadataSchemaSamples.java new file mode 100644 index 0000000000000..88952118a994a --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ServicesExportMetadataSchemaSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +/** + * Samples for Services ExportMetadataSchema. + */ +public final class ServicesExportMetadataSchemaSamples { + /* + * x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/ + * Services_ExportMetadataSchema.json + */ + /** + * Sample code: Services_ExportMetadataSchema. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void servicesExportMetadataSchema(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { + manager.services().exportMetadataSchema("contoso-resources", "contoso", null, com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ServicesGetByResourceGroupSamples.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ServicesGetByResourceGroupSamples.java index 9482a38ad7c91..90af95fbc170c 100644 --- a/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ServicesGetByResourceGroupSamples.java +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ServicesGetByResourceGroupSamples.java @@ -4,19 +4,21 @@ package com.azure.resourcemanager.apicenter.generated; -/** Samples for Services GetByResourceGroup. */ +/** + * Samples for Services GetByResourceGroup. + */ public final class ServicesGetByResourceGroupSamples { /* - * x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/preview/2023-07-01-preview/examples/Services_Get.json + * x-ms-original-file: + * specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Services_Get.json */ /** * Sample code: Services_Get. - * + * * @param manager Entry point to ApiCenterManager. */ public static void servicesGet(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { - manager - .services() - .getByResourceGroupWithResponse("contoso-resources", "contoso", com.azure.core.util.Context.NONE); + manager.services().getByResourceGroupWithResponse("contoso-resources", "contoso", + com.azure.core.util.Context.NONE); } } diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ServicesListByResourceGroupSamples.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ServicesListByResourceGroupSamples.java index 7a60acffdd81d..8f7db0d7d144e 100644 --- a/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ServicesListByResourceGroupSamples.java +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ServicesListByResourceGroupSamples.java @@ -4,14 +4,17 @@ package com.azure.resourcemanager.apicenter.generated; -/** Samples for Services ListByResourceGroup. */ +/** + * Samples for Services ListByResourceGroup. + */ public final class ServicesListByResourceGroupSamples { /* - * x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/preview/2023-07-01-preview/examples/Services_ListByResourceGroup.json + * x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/ + * Services_ListByResourceGroup.json */ /** * Sample code: Services_ListByResourceGroup. - * + * * @param manager Entry point to ApiCenterManager. */ public static void servicesListByResourceGroup(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ServicesListSamples.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ServicesListSamples.java index 1774a1b5159c6..65c377a277d1d 100644 --- a/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ServicesListSamples.java +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ServicesListSamples.java @@ -4,14 +4,17 @@ package com.azure.resourcemanager.apicenter.generated; -/** Samples for Services List. */ +/** + * Samples for Services List. + */ public final class ServicesListSamples { /* - * x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/preview/2023-07-01-preview/examples/Services_ListBySubscription.json + * x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/ + * Services_ListBySubscription.json */ /** * Sample code: Services_ListBySubscription. - * + * * @param manager Entry point to ApiCenterManager. */ public static void servicesListBySubscription(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ServicesUpdateSamples.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ServicesUpdateSamples.java index 7a0fd20f42206..2a7c11d15ce9e 100644 --- a/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ServicesUpdateSamples.java +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ServicesUpdateSamples.java @@ -6,22 +6,23 @@ import com.azure.resourcemanager.apicenter.models.Service; -/** Samples for Services Update. */ +/** + * Samples for Services Update. + */ public final class ServicesUpdateSamples { /* - * x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/preview/2023-07-01-preview/examples/Services_Update.json + * x-ms-original-file: + * specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Services_Update.json */ /** * Sample code: Services_Update. - * + * * @param manager Entry point to ApiCenterManager. */ public static void servicesUpdate(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { - Service resource = - manager - .services() - .getByResourceGroupWithResponse("contoso-resources", "contoso", com.azure.core.util.Context.NONE) - .getValue(); + Service resource = manager.services() + .getByResourceGroupWithResponse("contoso-resources", "contoso", com.azure.core.util.Context.NONE) + .getValue(); resource.update().apply(); } } diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/WorkspacesCreateOrUpdateSamples.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/WorkspacesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..ac28e7081f0ac --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/WorkspacesCreateOrUpdateSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +/** + * Samples for Workspaces CreateOrUpdate. + */ +public final class WorkspacesCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Workspaces_CreateOrUpdate + * .json + */ + /** + * Sample code: Workspaces_CreateOrUpdate. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void workspacesCreateOrUpdate(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { + manager.workspaces().define("default").withExistingService("contoso-resources", "contoso").create(); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/WorkspacesDeleteSamples.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/WorkspacesDeleteSamples.java new file mode 100644 index 0000000000000..e9f59c5cce0c9 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/WorkspacesDeleteSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +/** + * Samples for Workspaces Delete. + */ +public final class WorkspacesDeleteSamples { + /* + * x-ms-original-file: + * specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Workspaces_Delete.json + */ + /** + * Sample code: Workspaces_Delete. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void workspacesDelete(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { + manager.workspaces().deleteWithResponse("contoso-resources", "contoso", "default", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/WorkspacesGetSamples.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/WorkspacesGetSamples.java new file mode 100644 index 0000000000000..3760f73ebb98d --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/WorkspacesGetSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +/** + * Samples for Workspaces Get. + */ +public final class WorkspacesGetSamples { + /* + * x-ms-original-file: + * specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Workspaces_Get.json + */ + /** + * Sample code: Workspaces_Get. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void workspacesGet(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { + manager.workspaces().getWithResponse("contoso-resources", "contoso", "default", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/WorkspacesHeadSamples.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/WorkspacesHeadSamples.java new file mode 100644 index 0000000000000..858c8faa61c26 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/WorkspacesHeadSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +/** + * Samples for Workspaces Head. + */ +public final class WorkspacesHeadSamples { + /* + * x-ms-original-file: + * specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Workspaces_Head.json + */ + /** + * Sample code: Workspaces_Head. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void workspacesHead(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { + manager.workspaces().headWithResponse("contoso-resources", "contoso", "default", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/WorkspacesListSamples.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/WorkspacesListSamples.java new file mode 100644 index 0000000000000..1226f3c378744 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/WorkspacesListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +/** + * Samples for Workspaces List. + */ +public final class WorkspacesListSamples { + /* + * x-ms-original-file: + * specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Workspaces_List.json + */ + /** + * Sample code: Workspaces_ListByService. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void workspacesListByService(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { + manager.workspaces().list("contoso-resources", "contoso", null, com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApiDefinitionInnerTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApiDefinitionInnerTests.java new file mode 100644 index 0000000000000..50d3935cdef73 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApiDefinitionInnerTests.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.apicenter.fluent.models.ApiDefinitionInner; +import com.azure.resourcemanager.apicenter.models.ApiDefinitionProperties; +import org.junit.jupiter.api.Assertions; + +public final class ApiDefinitionInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ApiDefinitionInner model = BinaryData.fromString( + "{\"properties\":{\"title\":\"qnermclfplphoxu\",\"description\":\"rpabg\",\"specification\":{\"name\":\"sbj\",\"version\":\"zq\"}},\"id\":\"xywpmueefjzwfqkq\",\"name\":\"jidsuyonobglaoc\",\"type\":\"xtccmg\"}") + .toObject(ApiDefinitionInner.class); + Assertions.assertEquals("qnermclfplphoxu", model.properties().title()); + Assertions.assertEquals("rpabg", model.properties().description()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ApiDefinitionInner model = new ApiDefinitionInner() + .withProperties(new ApiDefinitionProperties().withTitle("qnermclfplphoxu").withDescription("rpabg")); + model = BinaryData.fromObject(model).toObject(ApiDefinitionInner.class); + Assertions.assertEquals("qnermclfplphoxu", model.properties().title()); + Assertions.assertEquals("rpabg", model.properties().description()); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApiDefinitionListResultTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApiDefinitionListResultTests.java new file mode 100644 index 0000000000000..1ff8bc5ee1796 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApiDefinitionListResultTests.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.apicenter.models.ApiDefinitionListResult; + +public final class ApiDefinitionListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ApiDefinitionListResult model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"title\":\"sthsu\",\"description\":\"cmnyyazttb\",\"specification\":{\"name\":\"rq\",\"version\":\"edckzywbiexzfey\"}},\"id\":\"axibxujw\",\"name\":\"hqwa\",\"type\":\"muzyoxaepdk\"},{\"properties\":{\"title\":\"ancuxrhd\",\"description\":\"avxbniwdjswztsdb\",\"specification\":{\"name\":\"xytxhpzxbz\",\"version\":\"zabglcuhxwt\"}},\"id\":\"yqiklbbovplwzb\",\"name\":\"vgyuguos\",\"type\":\"mkfssxqukkfplgm\"},{\"properties\":{\"title\":\"xnkjzkdesl\",\"description\":\"lopwiyig\",\"specification\":{\"name\":\"kdwzbaiuebbaumny\",\"version\":\"ped\"}},\"id\":\"jn\",\"name\":\"bckhsmtxpsi\",\"type\":\"btfhvpesaps\"},{\"properties\":{\"title\":\"dqmh\",\"description\":\"dhtldwkyz\",\"specification\":{\"name\":\"tkncwsc\",\"version\":\"vlxotogtwrupqsx\"}},\"id\":\"micykvceoveilo\",\"name\":\"notyfjfcnjbkcn\",\"type\":\"dhbt\"}],\"nextLink\":\"phywpnvj\"}") + .toObject(ApiDefinitionListResult.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ApiDefinitionListResult model = new ApiDefinitionListResult(); + model = BinaryData.fromObject(model).toObject(ApiDefinitionListResult.class); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApiDefinitionPropertiesSpecificationTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApiDefinitionPropertiesSpecificationTests.java new file mode 100644 index 0000000000000..0e11f871900f1 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApiDefinitionPropertiesSpecificationTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.apicenter.models.ApiDefinitionPropertiesSpecification; +import org.junit.jupiter.api.Assertions; + +public final class ApiDefinitionPropertiesSpecificationTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ApiDefinitionPropertiesSpecification model + = BinaryData.fromString("{\"name\":\"ycanuzbpzkafku\",\"version\":\"crnwbmeh\"}") + .toObject(ApiDefinitionPropertiesSpecification.class); + Assertions.assertEquals("ycanuzbpzkafku", model.name()); + Assertions.assertEquals("crnwbmeh", model.version()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ApiDefinitionPropertiesSpecification model + = new ApiDefinitionPropertiesSpecification().withName("ycanuzbpzkafku").withVersion("crnwbmeh"); + model = BinaryData.fromObject(model).toObject(ApiDefinitionPropertiesSpecification.class); + Assertions.assertEquals("ycanuzbpzkafku", model.name()); + Assertions.assertEquals("crnwbmeh", model.version()); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApiDefinitionPropertiesTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApiDefinitionPropertiesTests.java new file mode 100644 index 0000000000000..fec468e5750c5 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApiDefinitionPropertiesTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.apicenter.models.ApiDefinitionProperties; +import org.junit.jupiter.api.Assertions; + +public final class ApiDefinitionPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ApiDefinitionProperties model = BinaryData.fromString( + "{\"title\":\"udxytlmoyrx\",\"description\":\"fudwpznt\",\"specification\":{\"name\":\"zhlrqjb\",\"version\":\"kfrlhrxsbky\"}}") + .toObject(ApiDefinitionProperties.class); + Assertions.assertEquals("udxytlmoyrx", model.title()); + Assertions.assertEquals("fudwpznt", model.description()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ApiDefinitionProperties model + = new ApiDefinitionProperties().withTitle("udxytlmoyrx").withDescription("fudwpznt"); + model = BinaryData.fromObject(model).toObject(ApiDefinitionProperties.class); + Assertions.assertEquals("udxytlmoyrx", model.title()); + Assertions.assertEquals("fudwpznt", model.description()); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApiDefinitionsCreateOrUpdateWithResponseMockTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApiDefinitionsCreateOrUpdateWithResponseMockTests.java new file mode 100644 index 0000000000000..5893c033c49de --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApiDefinitionsCreateOrUpdateWithResponseMockTests.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.apicenter.ApiCenterManager; +import com.azure.resourcemanager.apicenter.models.ApiDefinition; +import com.azure.resourcemanager.apicenter.models.ApiDefinitionProperties; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class ApiDefinitionsCreateOrUpdateWithResponseMockTests { + @Test + public void testCreateOrUpdateWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr + = "{\"properties\":{\"title\":\"iyujviylwdshfs\",\"description\":\"rbgyefry\",\"specification\":{\"name\":\"aojfm\",\"version\":\"cotmr\"}},\"id\":\"irctymoxoftpipiw\",\"name\":\"czuhxacpqjlihh\",\"type\":\"usps\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito.when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito.when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + ApiCenterManager manager = ApiCenterManager.configure().withHttpClient(httpClient).authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + ApiDefinition response = manager.apiDefinitions().define("ejnt") + .withExistingVersion("z", "ybycnunvj", "rtkfawnopq", "ikyzirtxdy", "x") + .withProperties( + new ApiDefinitionProperties().withTitle("ewgioilqukrydxt").withDescription("ieoxorggufhyaomt")) + .create(); + + Assertions.assertEquals("iyujviylwdshfs", response.properties().title()); + Assertions.assertEquals("rbgyefry", response.properties().description()); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApiDefinitionsDeleteWithResponseMockTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApiDefinitionsDeleteWithResponseMockTests.java new file mode 100644 index 0000000000000..804c0d54e4c22 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApiDefinitionsDeleteWithResponseMockTests.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.apicenter.ApiCenterManager; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class ApiDefinitionsDeleteWithResponseMockTests { + @Test + public void testDeleteWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = "{}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito.when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito.when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + ApiCenterManager manager = ApiCenterManager.configure().withHttpClient(httpClient).authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + manager.apiDefinitions().deleteWithResponse("lrcoolsttpki", "kkbnu", "rywvtylbfpn", "urdoi", "iithtywu", + "xcbihw", com.azure.core.util.Context.NONE); + + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApiDefinitionsExportSpecificationMockTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApiDefinitionsExportSpecificationMockTests.java new file mode 100644 index 0000000000000..6f3c65818690d --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApiDefinitionsExportSpecificationMockTests.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.apicenter.ApiCenterManager; +import com.azure.resourcemanager.apicenter.models.ApiSpecExportResult; +import com.azure.resourcemanager.apicenter.models.ApiSpecExportResultFormat; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class ApiDefinitionsExportSpecificationMockTests { + @Test + public void testExportSpecification() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = "{\"format\":\"link\",\"value\":\"asxifto\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito.when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito.when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + ApiCenterManager manager = ApiCenterManager.configure().withHttpClient(httpClient).authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + ApiSpecExportResult response = manager.apiDefinitions().exportSpecification("gseinq", "iufxqknpir", + "nepttwqmsni", "fcdmqnrojlpijn", "rxfrddhc", "atiz", com.azure.core.util.Context.NONE); + + Assertions.assertEquals(ApiSpecExportResultFormat.LINK, response.format()); + Assertions.assertEquals("asxifto", response.value()); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApiDefinitionsGetWithResponseMockTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApiDefinitionsGetWithResponseMockTests.java new file mode 100644 index 0000000000000..dae3df4ea6e39 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApiDefinitionsGetWithResponseMockTests.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.apicenter.ApiCenterManager; +import com.azure.resourcemanager.apicenter.models.ApiDefinition; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class ApiDefinitionsGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr + = "{\"properties\":{\"title\":\"lwfffi\",\"description\":\"pjpqqmtedltmmji\",\"specification\":{\"name\":\"ozphvwauyqncygu\",\"version\":\"vipmdscwxqupevzh\"}},\"id\":\"totxhojujb\",\"name\":\"pelmcuvhixbjxyf\",\"type\":\"n\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito.when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito.when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + ApiCenterManager manager = ApiCenterManager.configure().withHttpClient(httpClient).authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + ApiDefinition response = manager.apiDefinitions().getWithResponse("sxtta", "gzxnfaazpxdtnk", "mkqjj", "wuenvr", + "pyouaibrebqaays", "kixqtnqtt", com.azure.core.util.Context.NONE).getValue(); + + Assertions.assertEquals("lwfffi", response.properties().title()); + Assertions.assertEquals("pjpqqmtedltmmji", response.properties().description()); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApiDefinitionsHeadWithResponseMockTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApiDefinitionsHeadWithResponseMockTests.java new file mode 100644 index 0000000000000..22ce7b931aded --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApiDefinitionsHeadWithResponseMockTests.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.apicenter.ApiCenterManager; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class ApiDefinitionsHeadWithResponseMockTests { + @Test + public void testHeadWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = "{}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito.when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito.when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + ApiCenterManager manager = ApiCenterManager.configure().withHttpClient(httpClient).authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + manager.apiDefinitions().headWithResponse("knfd", "twjchrdg", "ihxumwctondzj", "uu", "fdlwg", "ytsbwtovv", + com.azure.core.util.Context.NONE); + + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApiDefinitionsImportSpecificationMockTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApiDefinitionsImportSpecificationMockTests.java new file mode 100644 index 0000000000000..5188855f6b0d6 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApiDefinitionsImportSpecificationMockTests.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.apicenter.ApiCenterManager; +import com.azure.resourcemanager.apicenter.models.ApiSpecImportRequest; +import com.azure.resourcemanager.apicenter.models.ApiSpecImportRequestSpecification; +import com.azure.resourcemanager.apicenter.models.ApiSpecImportSourceFormat; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class ApiDefinitionsImportSpecificationMockTests { + @Test + public void testImportSpecification() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = "{}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito.when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito.when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + ApiCenterManager manager = ApiCenterManager.configure().withHttpClient(httpClient).authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + manager.apiDefinitions().importSpecification("qyzhf", "wesgogczh", "nnxk", "lgnyhmo", "sxkkg", "h", + new ApiSpecImportRequest().withValue("gh").withFormat(ApiSpecImportSourceFormat.LINK).withSpecification( + new ApiSpecImportRequestSpecification().withName("qxvcxgfrpdsofb").withVersion("rnsvbuswd")), + com.azure.core.util.Context.NONE); + + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApiDefinitionsListMockTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApiDefinitionsListMockTests.java new file mode 100644 index 0000000000000..7c93381f5ec2c --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApiDefinitionsListMockTests.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.apicenter.ApiCenterManager; +import com.azure.resourcemanager.apicenter.models.ApiDefinition; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class ApiDefinitionsListMockTests { + @Test + public void testList() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr + = "{\"value\":[{\"properties\":{\"title\":\"slol\",\"description\":\"pvuzlmv\",\"specification\":{\"name\":\"fktgplc\",\"version\":\"wjxeznoigbr\"}},\"id\":\"w\",\"name\":\"wkpnbsaz\",\"type\":\"jjoqkagf\"}]}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito.when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito.when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + ApiCenterManager manager = ApiCenterManager.configure().withHttpClient(httpClient).authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response = manager.apiDefinitions().list("vmtgjqppy", "s", "ronzmyhgfip", "sxkm", + "waekrrjreafxtsgu", "hjglikk", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("slol", response.iterator().next().properties().title()); + Assertions.assertEquals("pvuzlmv", response.iterator().next().properties().description()); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApiInnerTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApiInnerTests.java new file mode 100644 index 0000000000000..302fbab9c67a3 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApiInnerTests.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.apicenter.fluent.models.ApiInner; +import com.azure.resourcemanager.apicenter.models.ApiKind; +import com.azure.resourcemanager.apicenter.models.ApiProperties; +import com.azure.resourcemanager.apicenter.models.Contact; +import com.azure.resourcemanager.apicenter.models.ExternalDocumentation; +import com.azure.resourcemanager.apicenter.models.License; +import com.azure.resourcemanager.apicenter.models.TermsOfService; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class ApiInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ApiInner model = BinaryData.fromString( + "{\"properties\":{\"title\":\"nj\",\"kind\":\"soap\",\"description\":\"wtgrhpdjpj\",\"summary\":\"asxazjpqyegualhb\",\"lifecycleStage\":\"testing\",\"termsOfService\":{\"url\":\"jj\"},\"externalDocumentation\":[{\"title\":\"udgwdslfho\",\"description\":\"mcy\",\"url\":\"pwlbjnpg\"}],\"contacts\":[{\"name\":\"adehxnltyfsopp\",\"url\":\"uesnzwdejbavo\",\"email\":\"zdmohctbqvu\"},{\"name\":\"xdn\",\"url\":\"vo\",\"email\":\"ujjugwdkcglh\"},{\"name\":\"azjdyggd\",\"url\":\"ixhbkuofqweykhm\",\"email\":\"evfyexfwhybcib\"},{\"name\":\"vdcsitynn\",\"url\":\"mdectehfiqscjey\",\"email\":\"hezrkgq\"}],\"license\":{\"name\":\"refovgmkqsleyyvx\",\"url\":\"jpkcattpng\",\"identifier\":\"rcczsqpjhvmd\"},\"customProperties\":\"datav\"},\"id\":\"sounqecanoaeu\",\"name\":\"fhyhltrpmopjmcma\",\"type\":\"u\"}") + .toObject(ApiInner.class); + Assertions.assertEquals("nj", model.properties().title()); + Assertions.assertEquals(ApiKind.SOAP, model.properties().kind()); + Assertions.assertEquals("wtgrhpdjpj", model.properties().description()); + Assertions.assertEquals("asxazjpqyegualhb", model.properties().summary()); + Assertions.assertEquals("jj", model.properties().termsOfService().url()); + Assertions.assertEquals("udgwdslfho", model.properties().externalDocumentation().get(0).title()); + Assertions.assertEquals("mcy", model.properties().externalDocumentation().get(0).description()); + Assertions.assertEquals("pwlbjnpg", model.properties().externalDocumentation().get(0).url()); + Assertions.assertEquals("adehxnltyfsopp", model.properties().contacts().get(0).name()); + Assertions.assertEquals("uesnzwdejbavo", model.properties().contacts().get(0).url()); + Assertions.assertEquals("zdmohctbqvu", model.properties().contacts().get(0).email()); + Assertions.assertEquals("refovgmkqsleyyvx", model.properties().license().name()); + Assertions.assertEquals("jpkcattpng", model.properties().license().url()); + Assertions.assertEquals("rcczsqpjhvmd", model.properties().license().identifier()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ApiInner model = new ApiInner().withProperties(new ApiProperties().withTitle("nj").withKind(ApiKind.SOAP) + .withDescription("wtgrhpdjpj").withSummary("asxazjpqyegualhb") + .withTermsOfService(new TermsOfService().withUrl("jj")) + .withExternalDocumentation(Arrays + .asList(new ExternalDocumentation().withTitle("udgwdslfho").withDescription("mcy").withUrl("pwlbjnpg"))) + .withContacts(Arrays.asList( + new Contact().withName("adehxnltyfsopp").withUrl("uesnzwdejbavo").withEmail("zdmohctbqvu"), + new Contact().withName("xdn").withUrl("vo").withEmail("ujjugwdkcglh"), + new Contact().withName("azjdyggd").withUrl("ixhbkuofqweykhm").withEmail("evfyexfwhybcib"), + new Contact().withName("vdcsitynn").withUrl("mdectehfiqscjey").withEmail("hezrkgq"))) + .withLicense( + new License().withName("refovgmkqsleyyvx").withUrl("jpkcattpng").withIdentifier("rcczsqpjhvmd")) + .withCustomProperties("datav")); + model = BinaryData.fromObject(model).toObject(ApiInner.class); + Assertions.assertEquals("nj", model.properties().title()); + Assertions.assertEquals(ApiKind.SOAP, model.properties().kind()); + Assertions.assertEquals("wtgrhpdjpj", model.properties().description()); + Assertions.assertEquals("asxazjpqyegualhb", model.properties().summary()); + Assertions.assertEquals("jj", model.properties().termsOfService().url()); + Assertions.assertEquals("udgwdslfho", model.properties().externalDocumentation().get(0).title()); + Assertions.assertEquals("mcy", model.properties().externalDocumentation().get(0).description()); + Assertions.assertEquals("pwlbjnpg", model.properties().externalDocumentation().get(0).url()); + Assertions.assertEquals("adehxnltyfsopp", model.properties().contacts().get(0).name()); + Assertions.assertEquals("uesnzwdejbavo", model.properties().contacts().get(0).url()); + Assertions.assertEquals("zdmohctbqvu", model.properties().contacts().get(0).email()); + Assertions.assertEquals("refovgmkqsleyyvx", model.properties().license().name()); + Assertions.assertEquals("jpkcattpng", model.properties().license().url()); + Assertions.assertEquals("rcczsqpjhvmd", model.properties().license().identifier()); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApiListResultTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApiListResultTests.java new file mode 100644 index 0000000000000..f1a2ba3336d90 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApiListResultTests.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.apicenter.models.ApiListResult; + +public final class ApiListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ApiListResult model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"title\":\"eiwaopvkmi\",\"kind\":\"graphql\",\"description\":\"mxdcufufsrp\",\"summary\":\"zidnsezcxtbzsgfy\",\"lifecycleStage\":\"development\",\"termsOfService\":{\"url\":\"ewmdw\"},\"externalDocumentation\":[{\"title\":\"ac\",\"description\":\"oosflnr\",\"url\":\"sfqpteehz\"},{\"title\":\"ypyqrimzinp\",\"description\":\"wjdk\",\"url\":\"rsoodqxhcrmnoh\"},{\"title\":\"ckwhds\",\"description\":\"fiyipjxsqwpgrj\",\"url\":\"znorcj\"},{\"title\":\"snb\",\"description\":\"qabnmoc\",\"url\":\"cyshurzafbljjgp\"}],\"contacts\":[{\"name\":\"c\",\"url\":\"klj\",\"email\":\"bqidtqaj\"}],\"license\":{\"name\":\"l\",\"url\":\"u\",\"identifier\":\"krlkhbzhfepg\"},\"customProperties\":\"dataqex\"},\"id\":\"ocxscpaierhhbcs\",\"name\":\"l\",\"type\":\"mmajtjaodx\"},{\"properties\":{\"title\":\"nbdxk\",\"kind\":\"rest\",\"description\":\"okaj\",\"summary\":\"npime\",\"lifecycleStage\":\"retired\",\"termsOfService\":{\"url\":\"xgcp\"},\"externalDocumentation\":[{\"title\":\"aajrm\",\"description\":\"jwzrl\",\"url\":\"vmclw\"},{\"title\":\"j\",\"description\":\"ejctbzaqsqsycb\",\"url\":\"bfkgukdkex\"}],\"contacts\":[{\"name\":\"fmxa\",\"url\":\"fjpgddtocjjxhvp\",\"email\":\"uexhdzx\"}],\"license\":{\"name\":\"eojnxqbzvddn\",\"url\":\"ndei\",\"identifier\":\"twnpzaoqvuhrhcf\"},\"customProperties\":\"datayd\"},\"id\":\"lmjthjq\",\"name\":\"wpyeicxmqciwqvh\",\"type\":\"hix\"},{\"properties\":{\"title\":\"gdtopbobjogh\",\"kind\":\"rest\",\"description\":\"u\",\"summary\":\"a\",\"lifecycleStage\":\"retired\",\"termsOfService\":{\"url\":\"ayvvtpgvdf\"},\"externalDocumentation\":[{\"title\":\"kftutqxlngxlefg\",\"description\":\"nxkrx\",\"url\":\"qmi\"},{\"title\":\"thz\",\"description\":\"qdrabhjybigehoqf\",\"url\":\"owskanyktz\"},{\"title\":\"u\",\"description\":\"wgqyw\",\"url\":\"ndrvynhzg\"},{\"title\":\"hrc\",\"description\":\"nc\",\"url\":\"cpecfvmmcoofs\"}],\"contacts\":[{\"name\":\"v\",\"url\":\"m\",\"email\":\"qabcypm\"},{\"name\":\"kwlzuvccfwnfn\",\"url\":\"cfionl\",\"email\":\"x\"}],\"license\":{\"name\":\"gtzxdpn\",\"url\":\"qqwx\",\"identifier\":\"feallnwsu\"},\"customProperties\":\"datasnjampmng\"},\"id\":\"scxaq\",\"name\":\"ooch\",\"type\":\"bonqvpkvlrxnjeas\"}],\"nextLink\":\"pheoflokeyy\"}") + .toObject(ApiListResult.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ApiListResult model = new ApiListResult(); + model = BinaryData.fromObject(model).toObject(ApiListResult.class); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApiPropertiesTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApiPropertiesTests.java new file mode 100644 index 0000000000000..ced7e4f8329a4 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApiPropertiesTests.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.apicenter.models.ApiKind; +import com.azure.resourcemanager.apicenter.models.ApiProperties; +import com.azure.resourcemanager.apicenter.models.Contact; +import com.azure.resourcemanager.apicenter.models.ExternalDocumentation; +import com.azure.resourcemanager.apicenter.models.License; +import com.azure.resourcemanager.apicenter.models.TermsOfService; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class ApiPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ApiProperties model = BinaryData.fromString( + "{\"title\":\"kthfui\",\"kind\":\"rest\",\"description\":\"dsfcpkvxodpuoz\",\"summary\":\"zydagfuaxbezyiuo\",\"lifecycleStage\":\"deprecated\",\"termsOfService\":{\"url\":\"hrdxwzywqsmbs\"},\"externalDocumentation\":[{\"title\":\"imoryocfsfksym\",\"description\":\"ys\",\"url\":\"kiiuxhqyudxor\"}],\"contacts\":[{\"name\":\"poczvyifqrvkdvjs\",\"url\":\"rm\",\"email\":\"d\"},{\"name\":\"atkpnp\",\"url\":\"exxbczwtr\",\"email\":\"iqzbq\"},{\"name\":\"sovmyokacspkwl\",\"url\":\"dobpxjmflbvvn\",\"email\":\"rkcciwwzjuqk\"},{\"name\":\"sa\",\"url\":\"wkuofoskghsauu\",\"email\":\"jmvxie\"}],\"license\":{\"name\":\"gidyjrrf\",\"url\":\"aos\",\"identifier\":\"xc\"},\"customProperties\":\"datanpc\"}") + .toObject(ApiProperties.class); + Assertions.assertEquals("kthfui", model.title()); + Assertions.assertEquals(ApiKind.REST, model.kind()); + Assertions.assertEquals("dsfcpkvxodpuoz", model.description()); + Assertions.assertEquals("zydagfuaxbezyiuo", model.summary()); + Assertions.assertEquals("hrdxwzywqsmbs", model.termsOfService().url()); + Assertions.assertEquals("imoryocfsfksym", model.externalDocumentation().get(0).title()); + Assertions.assertEquals("ys", model.externalDocumentation().get(0).description()); + Assertions.assertEquals("kiiuxhqyudxor", model.externalDocumentation().get(0).url()); + Assertions.assertEquals("poczvyifqrvkdvjs", model.contacts().get(0).name()); + Assertions.assertEquals("rm", model.contacts().get(0).url()); + Assertions.assertEquals("d", model.contacts().get(0).email()); + Assertions.assertEquals("gidyjrrf", model.license().name()); + Assertions.assertEquals("aos", model.license().url()); + Assertions.assertEquals("xc", model.license().identifier()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ApiProperties model = new ApiProperties().withTitle("kthfui").withKind(ApiKind.REST) + .withDescription("dsfcpkvxodpuoz").withSummary("zydagfuaxbezyiuo") + .withTermsOfService(new TermsOfService().withUrl("hrdxwzywqsmbs")) + .withExternalDocumentation(Arrays.asList( + new ExternalDocumentation().withTitle("imoryocfsfksym").withDescription("ys").withUrl("kiiuxhqyudxor"))) + .withContacts(Arrays.asList(new Contact().withName("poczvyifqrvkdvjs").withUrl("rm").withEmail("d"), + new Contact().withName("atkpnp").withUrl("exxbczwtr").withEmail("iqzbq"), + new Contact().withName("sovmyokacspkwl").withUrl("dobpxjmflbvvn").withEmail("rkcciwwzjuqk"), + new Contact().withName("sa").withUrl("wkuofoskghsauu").withEmail("jmvxie"))) + .withLicense(new License().withName("gidyjrrf").withUrl("aos").withIdentifier("xc")) + .withCustomProperties("datanpc"); + model = BinaryData.fromObject(model).toObject(ApiProperties.class); + Assertions.assertEquals("kthfui", model.title()); + Assertions.assertEquals(ApiKind.REST, model.kind()); + Assertions.assertEquals("dsfcpkvxodpuoz", model.description()); + Assertions.assertEquals("zydagfuaxbezyiuo", model.summary()); + Assertions.assertEquals("hrdxwzywqsmbs", model.termsOfService().url()); + Assertions.assertEquals("imoryocfsfksym", model.externalDocumentation().get(0).title()); + Assertions.assertEquals("ys", model.externalDocumentation().get(0).description()); + Assertions.assertEquals("kiiuxhqyudxor", model.externalDocumentation().get(0).url()); + Assertions.assertEquals("poczvyifqrvkdvjs", model.contacts().get(0).name()); + Assertions.assertEquals("rm", model.contacts().get(0).url()); + Assertions.assertEquals("d", model.contacts().get(0).email()); + Assertions.assertEquals("gidyjrrf", model.license().name()); + Assertions.assertEquals("aos", model.license().url()); + Assertions.assertEquals("xc", model.license().identifier()); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApiSpecExportResultInnerTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApiSpecExportResultInnerTests.java new file mode 100644 index 0000000000000..efd5557742ce5 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApiSpecExportResultInnerTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.apicenter.fluent.models.ApiSpecExportResultInner; +import com.azure.resourcemanager.apicenter.models.ApiSpecExportResultFormat; +import org.junit.jupiter.api.Assertions; + +public final class ApiSpecExportResultInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ApiSpecExportResultInner model + = BinaryData.fromString("{\"format\":\"link\",\"value\":\"v\"}").toObject(ApiSpecExportResultInner.class); + Assertions.assertEquals(ApiSpecExportResultFormat.LINK, model.format()); + Assertions.assertEquals("v", model.value()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ApiSpecExportResultInner model + = new ApiSpecExportResultInner().withFormat(ApiSpecExportResultFormat.LINK).withValue("v"); + model = BinaryData.fromObject(model).toObject(ApiSpecExportResultInner.class); + Assertions.assertEquals(ApiSpecExportResultFormat.LINK, model.format()); + Assertions.assertEquals("v", model.value()); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApiSpecImportRequestSpecificationTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApiSpecImportRequestSpecificationTests.java new file mode 100644 index 0000000000000..f646223eafded --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApiSpecImportRequestSpecificationTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.apicenter.models.ApiSpecImportRequestSpecification; +import org.junit.jupiter.api.Assertions; + +public final class ApiSpecImportRequestSpecificationTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ApiSpecImportRequestSpecification model + = BinaryData.fromString("{\"name\":\"lmqkrhahvlj\",\"version\":\"haquhcdh\"}") + .toObject(ApiSpecImportRequestSpecification.class); + Assertions.assertEquals("lmqkrhahvlj", model.name()); + Assertions.assertEquals("haquhcdh", model.version()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ApiSpecImportRequestSpecification model + = new ApiSpecImportRequestSpecification().withName("lmqkrhahvlj").withVersion("haquhcdh"); + model = BinaryData.fromObject(model).toObject(ApiSpecImportRequestSpecification.class); + Assertions.assertEquals("lmqkrhahvlj", model.name()); + Assertions.assertEquals("haquhcdh", model.version()); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApiSpecImportRequestTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApiSpecImportRequestTests.java new file mode 100644 index 0000000000000..fb2fbfcdb4238 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApiSpecImportRequestTests.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.apicenter.models.ApiSpecImportRequest; +import com.azure.resourcemanager.apicenter.models.ApiSpecImportRequestSpecification; +import com.azure.resourcemanager.apicenter.models.ApiSpecImportSourceFormat; +import org.junit.jupiter.api.Assertions; + +public final class ApiSpecImportRequestTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ApiSpecImportRequest model = BinaryData.fromString( + "{\"value\":\"srtslhspkdeem\",\"format\":\"inline\",\"specification\":{\"name\":\"ag\",\"version\":\"t\"}}") + .toObject(ApiSpecImportRequest.class); + Assertions.assertEquals("srtslhspkdeem", model.value()); + Assertions.assertEquals(ApiSpecImportSourceFormat.INLINE, model.format()); + Assertions.assertEquals("ag", model.specification().name()); + Assertions.assertEquals("t", model.specification().version()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ApiSpecImportRequest model + = new ApiSpecImportRequest().withValue("srtslhspkdeem").withFormat(ApiSpecImportSourceFormat.INLINE) + .withSpecification(new ApiSpecImportRequestSpecification().withName("ag").withVersion("t")); + model = BinaryData.fromObject(model).toObject(ApiSpecImportRequest.class); + Assertions.assertEquals("srtslhspkdeem", model.value()); + Assertions.assertEquals(ApiSpecImportSourceFormat.INLINE, model.format()); + Assertions.assertEquals("ag", model.specification().name()); + Assertions.assertEquals("t", model.specification().version()); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApiVersionInnerTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApiVersionInnerTests.java new file mode 100644 index 0000000000000..3399a61eab3ec --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApiVersionInnerTests.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.apicenter.fluent.models.ApiVersionInner; +import com.azure.resourcemanager.apicenter.models.ApiVersionProperties; +import com.azure.resourcemanager.apicenter.models.LifecycleStage; +import org.junit.jupiter.api.Assertions; + +public final class ApiVersionInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ApiVersionInner model = BinaryData.fromString( + "{\"properties\":{\"title\":\"skpbhenbtkcxywn\",\"lifecycleStage\":\"design\"},\"id\":\"rsyn\",\"name\":\"qidybyx\",\"type\":\"zfcl\"}") + .toObject(ApiVersionInner.class); + Assertions.assertEquals("skpbhenbtkcxywn", model.properties().title()); + Assertions.assertEquals(LifecycleStage.DESIGN, model.properties().lifecycleStage()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ApiVersionInner model = new ApiVersionInner().withProperties( + new ApiVersionProperties().withTitle("skpbhenbtkcxywn").withLifecycleStage(LifecycleStage.DESIGN)); + model = BinaryData.fromObject(model).toObject(ApiVersionInner.class); + Assertions.assertEquals("skpbhenbtkcxywn", model.properties().title()); + Assertions.assertEquals(LifecycleStage.DESIGN, model.properties().lifecycleStage()); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApiVersionListResultTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApiVersionListResultTests.java new file mode 100644 index 0000000000000..1a752c3b32a28 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApiVersionListResultTests.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.apicenter.models.ApiVersionListResult; + +public final class ApiVersionListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ApiVersionListResult model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"title\":\"butr\",\"lifecycleStage\":\"design\"},\"id\":\"na\",\"name\":\"zmhjrunmp\",\"type\":\"ttdbhrbnl\"}],\"nextLink\":\"kx\"}") + .toObject(ApiVersionListResult.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ApiVersionListResult model = new ApiVersionListResult(); + model = BinaryData.fromObject(model).toObject(ApiVersionListResult.class); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApiVersionPropertiesTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApiVersionPropertiesTests.java new file mode 100644 index 0000000000000..83bb683082705 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApiVersionPropertiesTests.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.apicenter.models.ApiVersionProperties; +import com.azure.resourcemanager.apicenter.models.LifecycleStage; +import org.junit.jupiter.api.Assertions; + +public final class ApiVersionPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ApiVersionProperties model + = BinaryData.fromString("{\"title\":\"aaxdbabphlwrq\",\"lifecycleStage\":\"design\"}") + .toObject(ApiVersionProperties.class); + Assertions.assertEquals("aaxdbabphlwrq", model.title()); + Assertions.assertEquals(LifecycleStage.DESIGN, model.lifecycleStage()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ApiVersionProperties model + = new ApiVersionProperties().withTitle("aaxdbabphlwrq").withLifecycleStage(LifecycleStage.DESIGN); + model = BinaryData.fromObject(model).toObject(ApiVersionProperties.class); + Assertions.assertEquals("aaxdbabphlwrq", model.title()); + Assertions.assertEquals(LifecycleStage.DESIGN, model.lifecycleStage()); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApiVersionsCreateOrUpdateWithResponseMockTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApiVersionsCreateOrUpdateWithResponseMockTests.java new file mode 100644 index 0000000000000..dfc9b6371d113 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApiVersionsCreateOrUpdateWithResponseMockTests.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.apicenter.ApiCenterManager; +import com.azure.resourcemanager.apicenter.models.ApiVersion; +import com.azure.resourcemanager.apicenter.models.ApiVersionProperties; +import com.azure.resourcemanager.apicenter.models.LifecycleStage; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class ApiVersionsCreateOrUpdateWithResponseMockTests { + @Test + public void testCreateOrUpdateWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr + = "{\"properties\":{\"title\":\"reaxhcexdr\",\"lifecycleStage\":\"design\"},\"id\":\"ahqkg\",\"name\":\"tpwijnh\",\"type\":\"jsvfycxzbfvoowv\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito.when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito.when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + ApiCenterManager manager = ApiCenterManager.configure().withHttpClient(httpClient).authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + ApiVersion response = manager.apiVersions().define("bnhlmc") + .withExistingApi("wjygvjayvblmhvk", "uhbxvvy", "gsopbyrqufegxu", "wz") + .withProperties(new ApiVersionProperties().withTitle("p").withLifecycleStage(LifecycleStage.PRODUCTION)) + .create(); + + Assertions.assertEquals("reaxhcexdr", response.properties().title()); + Assertions.assertEquals(LifecycleStage.DESIGN, response.properties().lifecycleStage()); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApiVersionsDeleteWithResponseMockTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApiVersionsDeleteWithResponseMockTests.java new file mode 100644 index 0000000000000..8e12726d17d91 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApiVersionsDeleteWithResponseMockTests.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.apicenter.ApiCenterManager; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class ApiVersionsDeleteWithResponseMockTests { + @Test + public void testDeleteWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = "{}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito.when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito.when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + ApiCenterManager manager = ApiCenterManager.configure().withHttpClient(httpClient).authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + manager.apiVersions().deleteWithResponse("qpcrf", "bwccsnjvcdwxlpqe", "ftnkhtj", "y", "ngwfqatm", + com.azure.core.util.Context.NONE); + + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApiVersionsGetWithResponseMockTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApiVersionsGetWithResponseMockTests.java new file mode 100644 index 0000000000000..ef532b531d542 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApiVersionsGetWithResponseMockTests.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.apicenter.ApiCenterManager; +import com.azure.resourcemanager.apicenter.models.ApiVersion; +import com.azure.resourcemanager.apicenter.models.LifecycleStage; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class ApiVersionsGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr + = "{\"properties\":{\"title\":\"feo\",\"lifecycleStage\":\"development\"},\"id\":\"qwkyhkobop\",\"name\":\"xedk\",\"type\":\"wep\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito.when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito.when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + ApiCenterManager manager = ApiCenterManager.configure().withHttpClient(httpClient).authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + ApiVersion response = manager.apiVersions().getWithResponse("wygzlvdnkfxusem", "wzrmuh", "pfcqdp", + "qxqvpsvuoymgc", "elvezrypq", com.azure.core.util.Context.NONE).getValue(); + + Assertions.assertEquals("feo", response.properties().title()); + Assertions.assertEquals(LifecycleStage.DEVELOPMENT, response.properties().lifecycleStage()); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApiVersionsHeadWithResponseMockTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApiVersionsHeadWithResponseMockTests.java new file mode 100644 index 0000000000000..e0f8a84857809 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApiVersionsHeadWithResponseMockTests.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.apicenter.ApiCenterManager; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class ApiVersionsHeadWithResponseMockTests { + @Test + public void testHeadWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = "{}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito.when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito.when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + ApiCenterManager manager = ApiCenterManager.configure().withHttpClient(httpClient).authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + manager.apiVersions().headWithResponse("dhtmdvypgikd", "szywkbirryu", "hlhkjoqrvqqaatj", "nrvgoupmfiibfgg", + "ioolvrwxkvtkkgll", com.azure.core.util.Context.NONE); + + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApiVersionsListMockTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApiVersionsListMockTests.java new file mode 100644 index 0000000000000..79d438d5852e2 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApiVersionsListMockTests.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.apicenter.ApiCenterManager; +import com.azure.resourcemanager.apicenter.models.ApiVersion; +import com.azure.resourcemanager.apicenter.models.LifecycleStage; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class ApiVersionsListMockTests { + @Test + public void testList() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr + = "{\"value\":[{\"properties\":{\"title\":\"nvyq\",\"lifecycleStage\":\"preview\"},\"id\":\"kzwpcnpw\",\"name\":\"cjaesgvvs\",\"type\":\"cyajguqf\"}]}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito.when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito.when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + ApiCenterManager manager = ApiCenterManager.configure().withHttpClient(httpClient).authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response = manager.apiVersions().list("hwhbotzingamv", "phoszqz", "dphqamv", "kfwynw", + "vtbvkayh", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("nvyq", response.iterator().next().properties().title()); + Assertions.assertEquals(LifecycleStage.PREVIEW, response.iterator().next().properties().lifecycleStage()); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApisCreateOrUpdateWithResponseMockTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApisCreateOrUpdateWithResponseMockTests.java new file mode 100644 index 0000000000000..833fa1bf3649c --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApisCreateOrUpdateWithResponseMockTests.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.apicenter.ApiCenterManager; +import com.azure.resourcemanager.apicenter.models.Api; +import com.azure.resourcemanager.apicenter.models.ApiKind; +import com.azure.resourcemanager.apicenter.models.ApiProperties; +import com.azure.resourcemanager.apicenter.models.Contact; +import com.azure.resourcemanager.apicenter.models.ExternalDocumentation; +import com.azure.resourcemanager.apicenter.models.License; +import com.azure.resourcemanager.apicenter.models.TermsOfService; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class ApisCreateOrUpdateWithResponseMockTests { + @Test + public void testCreateOrUpdateWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr + = "{\"properties\":{\"title\":\"z\",\"kind\":\"graphql\",\"description\":\"rvexztvb\",\"summary\":\"gsfraoyzkoow\",\"lifecycleStage\":\"design\",\"termsOfService\":{\"url\":\"guxawqaldsyuuxi\"},\"externalDocumentation\":[{\"title\":\"fobwy\",\"description\":\"kby\",\"url\":\"utwpfhp\"}],\"contacts\":[{\"name\":\"r\",\"url\":\"dsnfdsdoakgtdl\",\"email\":\"kzevdlhewpusds\"}],\"license\":{\"name\":\"vogvbbejdcngqqmo\",\"url\":\"ufgmjzrwrdg\",\"identifier\":\"wae\"},\"customProperties\":\"datauzkopbminrfd\"},\"id\":\"yuhhziu\",\"name\":\"efozbhdms\",\"type\":\"l\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito.when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito.when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + ApiCenterManager manager = ApiCenterManager.configure().withHttpClient(httpClient).authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + Api response + = manager.apis().define("yhmlwpaztzp") + .withExistingWorkspace("zuempsbzkf", "beyvpnqicvinvkjj", "dxrbuukzcle") + .withProperties(new ApiProperties().withTitle("ncckw").withKind(ApiKind.REST) + .withDescription("qwhxxbuyqaxzfeqz").withSummary("priolx") + .withTermsOfService(new TermsOfService().withUrl("lt")) + .withExternalDocumentation(Arrays.asList( + new ExternalDocumentation().withTitle("cwsobqwcs").withDescription("nwdcfhu") + .withUrl("qdpfuvglsbjjca"), + new ExternalDocumentation().withTitle("xbvtvudu").withDescription("cormr").withUrl("xqtvcofu"), + new ExternalDocumentation().withTitle("lvkgju").withDescription("dknnqvsazn").withUrl("n"), + new ExternalDocumentation().withTitle("rudsg").withDescription("hmk").withUrl("c"))) + .withContacts( + Arrays.asList(new Contact().withName("wjue").withUrl("eburu").withEmail("movsmzlxwabmqoe"), + new Contact().withName("ifrvtpu").withUrl("jmqlgkfb").withEmail("doaon"), + new Contact().withName("jcntuj").withUrl("c").withEmail("df"))) + .withLicense(new License().withName("ae").withUrl("ojvdcpzfoqo").withIdentifier("cybxa")) + .withCustomProperties("datagszufoxciqopid")) + .create(); + + Assertions.assertEquals("z", response.properties().title()); + Assertions.assertEquals(ApiKind.GRAPHQL, response.properties().kind()); + Assertions.assertEquals("rvexztvb", response.properties().description()); + Assertions.assertEquals("gsfraoyzkoow", response.properties().summary()); + Assertions.assertEquals("guxawqaldsyuuxi", response.properties().termsOfService().url()); + Assertions.assertEquals("fobwy", response.properties().externalDocumentation().get(0).title()); + Assertions.assertEquals("kby", response.properties().externalDocumentation().get(0).description()); + Assertions.assertEquals("utwpfhp", response.properties().externalDocumentation().get(0).url()); + Assertions.assertEquals("r", response.properties().contacts().get(0).name()); + Assertions.assertEquals("dsnfdsdoakgtdl", response.properties().contacts().get(0).url()); + Assertions.assertEquals("kzevdlhewpusds", response.properties().contacts().get(0).email()); + Assertions.assertEquals("vogvbbejdcngqqmo", response.properties().license().name()); + Assertions.assertEquals("ufgmjzrwrdg", response.properties().license().url()); + Assertions.assertEquals("wae", response.properties().license().identifier()); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApisDeleteWithResponseMockTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApisDeleteWithResponseMockTests.java new file mode 100644 index 0000000000000..361ca3a7f9132 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApisDeleteWithResponseMockTests.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.apicenter.ApiCenterManager; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class ApisDeleteWithResponseMockTests { + @Test + public void testDeleteWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = "{}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito.when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito.when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + ApiCenterManager manager = ApiCenterManager.configure().withHttpClient(httpClient).authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + manager.apis().deleteWithResponse("kooebwnu", "hemms", "vdkcrodtj", "nfwjlfltkacjvefk", + com.azure.core.util.Context.NONE); + + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApisGetWithResponseMockTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApisGetWithResponseMockTests.java new file mode 100644 index 0000000000000..b1843ec775d6d --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApisGetWithResponseMockTests.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.apicenter.ApiCenterManager; +import com.azure.resourcemanager.apicenter.models.Api; +import com.azure.resourcemanager.apicenter.models.ApiKind; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class ApisGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr + = "{\"properties\":{\"title\":\"yjmoadsu\",\"kind\":\"soap\",\"description\":\"m\",\"summary\":\"dmjsjqb\",\"lifecycleStage\":\"deprecated\",\"termsOfService\":{\"url\":\"x\"},\"externalDocumentation\":[{\"title\":\"yc\",\"description\":\"uhpkxkgymar\",\"url\":\"qnajxqugj\"},{\"title\":\"ycubeddgs\",\"description\":\"fwqmzqalkrmn\",\"url\":\"i\"},{\"title\":\"xacqqudfnbyx\",\"description\":\"aabjyvayffimrz\",\"url\":\"tuzqogsexne\"},{\"title\":\"dnw\",\"description\":\"mewzsyyc\",\"url\":\"uzsoi\"}],\"contacts\":[{\"name\":\"pfrxtrthzvay\",\"url\":\"wkqbrqu\",\"email\":\"axhexiilivp\"}],\"license\":{\"name\":\"irqtdqoa\",\"url\":\"r\",\"identifier\":\"fgsqu\"},\"customProperties\":\"dataxrxxlep\"},\"id\":\"amxjezwlw\",\"name\":\"wxuqlcvydypatdoo\",\"type\":\"ojknio\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito.when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito.when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + ApiCenterManager manager = ApiCenterManager.configure().withHttpClient(httpClient).authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + Api response = manager.apis() + .getWithResponse("gge", "dunyg", "eqidbqfatpx", "lr", com.azure.core.util.Context.NONE).getValue(); + + Assertions.assertEquals("yjmoadsu", response.properties().title()); + Assertions.assertEquals(ApiKind.SOAP, response.properties().kind()); + Assertions.assertEquals("m", response.properties().description()); + Assertions.assertEquals("dmjsjqb", response.properties().summary()); + Assertions.assertEquals("x", response.properties().termsOfService().url()); + Assertions.assertEquals("yc", response.properties().externalDocumentation().get(0).title()); + Assertions.assertEquals("uhpkxkgymar", response.properties().externalDocumentation().get(0).description()); + Assertions.assertEquals("qnajxqugj", response.properties().externalDocumentation().get(0).url()); + Assertions.assertEquals("pfrxtrthzvay", response.properties().contacts().get(0).name()); + Assertions.assertEquals("wkqbrqu", response.properties().contacts().get(0).url()); + Assertions.assertEquals("axhexiilivp", response.properties().contacts().get(0).email()); + Assertions.assertEquals("irqtdqoa", response.properties().license().name()); + Assertions.assertEquals("r", response.properties().license().url()); + Assertions.assertEquals("fgsqu", response.properties().license().identifier()); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApisHeadWithResponseMockTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApisHeadWithResponseMockTests.java new file mode 100644 index 0000000000000..15946f445fa8b --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApisHeadWithResponseMockTests.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.apicenter.ApiCenterManager; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class ApisHeadWithResponseMockTests { + @Test + public void testHeadWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = "{}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito.when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito.when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + ApiCenterManager manager = ApiCenterManager.configure().withHttpClient(httpClient).authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + manager.apis().headWithResponse("lfoakg", "kfpagao", "pulpqblylsyxk", "jnsjervtiagxsd", + com.azure.core.util.Context.NONE); + + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApisListMockTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApisListMockTests.java new file mode 100644 index 0000000000000..68b27a3fa2ddb --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ApisListMockTests.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.apicenter.ApiCenterManager; +import com.azure.resourcemanager.apicenter.models.Api; +import com.azure.resourcemanager.apicenter.models.ApiKind; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class ApisListMockTests { + @Test + public void testList() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr + = "{\"value\":[{\"properties\":{\"title\":\"la\",\"kind\":\"graphql\",\"description\":\"lwuip\",\"summary\":\"cjzkzivgvvcna\",\"lifecycleStage\":\"development\",\"termsOfService\":{\"url\":\"rnxxmueed\"},\"externalDocumentation\":[{\"title\":\"v\",\"description\":\"kwqqtchealmf\",\"url\":\"tdaaygdvwvg\"},{\"title\":\"ohgwxrtfudxepxg\",\"description\":\"agvrvmnpkuk\",\"url\":\"himdbl\"},{\"title\":\"wi\",\"description\":\"njhf\",\"url\":\"xw\"}],\"contacts\":[{\"name\":\"kfoqreyfkzikfj\",\"url\":\"n\",\"email\":\"ivx\"}],\"license\":{\"name\":\"elpcirelsfeaenwa\",\"url\":\"atklddxbjhwuaa\",\"identifier\":\"zjosp\"},\"customProperties\":\"dataoulpjrv\"},\"id\":\"glrvimjwosytxi\",\"name\":\"cskfcktqumiekk\",\"type\":\"zzikhlyfjhdg\"}]}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito.when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito.when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + ApiCenterManager manager = ApiCenterManager.configure().withHttpClient(httpClient).authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response = manager.apis().list("syocogjltdtbnnha", "oocrkvcikhnv", "amqgxqquezikyw", "gxk", + com.azure.core.util.Context.NONE); + + Assertions.assertEquals("la", response.iterator().next().properties().title()); + Assertions.assertEquals(ApiKind.GRAPHQL, response.iterator().next().properties().kind()); + Assertions.assertEquals("lwuip", response.iterator().next().properties().description()); + Assertions.assertEquals("cjzkzivgvvcna", response.iterator().next().properties().summary()); + Assertions.assertEquals("rnxxmueed", response.iterator().next().properties().termsOfService().url()); + Assertions.assertEquals("v", response.iterator().next().properties().externalDocumentation().get(0).title()); + Assertions.assertEquals("kwqqtchealmf", + response.iterator().next().properties().externalDocumentation().get(0).description()); + Assertions.assertEquals("tdaaygdvwvg", + response.iterator().next().properties().externalDocumentation().get(0).url()); + Assertions.assertEquals("kfoqreyfkzikfj", response.iterator().next().properties().contacts().get(0).name()); + Assertions.assertEquals("n", response.iterator().next().properties().contacts().get(0).url()); + Assertions.assertEquals("ivx", response.iterator().next().properties().contacts().get(0).email()); + Assertions.assertEquals("elpcirelsfeaenwa", response.iterator().next().properties().license().name()); + Assertions.assertEquals("atklddxbjhwuaa", response.iterator().next().properties().license().url()); + Assertions.assertEquals("zjosp", response.iterator().next().properties().license().identifier()); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ContactTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ContactTests.java new file mode 100644 index 0000000000000..d543a62db0907 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ContactTests.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.apicenter.models.Contact; +import org.junit.jupiter.api.Assertions; + +public final class ContactTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + Contact model = BinaryData + .fromString("{\"name\":\"hxmzsbbzoggig\",\"url\":\"wburvjxxjnspydpt\",\"email\":\"enkouknvudw\"}") + .toObject(Contact.class); + Assertions.assertEquals("hxmzsbbzoggig", model.name()); + Assertions.assertEquals("wburvjxxjnspydpt", model.url()); + Assertions.assertEquals("enkouknvudw", model.email()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + Contact model = new Contact().withName("hxmzsbbzoggig").withUrl("wburvjxxjnspydpt").withEmail("enkouknvudw"); + model = BinaryData.fromObject(model).toObject(Contact.class); + Assertions.assertEquals("hxmzsbbzoggig", model.name()); + Assertions.assertEquals("wburvjxxjnspydpt", model.url()); + Assertions.assertEquals("enkouknvudw", model.email()); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/DeploymentInnerTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/DeploymentInnerTests.java new file mode 100644 index 0000000000000..6d2d44621fb22 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/DeploymentInnerTests.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.apicenter.fluent.models.DeploymentInner; +import com.azure.resourcemanager.apicenter.models.DeploymentProperties; +import com.azure.resourcemanager.apicenter.models.DeploymentServer; +import com.azure.resourcemanager.apicenter.models.DeploymentState; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class DeploymentInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DeploymentInner model = BinaryData.fromString( + "{\"properties\":{\"title\":\"ihkaetcktvfc\",\"description\":\"fsnkymuctq\",\"environmentId\":\"fbebrjcxer\",\"definitionId\":\"wutttxfvjrbi\",\"state\":\"inactive\",\"server\":{\"runtimeUri\":[\"c\",\"vahfn\",\"jky\",\"xjvuujqgidokg\"]},\"customProperties\":\"datajyoxgvclt\"},\"id\":\"sncghkjeszz\",\"name\":\"bijhtxfvgxbf\",\"type\":\"mxnehmp\"}") + .toObject(DeploymentInner.class); + Assertions.assertEquals("ihkaetcktvfc", model.properties().title()); + Assertions.assertEquals("fsnkymuctq", model.properties().description()); + Assertions.assertEquals("fbebrjcxer", model.properties().environmentId()); + Assertions.assertEquals("wutttxfvjrbi", model.properties().definitionId()); + Assertions.assertEquals(DeploymentState.INACTIVE, model.properties().state()); + Assertions.assertEquals("c", model.properties().server().runtimeUri().get(0)); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DeploymentInner model = new DeploymentInner() + .withProperties(new DeploymentProperties().withTitle("ihkaetcktvfc").withDescription("fsnkymuctq") + .withEnvironmentId("fbebrjcxer").withDefinitionId("wutttxfvjrbi").withState(DeploymentState.INACTIVE) + .withServer(new DeploymentServer().withRuntimeUri(Arrays.asList("c", "vahfn", "jky", "xjvuujqgidokg"))) + .withCustomProperties("datajyoxgvclt")); + model = BinaryData.fromObject(model).toObject(DeploymentInner.class); + Assertions.assertEquals("ihkaetcktvfc", model.properties().title()); + Assertions.assertEquals("fsnkymuctq", model.properties().description()); + Assertions.assertEquals("fbebrjcxer", model.properties().environmentId()); + Assertions.assertEquals("wutttxfvjrbi", model.properties().definitionId()); + Assertions.assertEquals(DeploymentState.INACTIVE, model.properties().state()); + Assertions.assertEquals("c", model.properties().server().runtimeUri().get(0)); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/DeploymentListResultTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/DeploymentListResultTests.java new file mode 100644 index 0000000000000..791ae506aa1fb --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/DeploymentListResultTests.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.apicenter.models.DeploymentListResult; + +public final class DeploymentListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DeploymentListResult model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"title\":\"evqzntypmrbp\",\"description\":\"c\",\"environmentId\":\"qjsdpydnfyhxdeo\",\"definitionId\":\"zi\",\"state\":\"inactive\",\"server\":{\"runtimeUri\":[\"ttgzfbis\",\"cbkhajdeyeamdph\"]},\"customProperties\":\"dataalpbuxwgipwhon\"},\"id\":\"kgshwa\",\"name\":\"kix\",\"type\":\"bin\"},{\"properties\":{\"title\":\"uttmrywnuzoqft\",\"description\":\"qzrnkcqvyxlwhz\",\"environmentId\":\"icohoqqnwvl\",\"definitionId\":\"avwhheunm\",\"state\":\"inactive\",\"server\":{\"runtimeUri\":[\"zko\"]},\"customProperties\":\"datacukoklyaxuconu\"},\"id\":\"zf\",\"name\":\"beypewrmjmw\",\"type\":\"vjektcxsenh\"}],\"nextLink\":\"rsffrzpwvlqdqgbi\"}") + .toObject(DeploymentListResult.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DeploymentListResult model = new DeploymentListResult(); + model = BinaryData.fromObject(model).toObject(DeploymentListResult.class); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/DeploymentPropertiesTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/DeploymentPropertiesTests.java new file mode 100644 index 0000000000000..ae7473dc82903 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/DeploymentPropertiesTests.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.apicenter.models.DeploymentProperties; +import com.azure.resourcemanager.apicenter.models.DeploymentServer; +import com.azure.resourcemanager.apicenter.models.DeploymentState; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class DeploymentPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DeploymentProperties model = BinaryData.fromString( + "{\"title\":\"cxgod\",\"description\":\"fqkkr\",\"environmentId\":\"pukgriwflzlfb\",\"definitionId\":\"puz\",\"state\":\"inactive\",\"server\":{\"runtimeUri\":[\"qzahmgkbrp\",\"y\",\"hibnuqqkpika\",\"rgvtqag\"]},\"customProperties\":\"datauynhijg\"}") + .toObject(DeploymentProperties.class); + Assertions.assertEquals("cxgod", model.title()); + Assertions.assertEquals("fqkkr", model.description()); + Assertions.assertEquals("pukgriwflzlfb", model.environmentId()); + Assertions.assertEquals("puz", model.definitionId()); + Assertions.assertEquals(DeploymentState.INACTIVE, model.state()); + Assertions.assertEquals("qzahmgkbrp", model.server().runtimeUri().get(0)); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DeploymentProperties model = new DeploymentProperties().withTitle("cxgod").withDescription("fqkkr") + .withEnvironmentId("pukgriwflzlfb").withDefinitionId("puz").withState(DeploymentState.INACTIVE) + .withServer( + new DeploymentServer().withRuntimeUri(Arrays.asList("qzahmgkbrp", "y", "hibnuqqkpika", "rgvtqag"))) + .withCustomProperties("datauynhijg"); + model = BinaryData.fromObject(model).toObject(DeploymentProperties.class); + Assertions.assertEquals("cxgod", model.title()); + Assertions.assertEquals("fqkkr", model.description()); + Assertions.assertEquals("pukgriwflzlfb", model.environmentId()); + Assertions.assertEquals("puz", model.definitionId()); + Assertions.assertEquals(DeploymentState.INACTIVE, model.state()); + Assertions.assertEquals("qzahmgkbrp", model.server().runtimeUri().get(0)); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/DeploymentServerTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/DeploymentServerTests.java new file mode 100644 index 0000000000000..c297f1c5cb5e1 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/DeploymentServerTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.apicenter.models.DeploymentServer; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class DeploymentServerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DeploymentServer model = BinaryData.fromString("{\"runtimeUri\":[\"bfs\"]}").toObject(DeploymentServer.class); + Assertions.assertEquals("bfs", model.runtimeUri().get(0)); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DeploymentServer model = new DeploymentServer().withRuntimeUri(Arrays.asList("bfs")); + model = BinaryData.fromObject(model).toObject(DeploymentServer.class); + Assertions.assertEquals("bfs", model.runtimeUri().get(0)); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/DeploymentsCreateOrUpdateWithResponseMockTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/DeploymentsCreateOrUpdateWithResponseMockTests.java new file mode 100644 index 0000000000000..68a87d5eb8eb5 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/DeploymentsCreateOrUpdateWithResponseMockTests.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.apicenter.ApiCenterManager; +import com.azure.resourcemanager.apicenter.models.Deployment; +import com.azure.resourcemanager.apicenter.models.DeploymentProperties; +import com.azure.resourcemanager.apicenter.models.DeploymentServer; +import com.azure.resourcemanager.apicenter.models.DeploymentState; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class DeploymentsCreateOrUpdateWithResponseMockTests { + @Test + public void testCreateOrUpdateWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr + = "{\"properties\":{\"title\":\"pfrlazsz\",\"description\":\"woiindf\",\"environmentId\":\"pj\",\"definitionId\":\"wbtlhflsjcdh\",\"state\":\"inactive\",\"server\":{\"runtimeUri\":[\"bgofeljag\",\"qmqhldvriii\",\"jnalghf\",\"vtvsexsowueluq\"]},\"customProperties\":\"dataahhxvrh\"},\"id\":\"kwpjgwwspughftqs\",\"name\":\"hqxujxukndxdi\",\"type\":\"rjguufzdmsyqtf\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito.when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito.when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + ApiCenterManager manager = ApiCenterManager.configure().withHttpClient(httpClient).authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + Deployment response = manager.deployments().define("bizikayuhq") + .withExistingApi("vncjabudurgk", "kmokz", "jjklff", "mouwqlgzrfzeey") + .withProperties(new DeploymentProperties().withTitle("bs").withDescription("bqwrvtldgm") + .withEnvironmentId("gvmpipaslthaqfx").withDefinitionId("mwutwbdsre").withState(DeploymentState.INACTIVE) + .withServer(new DeploymentServer().withRuntimeUri(Arrays.asList("euyowqkd", "ytisibir"))) + .withCustomProperties("datapikpz")) + .create(); + + Assertions.assertEquals("pfrlazsz", response.properties().title()); + Assertions.assertEquals("woiindf", response.properties().description()); + Assertions.assertEquals("pj", response.properties().environmentId()); + Assertions.assertEquals("wbtlhflsjcdh", response.properties().definitionId()); + Assertions.assertEquals(DeploymentState.INACTIVE, response.properties().state()); + Assertions.assertEquals("bgofeljag", response.properties().server().runtimeUri().get(0)); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/DeploymentsDeleteWithResponseMockTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/DeploymentsDeleteWithResponseMockTests.java new file mode 100644 index 0000000000000..eecceec18ee4b --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/DeploymentsDeleteWithResponseMockTests.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.apicenter.ApiCenterManager; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class DeploymentsDeleteWithResponseMockTests { + @Test + public void testDeleteWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = "{}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito.when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito.when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + ApiCenterManager manager = ApiCenterManager.configure().withHttpClient(httpClient).authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + manager.deployments().deleteWithResponse("g", "vfvpdbodaciz", "j", "lhkrribdeibqipqk", "hvxndzwmkrefajpj", + com.azure.core.util.Context.NONE); + + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/DeploymentsGetWithResponseMockTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/DeploymentsGetWithResponseMockTests.java new file mode 100644 index 0000000000000..cf2733a0c44ea --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/DeploymentsGetWithResponseMockTests.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.apicenter.ApiCenterManager; +import com.azure.resourcemanager.apicenter.models.Deployment; +import com.azure.resourcemanager.apicenter.models.DeploymentState; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class DeploymentsGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr + = "{\"properties\":{\"title\":\"w\",\"description\":\"r\",\"environmentId\":\"swibyr\",\"definitionId\":\"l\",\"state\":\"inactive\",\"server\":{\"runtimeUri\":[\"p\",\"acstwityk\",\"evxccedcp\",\"md\"]},\"customProperties\":\"datadnwzxltjcvnhltiu\"},\"id\":\"xnavvwxq\",\"name\":\"byqunyow\",\"type\":\"wlmdjrkv\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito.when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito.when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + ApiCenterManager manager = ApiCenterManager.configure().withHttpClient(httpClient).authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + Deployment response = manager.deployments() + .getWithResponse("eadcygqukyhejhz", "sx", "fpel", "lppvksrpq", "ujzra", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("w", response.properties().title()); + Assertions.assertEquals("r", response.properties().description()); + Assertions.assertEquals("swibyr", response.properties().environmentId()); + Assertions.assertEquals("l", response.properties().definitionId()); + Assertions.assertEquals(DeploymentState.INACTIVE, response.properties().state()); + Assertions.assertEquals("p", response.properties().server().runtimeUri().get(0)); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/DeploymentsHeadWithResponseMockTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/DeploymentsHeadWithResponseMockTests.java new file mode 100644 index 0000000000000..9d5a6dd8e7800 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/DeploymentsHeadWithResponseMockTests.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.apicenter.ApiCenterManager; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class DeploymentsHeadWithResponseMockTests { + @Test + public void testHeadWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = "{}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito.when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito.when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + ApiCenterManager manager = ApiCenterManager.configure().withHttpClient(httpClient).authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + manager.deployments().headWithResponse("rwkq", "yhgbijtjivfx", "sjabibs", "stawfsdjpvkv", "bjxbkzbzk", + com.azure.core.util.Context.NONE); + + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/DeploymentsListMockTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/DeploymentsListMockTests.java new file mode 100644 index 0000000000000..e795d4ae77efc --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/DeploymentsListMockTests.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.apicenter.ApiCenterManager; +import com.azure.resourcemanager.apicenter.models.Deployment; +import com.azure.resourcemanager.apicenter.models.DeploymentState; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class DeploymentsListMockTests { + @Test + public void testList() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr + = "{\"value\":[{\"properties\":{\"title\":\"ivwitqscywugg\",\"description\":\"luhczbw\",\"environmentId\":\"hairsbrgzdwms\",\"definitionId\":\"ypqwdxggiccc\",\"state\":\"active\",\"server\":{\"runtimeUri\":[\"xmkttl\"]},\"customProperties\":\"datavlz\"},\"id\":\"emhzrncsdtc\",\"name\":\"u\",\"type\":\"iypbsfgytgusl\"}]}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito.when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito.when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + ApiCenterManager manager = ApiCenterManager.configure().withHttpClient(httpClient).authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response = manager.deployments().list("zqhof", "rmaequ", "ah", "icslfaoq", + "piyylhalnswhccsp", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("ivwitqscywugg", response.iterator().next().properties().title()); + Assertions.assertEquals("luhczbw", response.iterator().next().properties().description()); + Assertions.assertEquals("hairsbrgzdwms", response.iterator().next().properties().environmentId()); + Assertions.assertEquals("ypqwdxggiccc", response.iterator().next().properties().definitionId()); + Assertions.assertEquals(DeploymentState.ACTIVE, response.iterator().next().properties().state()); + Assertions.assertEquals("xmkttl", response.iterator().next().properties().server().runtimeUri().get(0)); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/EnvironmentInnerTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/EnvironmentInnerTests.java new file mode 100644 index 0000000000000..260a7c1a011b4 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/EnvironmentInnerTests.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.apicenter.fluent.models.EnvironmentInner; +import com.azure.resourcemanager.apicenter.models.EnvironmentKind; +import com.azure.resourcemanager.apicenter.models.EnvironmentProperties; +import com.azure.resourcemanager.apicenter.models.EnvironmentServer; +import com.azure.resourcemanager.apicenter.models.EnvironmentServerType; +import com.azure.resourcemanager.apicenter.models.Onboarding; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class EnvironmentInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + EnvironmentInner model = BinaryData.fromString( + "{\"properties\":{\"title\":\"zjuzgwyz\",\"description\":\"txon\",\"kind\":\"production\",\"server\":{\"type\":\"MuleSoft API Management\",\"managementPortalUri\":[\"cbpwxqpsrknft\",\"uvriuhprwm\",\"yvxqtayriwwroy\",\"bexrmcq\"]},\"onboarding\":{\"instructions\":\"cnojvknmefqsg\",\"developerPortalUri\":[\"hapjyzhpvgqz\"]},\"customProperties\":\"datarvxdjzlmw\"},\"id\":\"kvugfhzovawjvzun\",\"name\":\"uthnnprnxipeilpj\",\"type\":\"uaejxdultsk\"}") + .toObject(EnvironmentInner.class); + Assertions.assertEquals("zjuzgwyz", model.properties().title()); + Assertions.assertEquals("txon", model.properties().description()); + Assertions.assertEquals(EnvironmentKind.PRODUCTION, model.properties().kind()); + Assertions.assertEquals(EnvironmentServerType.MULE_SOFT_API_MANAGEMENT, model.properties().server().type()); + Assertions.assertEquals("cbpwxqpsrknft", model.properties().server().managementPortalUri().get(0)); + Assertions.assertEquals("cnojvknmefqsg", model.properties().onboarding().instructions()); + Assertions.assertEquals("hapjyzhpvgqz", model.properties().onboarding().developerPortalUri().get(0)); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + EnvironmentInner model = new EnvironmentInner().withProperties(new EnvironmentProperties().withTitle("zjuzgwyz") + .withDescription("txon").withKind(EnvironmentKind.PRODUCTION) + .withServer(new EnvironmentServer().withType(EnvironmentServerType.MULE_SOFT_API_MANAGEMENT) + .withManagementPortalUri(Arrays.asList("cbpwxqpsrknft", "uvriuhprwm", "yvxqtayriwwroy", "bexrmcq"))) + .withOnboarding(new Onboarding().withInstructions("cnojvknmefqsg") + .withDeveloperPortalUri(Arrays.asList("hapjyzhpvgqz"))) + .withCustomProperties("datarvxdjzlmw")); + model = BinaryData.fromObject(model).toObject(EnvironmentInner.class); + Assertions.assertEquals("zjuzgwyz", model.properties().title()); + Assertions.assertEquals("txon", model.properties().description()); + Assertions.assertEquals(EnvironmentKind.PRODUCTION, model.properties().kind()); + Assertions.assertEquals(EnvironmentServerType.MULE_SOFT_API_MANAGEMENT, model.properties().server().type()); + Assertions.assertEquals("cbpwxqpsrknft", model.properties().server().managementPortalUri().get(0)); + Assertions.assertEquals("cnojvknmefqsg", model.properties().onboarding().instructions()); + Assertions.assertEquals("hapjyzhpvgqz", model.properties().onboarding().developerPortalUri().get(0)); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/EnvironmentListResultTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/EnvironmentListResultTests.java new file mode 100644 index 0000000000000..fbb084a8fba69 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/EnvironmentListResultTests.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.apicenter.models.EnvironmentListResult; + +public final class EnvironmentListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + EnvironmentListResult model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"title\":\"alaexqpvfadmwsrc\",\"description\":\"vxpvgomz\",\"kind\":\"testing\",\"server\":{\"type\":\"Azure compute service\",\"managementPortalUri\":[\"bnbbeldawkz\"]},\"onboarding\":{\"instructions\":\"io\",\"developerPortalUri\":[\"hakauhashsf\",\"xosow\",\"xcug\"]},\"customProperties\":\"datajooxdjebw\"},\"id\":\"cwwfvovbvme\",\"name\":\"ecivyh\",\"type\":\"ce\"},{\"properties\":{\"title\":\"jgjrwjueiotwm\",\"description\":\"ytdxwit\",\"kind\":\"staging\",\"server\":{\"type\":\"Kong API Gateway\",\"managementPortalUri\":[\"qwgxhniskx\",\"bkpyc\",\"klwndnhjdauwhv\",\"l\"]},\"onboarding\":{\"instructions\":\"tdhxujznbmpowuwp\",\"developerPortalUri\":[\"lve\",\"alupjm\",\"hfxobbcswsrtj\",\"iplrbpbewtghfgb\"]},\"customProperties\":\"datagw\"},\"id\":\"vlvqhjkbegi\",\"name\":\"t\",\"type\":\"mxiebw\"}],\"nextLink\":\"loayqcgw\"}") + .toObject(EnvironmentListResult.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + EnvironmentListResult model = new EnvironmentListResult(); + model = BinaryData.fromObject(model).toObject(EnvironmentListResult.class); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/EnvironmentPropertiesTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/EnvironmentPropertiesTests.java new file mode 100644 index 0000000000000..3b62c7d778fb7 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/EnvironmentPropertiesTests.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.apicenter.models.EnvironmentKind; +import com.azure.resourcemanager.apicenter.models.EnvironmentProperties; +import com.azure.resourcemanager.apicenter.models.EnvironmentServer; +import com.azure.resourcemanager.apicenter.models.EnvironmentServerType; +import com.azure.resourcemanager.apicenter.models.Onboarding; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class EnvironmentPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + EnvironmentProperties model = BinaryData.fromString( + "{\"title\":\"bbtdzumvee\",\"description\":\"pwo\",\"kind\":\"development\",\"server\":{\"type\":\"Kubernetes\",\"managementPortalUri\":[\"sjyofdx\",\"uusdttouwa\"]},\"onboarding\":{\"instructions\":\"kqvkelnsmvbxwyjs\",\"developerPortalUri\":[\"hcaalnjix\",\"sxyawjoyaqcs\"]},\"customProperties\":\"datajpkiidzyexznelix\"}") + .toObject(EnvironmentProperties.class); + Assertions.assertEquals("bbtdzumvee", model.title()); + Assertions.assertEquals("pwo", model.description()); + Assertions.assertEquals(EnvironmentKind.DEVELOPMENT, model.kind()); + Assertions.assertEquals(EnvironmentServerType.KUBERNETES, model.server().type()); + Assertions.assertEquals("sjyofdx", model.server().managementPortalUri().get(0)); + Assertions.assertEquals("kqvkelnsmvbxwyjs", model.onboarding().instructions()); + Assertions.assertEquals("hcaalnjix", model.onboarding().developerPortalUri().get(0)); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + EnvironmentProperties model = new EnvironmentProperties().withTitle("bbtdzumvee").withDescription("pwo") + .withKind(EnvironmentKind.DEVELOPMENT) + .withServer(new EnvironmentServer().withType(EnvironmentServerType.KUBERNETES) + .withManagementPortalUri(Arrays.asList("sjyofdx", "uusdttouwa"))) + .withOnboarding(new Onboarding().withInstructions("kqvkelnsmvbxwyjs") + .withDeveloperPortalUri(Arrays.asList("hcaalnjix", "sxyawjoyaqcs"))) + .withCustomProperties("datajpkiidzyexznelix"); + model = BinaryData.fromObject(model).toObject(EnvironmentProperties.class); + Assertions.assertEquals("bbtdzumvee", model.title()); + Assertions.assertEquals("pwo", model.description()); + Assertions.assertEquals(EnvironmentKind.DEVELOPMENT, model.kind()); + Assertions.assertEquals(EnvironmentServerType.KUBERNETES, model.server().type()); + Assertions.assertEquals("sjyofdx", model.server().managementPortalUri().get(0)); + Assertions.assertEquals("kqvkelnsmvbxwyjs", model.onboarding().instructions()); + Assertions.assertEquals("hcaalnjix", model.onboarding().developerPortalUri().get(0)); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/EnvironmentServerTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/EnvironmentServerTests.java new file mode 100644 index 0000000000000..2c94cad097783 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/EnvironmentServerTests.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.apicenter.models.EnvironmentServer; +import com.azure.resourcemanager.apicenter.models.EnvironmentServerType; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class EnvironmentServerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + EnvironmentServer model = BinaryData + .fromString("{\"type\":\"AWS API Gateway\",\"managementPortalUri\":[\"folhbnxknal\",\"ulppggdtpnapnyir\"]}") + .toObject(EnvironmentServer.class); + Assertions.assertEquals(EnvironmentServerType.AWS_API_GATEWAY, model.type()); + Assertions.assertEquals("folhbnxknal", model.managementPortalUri().get(0)); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + EnvironmentServer model = new EnvironmentServer().withType(EnvironmentServerType.AWS_API_GATEWAY) + .withManagementPortalUri(Arrays.asList("folhbnxknal", "ulppggdtpnapnyir")); + model = BinaryData.fromObject(model).toObject(EnvironmentServer.class); + Assertions.assertEquals(EnvironmentServerType.AWS_API_GATEWAY, model.type()); + Assertions.assertEquals("folhbnxknal", model.managementPortalUri().get(0)); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/EnvironmentsCreateOrUpdateWithResponseMockTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/EnvironmentsCreateOrUpdateWithResponseMockTests.java new file mode 100644 index 0000000000000..638dbe48c5713 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/EnvironmentsCreateOrUpdateWithResponseMockTests.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.apicenter.ApiCenterManager; +import com.azure.resourcemanager.apicenter.models.Environment; +import com.azure.resourcemanager.apicenter.models.EnvironmentKind; +import com.azure.resourcemanager.apicenter.models.EnvironmentProperties; +import com.azure.resourcemanager.apicenter.models.EnvironmentServer; +import com.azure.resourcemanager.apicenter.models.EnvironmentServerType; +import com.azure.resourcemanager.apicenter.models.Onboarding; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class EnvironmentsCreateOrUpdateWithResponseMockTests { + @Test + public void testCreateOrUpdateWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr + = "{\"properties\":{\"title\":\"vewzcj\",\"description\":\"m\",\"kind\":\"production\",\"server\":{\"type\":\"Kong API Gateway\",\"managementPortalUri\":[\"adraufactkahzo\",\"ajjziuxxpshne\",\"kulfg\",\"lqubkwdlen\"]},\"onboarding\":{\"instructions\":\"utujba\",\"developerPortalUri\":[\"uo\",\"minyflnorwm\",\"uvwpklvxwmyg\",\"xpgpq\"]},\"customProperties\":\"dataisze\"},\"id\":\"nb\",\"name\":\"crxgibb\",\"type\":\"axconfozauo\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito.when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito.when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + ApiCenterManager manager = ApiCenterManager.configure().withHttpClient(httpClient).authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + Environment response = manager.environments().define("coezbrhubskh") + .withExistingWorkspace("qkdlw", "qfbumlkxtrqjf", "mlmbtxhwgfwsrta") + .withProperties(new EnvironmentProperties().withTitle("ygo").withDescription("kkqfqjbvle") + .withKind(EnvironmentKind.STAGING) + .withServer(new EnvironmentServer().withType(EnvironmentServerType.KONG_API_GATEWAY) + .withManagementPortalUri(Arrays.asList("qtqzfavyv", "qqybarye", "ayjkqa"))) + .withOnboarding(new Onboarding().withInstructions("zslesjcbher") + .withDeveloperPortalUri(Arrays.asList("iew", "jcvb"))) + .withCustomProperties("datawr")) + .create(); + + Assertions.assertEquals("vewzcj", response.properties().title()); + Assertions.assertEquals("m", response.properties().description()); + Assertions.assertEquals(EnvironmentKind.PRODUCTION, response.properties().kind()); + Assertions.assertEquals(EnvironmentServerType.KONG_API_GATEWAY, response.properties().server().type()); + Assertions.assertEquals("adraufactkahzo", response.properties().server().managementPortalUri().get(0)); + Assertions.assertEquals("utujba", response.properties().onboarding().instructions()); + Assertions.assertEquals("uo", response.properties().onboarding().developerPortalUri().get(0)); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/EnvironmentsDeleteWithResponseMockTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/EnvironmentsDeleteWithResponseMockTests.java new file mode 100644 index 0000000000000..80948ec72f13b --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/EnvironmentsDeleteWithResponseMockTests.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.apicenter.ApiCenterManager; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class EnvironmentsDeleteWithResponseMockTests { + @Test + public void testDeleteWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = "{}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito.when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito.when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + ApiCenterManager manager = ApiCenterManager.configure().withHttpClient(httpClient).authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + manager.environments().deleteWithResponse("kgxywr", "kpyklyhp", "uodpv", "uudl", + com.azure.core.util.Context.NONE); + + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/EnvironmentsGetWithResponseMockTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/EnvironmentsGetWithResponseMockTests.java new file mode 100644 index 0000000000000..26ad3f63e9d39 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/EnvironmentsGetWithResponseMockTests.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.apicenter.ApiCenterManager; +import com.azure.resourcemanager.apicenter.models.Environment; +import com.azure.resourcemanager.apicenter.models.EnvironmentKind; +import com.azure.resourcemanager.apicenter.models.EnvironmentServerType; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class EnvironmentsGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr + = "{\"properties\":{\"title\":\"rhnj\",\"description\":\"olvtnovqfzge\",\"kind\":\"staging\",\"server\":{\"type\":\"AWS API Gateway\",\"managementPortalUri\":[\"jltduceam\",\"mczuo\",\"ejwcwwqiok\"]},\"onboarding\":{\"instructions\":\"xmojmsvpkjp\",\"developerPortalUri\":[\"wcfzqljyxgt\"]},\"customProperties\":\"dataheyd\"},\"id\":\"dshmkxmaehvbbx\",\"name\":\"ripltf\",\"type\":\"htba\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito.when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito.when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + ApiCenterManager manager = ApiCenterManager.configure().withHttpClient(httpClient).authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + Environment response = manager.environments() + .getWithResponse("nrnrp", "ehuwrykqgaifmvik", "bydvkhbejdz", "xcv", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("rhnj", response.properties().title()); + Assertions.assertEquals("olvtnovqfzge", response.properties().description()); + Assertions.assertEquals(EnvironmentKind.STAGING, response.properties().kind()); + Assertions.assertEquals(EnvironmentServerType.AWS_API_GATEWAY, response.properties().server().type()); + Assertions.assertEquals("jltduceam", response.properties().server().managementPortalUri().get(0)); + Assertions.assertEquals("xmojmsvpkjp", response.properties().onboarding().instructions()); + Assertions.assertEquals("wcfzqljyxgt", response.properties().onboarding().developerPortalUri().get(0)); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/EnvironmentsHeadWithResponseMockTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/EnvironmentsHeadWithResponseMockTests.java new file mode 100644 index 0000000000000..11d50382620a7 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/EnvironmentsHeadWithResponseMockTests.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.apicenter.ApiCenterManager; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class EnvironmentsHeadWithResponseMockTests { + @Test + public void testHeadWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = "{}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito.when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito.when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + ApiCenterManager manager = ApiCenterManager.configure().withHttpClient(httpClient).authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + manager.environments().headWithResponse("zibt", "ostgkts", "vdxec", "zedqbcvhzlhplo", + com.azure.core.util.Context.NONE); + + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/EnvironmentsListMockTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/EnvironmentsListMockTests.java new file mode 100644 index 0000000000000..7ccee30af506c --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/EnvironmentsListMockTests.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.apicenter.ApiCenterManager; +import com.azure.resourcemanager.apicenter.models.Environment; +import com.azure.resourcemanager.apicenter.models.EnvironmentKind; +import com.azure.resourcemanager.apicenter.models.EnvironmentServerType; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class EnvironmentsListMockTests { + @Test + public void testList() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr + = "{\"value\":[{\"properties\":{\"title\":\"lw\",\"description\":\"esutrgjupauutpw\",\"kind\":\"development\",\"server\":{\"type\":\"Kong API Gateway\",\"managementPortalUri\":[\"qg\",\"zpnfqntcypsxj\"]},\"onboarding\":{\"instructions\":\"imwkslircizj\",\"developerPortalUri\":[\"dfcea\",\"vlhv\"]},\"customProperties\":\"datadyftumrtwna\"},\"id\":\"slbi\",\"name\":\"kojgcyzts\",\"type\":\"mznbaeqphch\"}]}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito.when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito.when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + ApiCenterManager manager = ApiCenterManager.configure().withHttpClient(httpClient).authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response = manager.environments().list("asdvl", "fwdgzxulucvp", "mrsreuzvxurisjnh", + "ytxifqjzgxmrh", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("lw", response.iterator().next().properties().title()); + Assertions.assertEquals("esutrgjupauutpw", response.iterator().next().properties().description()); + Assertions.assertEquals(EnvironmentKind.DEVELOPMENT, response.iterator().next().properties().kind()); + Assertions.assertEquals(EnvironmentServerType.KONG_API_GATEWAY, + response.iterator().next().properties().server().type()); + Assertions.assertEquals("qg", response.iterator().next().properties().server().managementPortalUri().get(0)); + Assertions.assertEquals("imwkslircizj", response.iterator().next().properties().onboarding().instructions()); + Assertions.assertEquals("dfcea", + response.iterator().next().properties().onboarding().developerPortalUri().get(0)); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ExternalDocumentationTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ExternalDocumentationTests.java new file mode 100644 index 0000000000000..4b3309825c0e5 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ExternalDocumentationTests.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.apicenter.models.ExternalDocumentation; +import org.junit.jupiter.api.Assertions; + +public final class ExternalDocumentationTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ExternalDocumentation model + = BinaryData.fromString("{\"title\":\"ggzfbu\",\"description\":\"mvfaxkffeiith\",\"url\":\"vmezy\"}") + .toObject(ExternalDocumentation.class); + Assertions.assertEquals("ggzfbu", model.title()); + Assertions.assertEquals("mvfaxkffeiith", model.description()); + Assertions.assertEquals("vmezy", model.url()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ExternalDocumentation model + = new ExternalDocumentation().withTitle("ggzfbu").withDescription("mvfaxkffeiith").withUrl("vmezy"); + model = BinaryData.fromObject(model).toObject(ExternalDocumentation.class); + Assertions.assertEquals("ggzfbu", model.title()); + Assertions.assertEquals("mvfaxkffeiith", model.description()); + Assertions.assertEquals("vmezy", model.url()); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/LicenseTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/LicenseTests.java new file mode 100644 index 0000000000000..fb81b9e046e5c --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/LicenseTests.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.apicenter.models.License; +import org.junit.jupiter.api.Assertions; + +public final class LicenseTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + License model + = BinaryData.fromString("{\"name\":\"ukbldngkpo\",\"url\":\"pazyxoegukg\",\"identifier\":\"piu\"}") + .toObject(License.class); + Assertions.assertEquals("ukbldngkpo", model.name()); + Assertions.assertEquals("pazyxoegukg", model.url()); + Assertions.assertEquals("piu", model.identifier()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + License model = new License().withName("ukbldngkpo").withUrl("pazyxoegukg").withIdentifier("piu"); + model = BinaryData.fromObject(model).toObject(License.class); + Assertions.assertEquals("ukbldngkpo", model.name()); + Assertions.assertEquals("pazyxoegukg", model.url()); + Assertions.assertEquals("piu", model.identifier()); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ManagedServiceIdentityTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ManagedServiceIdentityTests.java index 7db7db8a648e8..9050c73a39914 100644 --- a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ManagedServiceIdentityTests.java +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ManagedServiceIdentityTests.java @@ -15,29 +15,18 @@ public final class ManagedServiceIdentityTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { - ManagedServiceIdentity model = - BinaryData - .fromString( - "{\"principalId\":\"22409b84-6a5c-4f52-b9aa-d752c4d118b1\",\"tenantId\":\"b73d54c9-3dd2-484a-8fef-a4b8ffcc98ea\",\"type\":\"UserAssigned\",\"userAssignedIdentities\":{\"fxxypininmayhuy\":{\"principalId\":\"99b31f7e-d992-44ac-996c-5b3b1926617d\",\"clientId\":\"0e708b09-3575-4f14-8f35-7c20627f2a4c\"},\"podepoo\":{\"principalId\":\"2e39a8bf-ab6c-431d-93e6-cbf4a73647e5\",\"clientId\":\"5455d464-a629-4023-92e0-662a72193ef9\"},\"uvamiheognarxzxt\":{\"principalId\":\"edc2bbac-f0d5-43ef-85ad-fedd7a2ab00e\",\"clientId\":\"e375e805-2b5e-4fef-83c2-9156f388bc88\"},\"tusivyevcciqihn\":{\"principalId\":\"b066303c-fdf9-4fc7-b819-1aea1772398a\",\"clientId\":\"abdb22bd-de4e-4712-8b85-3d07e1c08b28\"}}}") - .toObject(ManagedServiceIdentity.class); + ManagedServiceIdentity model = BinaryData.fromString( + "{\"principalId\":\"6b4b005b-0694-4552-888b-19db983b6c32\",\"tenantId\":\"546d8d5e-496a-4704-b71e-51e5bae38baf\",\"type\":\"UserAssigned\",\"userAssignedIdentities\":{\"fxxypininmayhuy\":{\"principalId\":\"d75ad508-6b5a-454a-8171-96c0bc62643a\",\"clientId\":\"3e1d7feb-1821-4c62-9865-e3fd29d5ffdf\"},\"podepoo\":{\"principalId\":\"3ada2d66-3c89-48f5-b4aa-b7f5699f09ac\",\"clientId\":\"8f128f9a-4903-4bf7-85e9-fb810fec985c\"},\"uvamiheognarxzxt\":{\"principalId\":\"2fa96a95-81c5-457b-a40e-3d4726b7a92a\",\"clientId\":\"6fe80c64-87f8-4b73-aa0c-f51f2ec324aa\"},\"tusivyevcciqihn\":{\"principalId\":\"f0bde2a9-60ea-4bd6-92d7-0bc31b70828c\",\"clientId\":\"f5b43da9-0cc8-4c3d-82ca-833c6e93e026\"}}}") + .toObject(ManagedServiceIdentity.class); Assertions.assertEquals(ManagedServiceIdentityType.USER_ASSIGNED, model.type()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { - ManagedServiceIdentity model = - new ManagedServiceIdentity() - .withType(ManagedServiceIdentityType.USER_ASSIGNED) - .withUserAssignedIdentities( - mapOf( - "fxxypininmayhuy", - new UserAssignedIdentity(), - "podepoo", - new UserAssignedIdentity(), - "uvamiheognarxzxt", - new UserAssignedIdentity(), - "tusivyevcciqihn", - new UserAssignedIdentity())); + ManagedServiceIdentity model = new ManagedServiceIdentity().withType(ManagedServiceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities( + mapOf("fxxypininmayhuy", new UserAssignedIdentity(), "podepoo", new UserAssignedIdentity(), + "uvamiheognarxzxt", new UserAssignedIdentity(), "tusivyevcciqihn", new UserAssignedIdentity())); model = BinaryData.fromObject(model).toObject(ManagedServiceIdentity.class); Assertions.assertEquals(ManagedServiceIdentityType.USER_ASSIGNED, model.type()); } diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/MetadataAssignmentTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/MetadataAssignmentTests.java new file mode 100644 index 0000000000000..e0f8547be6728 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/MetadataAssignmentTests.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.apicenter.models.MetadataAssignment; +import com.azure.resourcemanager.apicenter.models.MetadataAssignmentEntity; +import org.junit.jupiter.api.Assertions; + +public final class MetadataAssignmentTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MetadataAssignment model + = BinaryData.fromString("{\"entity\":\"deployment\",\"required\":true,\"deprecated\":true}") + .toObject(MetadataAssignment.class); + Assertions.assertEquals(MetadataAssignmentEntity.DEPLOYMENT, model.entity()); + Assertions.assertEquals(true, model.required()); + Assertions.assertEquals(true, model.deprecated()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MetadataAssignment model = new MetadataAssignment().withEntity(MetadataAssignmentEntity.DEPLOYMENT) + .withRequired(true).withDeprecated(true); + model = BinaryData.fromObject(model).toObject(MetadataAssignment.class); + Assertions.assertEquals(MetadataAssignmentEntity.DEPLOYMENT, model.entity()); + Assertions.assertEquals(true, model.required()); + Assertions.assertEquals(true, model.deprecated()); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/MetadataSchemaExportRequestTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/MetadataSchemaExportRequestTests.java new file mode 100644 index 0000000000000..bfb741cc975d6 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/MetadataSchemaExportRequestTests.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.apicenter.models.MetadataAssignmentEntity; +import com.azure.resourcemanager.apicenter.models.MetadataSchemaExportRequest; +import org.junit.jupiter.api.Assertions; + +public final class MetadataSchemaExportRequestTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MetadataSchemaExportRequest model + = BinaryData.fromString("{\"assignedTo\":\"environment\"}").toObject(MetadataSchemaExportRequest.class); + Assertions.assertEquals(MetadataAssignmentEntity.ENVIRONMENT, model.assignedTo()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MetadataSchemaExportRequest model + = new MetadataSchemaExportRequest().withAssignedTo(MetadataAssignmentEntity.ENVIRONMENT); + model = BinaryData.fromObject(model).toObject(MetadataSchemaExportRequest.class); + Assertions.assertEquals(MetadataAssignmentEntity.ENVIRONMENT, model.assignedTo()); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/MetadataSchemaExportResultInnerTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/MetadataSchemaExportResultInnerTests.java new file mode 100644 index 0000000000000..e9c40e8ab622b --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/MetadataSchemaExportResultInnerTests.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.apicenter.fluent.models.MetadataSchemaExportResultInner; +import com.azure.resourcemanager.apicenter.models.MetadataSchemaExportFormat; +import org.junit.jupiter.api.Assertions; + +public final class MetadataSchemaExportResultInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MetadataSchemaExportResultInner model + = BinaryData.fromString("{\"format\":\"inline\",\"value\":\"cwrwclxxwrljdous\"}") + .toObject(MetadataSchemaExportResultInner.class); + Assertions.assertEquals(MetadataSchemaExportFormat.INLINE, model.format()); + Assertions.assertEquals("cwrwclxxwrljdous", model.value()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MetadataSchemaExportResultInner model = new MetadataSchemaExportResultInner() + .withFormat(MetadataSchemaExportFormat.INLINE).withValue("cwrwclxxwrljdous"); + model = BinaryData.fromObject(model).toObject(MetadataSchemaExportResultInner.class); + Assertions.assertEquals(MetadataSchemaExportFormat.INLINE, model.format()); + Assertions.assertEquals("cwrwclxxwrljdous", model.value()); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/MetadataSchemaInnerTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/MetadataSchemaInnerTests.java new file mode 100644 index 0000000000000..51eaca9dfde54 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/MetadataSchemaInnerTests.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.apicenter.fluent.models.MetadataSchemaInner; +import com.azure.resourcemanager.apicenter.models.MetadataAssignment; +import com.azure.resourcemanager.apicenter.models.MetadataAssignmentEntity; +import com.azure.resourcemanager.apicenter.models.MetadataSchemaProperties; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class MetadataSchemaInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MetadataSchemaInner model = BinaryData.fromString( + "{\"properties\":{\"schema\":\"bzqqedqytbciq\",\"assignedTo\":[{\"entity\":\"deployment\",\"required\":false,\"deprecated\":false},{\"entity\":\"api\",\"required\":false,\"deprecated\":true}]},\"id\":\"lougpbkw\",\"name\":\"mutduqktaps\",\"type\":\"wgcu\"}") + .toObject(MetadataSchemaInner.class); + Assertions.assertEquals("bzqqedqytbciq", model.properties().schema()); + Assertions.assertEquals(MetadataAssignmentEntity.DEPLOYMENT, model.properties().assignedTo().get(0).entity()); + Assertions.assertEquals(false, model.properties().assignedTo().get(0).required()); + Assertions.assertEquals(false, model.properties().assignedTo().get(0).deprecated()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MetadataSchemaInner model + = new MetadataSchemaInner().withProperties(new MetadataSchemaProperties().withSchema("bzqqedqytbciq") + .withAssignedTo(Arrays.asList( + new MetadataAssignment().withEntity(MetadataAssignmentEntity.DEPLOYMENT).withRequired(false) + .withDeprecated(false), + new MetadataAssignment().withEntity(MetadataAssignmentEntity.API).withRequired(false) + .withDeprecated(true)))); + model = BinaryData.fromObject(model).toObject(MetadataSchemaInner.class); + Assertions.assertEquals("bzqqedqytbciq", model.properties().schema()); + Assertions.assertEquals(MetadataAssignmentEntity.DEPLOYMENT, model.properties().assignedTo().get(0).entity()); + Assertions.assertEquals(false, model.properties().assignedTo().get(0).required()); + Assertions.assertEquals(false, model.properties().assignedTo().get(0).deprecated()); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/MetadataSchemaListResultTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/MetadataSchemaListResultTests.java new file mode 100644 index 0000000000000..fbcb1daba50ad --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/MetadataSchemaListResultTests.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.apicenter.models.MetadataSchemaListResult; + +public final class MetadataSchemaListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MetadataSchemaListResult model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"schema\":\"vkocrcjdkwtn\",\"assignedTo\":[{\"entity\":\"deployment\",\"required\":false,\"deprecated\":true},{\"entity\":\"api\",\"required\":false,\"deprecated\":true},{\"entity\":\"api\",\"required\":true,\"deprecated\":true},{\"entity\":\"api\",\"required\":true,\"deprecated\":false}]},\"id\":\"mppeebvmgxs\",\"name\":\"bkyqduu\",\"type\":\"itcjczdz\"},{\"properties\":{\"schema\":\"ndhkrw\",\"assignedTo\":[{\"entity\":\"deployment\",\"required\":false,\"deprecated\":true}]},\"id\":\"vwrwj\",\"name\":\"eusnhutj\",\"type\":\"ltmrldh\"},{\"properties\":{\"schema\":\"jzzd\",\"assignedTo\":[{\"entity\":\"environment\",\"required\":false,\"deprecated\":true},{\"entity\":\"deployment\",\"required\":false,\"deprecated\":false},{\"entity\":\"deployment\",\"required\":true,\"deprecated\":false},{\"entity\":\"api\",\"required\":true,\"deprecated\":true}]},\"id\":\"yiftyhxhuro\",\"name\":\"ftyxolniw\",\"type\":\"wcukjfkgiawxk\"},{\"properties\":{\"schema\":\"ypl\",\"assignedTo\":[{\"entity\":\"deployment\",\"required\":true,\"deprecated\":true},{\"entity\":\"environment\",\"required\":true,\"deprecated\":true}]},\"id\":\"bacphejko\",\"name\":\"ynqgoulzndlikwyq\",\"type\":\"gfgibm\"}],\"nextLink\":\"gakeqsr\"}") + .toObject(MetadataSchemaListResult.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MetadataSchemaListResult model = new MetadataSchemaListResult(); + model = BinaryData.fromObject(model).toObject(MetadataSchemaListResult.class); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/MetadataSchemaPropertiesTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/MetadataSchemaPropertiesTests.java new file mode 100644 index 0000000000000..4a1b99e2d5662 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/MetadataSchemaPropertiesTests.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.apicenter.models.MetadataAssignment; +import com.azure.resourcemanager.apicenter.models.MetadataAssignmentEntity; +import com.azure.resourcemanager.apicenter.models.MetadataSchemaProperties; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class MetadataSchemaPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MetadataSchemaProperties model = BinaryData.fromString( + "{\"schema\":\"rtumkdosvq\",\"assignedTo\":[{\"entity\":\"deployment\",\"required\":true,\"deprecated\":true}]}") + .toObject(MetadataSchemaProperties.class); + Assertions.assertEquals("rtumkdosvq", model.schema()); + Assertions.assertEquals(MetadataAssignmentEntity.DEPLOYMENT, model.assignedTo().get(0).entity()); + Assertions.assertEquals(true, model.assignedTo().get(0).required()); + Assertions.assertEquals(true, model.assignedTo().get(0).deprecated()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MetadataSchemaProperties model = new MetadataSchemaProperties().withSchema("rtumkdosvq") + .withAssignedTo(Arrays.asList(new MetadataAssignment().withEntity(MetadataAssignmentEntity.DEPLOYMENT) + .withRequired(true).withDeprecated(true))); + model = BinaryData.fromObject(model).toObject(MetadataSchemaProperties.class); + Assertions.assertEquals("rtumkdosvq", model.schema()); + Assertions.assertEquals(MetadataAssignmentEntity.DEPLOYMENT, model.assignedTo().get(0).entity()); + Assertions.assertEquals(true, model.assignedTo().get(0).required()); + Assertions.assertEquals(true, model.assignedTo().get(0).deprecated()); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/MetadataSchemasCreateOrUpdateWithResponseMockTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/MetadataSchemasCreateOrUpdateWithResponseMockTests.java new file mode 100644 index 0000000000000..2ad002dfeae8e --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/MetadataSchemasCreateOrUpdateWithResponseMockTests.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.apicenter.ApiCenterManager; +import com.azure.resourcemanager.apicenter.models.MetadataAssignment; +import com.azure.resourcemanager.apicenter.models.MetadataAssignmentEntity; +import com.azure.resourcemanager.apicenter.models.MetadataSchema; +import com.azure.resourcemanager.apicenter.models.MetadataSchemaProperties; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class MetadataSchemasCreateOrUpdateWithResponseMockTests { + @Test + public void testCreateOrUpdateWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr + = "{\"properties\":{\"schema\":\"zdtmhrkwofy\",\"assignedTo\":[{\"entity\":\"deployment\",\"required\":true,\"deprecated\":false}]},\"id\":\"pbtg\",\"name\":\"wbwo\",\"type\":\"nwashrtd\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito.when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito.when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + ApiCenterManager manager = ApiCenterManager.configure().withHttpClient(httpClient).authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + MetadataSchema response + = manager.metadataSchemas().define("apvhelxprgly").withExistingService("jqg", "ysmocmbqfqvmkcxo") + .withProperties(new MetadataSchemaProperties().withSchema("dd") + .withAssignedTo(Arrays.asList( + new MetadataAssignment().withEntity(MetadataAssignmentEntity.ENVIRONMENT).withRequired(true) + .withDeprecated(true), + new MetadataAssignment().withEntity(MetadataAssignmentEntity.DEPLOYMENT).withRequired(true) + .withDeprecated(true), + new MetadataAssignment().withEntity(MetadataAssignmentEntity.ENVIRONMENT).withRequired(false) + .withDeprecated(true), + new MetadataAssignment().withEntity(MetadataAssignmentEntity.DEPLOYMENT).withRequired(true) + .withDeprecated(true)))) + .create(); + + Assertions.assertEquals("zdtmhrkwofy", response.properties().schema()); + Assertions.assertEquals(MetadataAssignmentEntity.DEPLOYMENT, + response.properties().assignedTo().get(0).entity()); + Assertions.assertEquals(true, response.properties().assignedTo().get(0).required()); + Assertions.assertEquals(false, response.properties().assignedTo().get(0).deprecated()); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/MetadataSchemasDeleteWithResponseMockTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/MetadataSchemasDeleteWithResponseMockTests.java new file mode 100644 index 0000000000000..7b9c1748433fd --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/MetadataSchemasDeleteWithResponseMockTests.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.apicenter.ApiCenterManager; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class MetadataSchemasDeleteWithResponseMockTests { + @Test + public void testDeleteWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = "{}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito.when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito.when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + ApiCenterManager manager = ApiCenterManager.configure().withHttpClient(httpClient).authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + manager.metadataSchemas().deleteWithResponse("yhrfouyftaakcpw", "yzvqt", "nubexk", + com.azure.core.util.Context.NONE); + + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/MetadataSchemasGetWithResponseMockTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/MetadataSchemasGetWithResponseMockTests.java new file mode 100644 index 0000000000000..e57abeaec9372 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/MetadataSchemasGetWithResponseMockTests.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.apicenter.ApiCenterManager; +import com.azure.resourcemanager.apicenter.models.MetadataAssignmentEntity; +import com.azure.resourcemanager.apicenter.models.MetadataSchema; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class MetadataSchemasGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr + = "{\"properties\":{\"schema\":\"gx\",\"assignedTo\":[{\"entity\":\"deployment\",\"required\":false,\"deprecated\":true},{\"entity\":\"environment\",\"required\":false,\"deprecated\":false},{\"entity\":\"environment\",\"required\":false,\"deprecated\":false}]},\"id\":\"yqsluic\",\"name\":\"dggkzzlvmbmpa\",\"type\":\"modfvuefywsbpfvm\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito.when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito.when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + ApiCenterManager manager = ApiCenterManager.configure().withHttpClient(httpClient).authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + MetadataSchema response = manager.metadataSchemas() + .getWithResponse("sotbob", "dopcjwvnh", "ld", com.azure.core.util.Context.NONE).getValue(); + + Assertions.assertEquals("gx", response.properties().schema()); + Assertions.assertEquals(MetadataAssignmentEntity.DEPLOYMENT, + response.properties().assignedTo().get(0).entity()); + Assertions.assertEquals(false, response.properties().assignedTo().get(0).required()); + Assertions.assertEquals(true, response.properties().assignedTo().get(0).deprecated()); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/MetadataSchemasHeadWithResponseMockTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/MetadataSchemasHeadWithResponseMockTests.java new file mode 100644 index 0000000000000..ee0a8650fb78a --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/MetadataSchemasHeadWithResponseMockTests.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.apicenter.ApiCenterManager; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class MetadataSchemasHeadWithResponseMockTests { + @Test + public void testHeadWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = "{}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito.when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito.when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + ApiCenterManager manager = ApiCenterManager.configure().withHttpClient(httpClient).authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + manager.metadataSchemas().headWithResponse("zksmondj", "quxvypomgkop", "whojvp", + com.azure.core.util.Context.NONE); + + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/MetadataSchemasListMockTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/MetadataSchemasListMockTests.java new file mode 100644 index 0000000000000..7ed1addc60924 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/MetadataSchemasListMockTests.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.apicenter.ApiCenterManager; +import com.azure.resourcemanager.apicenter.models.MetadataAssignmentEntity; +import com.azure.resourcemanager.apicenter.models.MetadataSchema; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class MetadataSchemasListMockTests { + @Test + public void testList() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr + = "{\"value\":[{\"properties\":{\"schema\":\"pfuflrw\",\"assignedTo\":[{\"entity\":\"deployment\",\"required\":true,\"deprecated\":true},{\"entity\":\"deployment\",\"required\":true,\"deprecated\":false},{\"entity\":\"api\",\"required\":false,\"deprecated\":true},{\"entity\":\"environment\",\"required\":false,\"deprecated\":true}]},\"id\":\"fb\",\"name\":\"vkcvqvpkeqd\",\"type\":\"vdrhvoo\"}]}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito.when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito.when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + ApiCenterManager manager = ApiCenterManager.configure().withHttpClient(httpClient).authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response + = manager.metadataSchemas().list("ljuti", "swacffgdkzz", "wkfvhqcrailvp", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("pfuflrw", response.iterator().next().properties().schema()); + Assertions.assertEquals(MetadataAssignmentEntity.DEPLOYMENT, + response.iterator().next().properties().assignedTo().get(0).entity()); + Assertions.assertEquals(true, response.iterator().next().properties().assignedTo().get(0).required()); + Assertions.assertEquals(true, response.iterator().next().properties().assignedTo().get(0).deprecated()); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/OnboardingTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/OnboardingTests.java new file mode 100644 index 0000000000000..ce0dea7a157de --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/OnboardingTests.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.apicenter.models.Onboarding; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class OnboardingTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + Onboarding model + = BinaryData.fromString("{\"instructions\":\"uhpigvp\",\"developerPortalUri\":[\"gqgitxmedjvcsl\"]}") + .toObject(Onboarding.class); + Assertions.assertEquals("uhpigvp", model.instructions()); + Assertions.assertEquals("gqgitxmedjvcsl", model.developerPortalUri().get(0)); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + Onboarding model + = new Onboarding().withInstructions("uhpigvp").withDeveloperPortalUri(Arrays.asList("gqgitxmedjvcsl")); + model = BinaryData.fromObject(model).toObject(Onboarding.class); + Assertions.assertEquals("uhpigvp", model.instructions()); + Assertions.assertEquals("gqgitxmedjvcsl", model.developerPortalUri().get(0)); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/OperationDisplayTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/OperationDisplayTests.java index 93b5c0bb47e38..f3710a18d4044 100644 --- a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/OperationDisplayTests.java +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/OperationDisplayTests.java @@ -10,11 +10,9 @@ public final class OperationDisplayTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { - OperationDisplay model = - BinaryData - .fromString( - "{\"provider\":\"yrtih\",\"resource\":\"tijbpzvgnwzsymgl\",\"operation\":\"fcyzkohdbihanufh\",\"description\":\"bj\"}") - .toObject(OperationDisplay.class); + OperationDisplay model = BinaryData.fromString( + "{\"provider\":\"yrtih\",\"resource\":\"tijbpzvgnwzsymgl\",\"operation\":\"fcyzkohdbihanufh\",\"description\":\"bj\"}") + .toObject(OperationDisplay.class); } @org.junit.jupiter.api.Test diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/OperationInnerTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/OperationInnerTests.java index 91c1cdb4c2153..62308985b09a3 100644 --- a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/OperationInnerTests.java +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/OperationInnerTests.java @@ -11,11 +11,9 @@ public final class OperationInnerTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { - OperationInner model = - BinaryData - .fromString( - "{\"name\":\"usarhmofc\",\"isDataAction\":false,\"display\":{\"provider\":\"urkdtmlx\",\"resource\":\"kuksjtxukcdm\",\"operation\":\"rcryuanzwuxzdxta\",\"description\":\"lhmwhfpmrqobm\"},\"origin\":\"user,system\",\"actionType\":\"Internal\"}") - .toObject(OperationInner.class); + OperationInner model = BinaryData.fromString( + "{\"name\":\"usarhmofc\",\"isDataAction\":false,\"display\":{\"provider\":\"urkdtmlx\",\"resource\":\"kuksjtxukcdm\",\"operation\":\"rcryuanzwuxzdxta\",\"description\":\"lhmwhfpmrqobm\"},\"origin\":\"user,system\",\"actionType\":\"Internal\"}") + .toObject(OperationInner.class); } @org.junit.jupiter.api.Test diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/OperationListResultTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/OperationListResultTests.java index 6cc353e505fc4..c41799a825773 100644 --- a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/OperationListResultTests.java +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/OperationListResultTests.java @@ -10,11 +10,9 @@ public final class OperationListResultTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { - OperationListResult model = - BinaryData - .fromString( - "{\"value\":[{\"name\":\"quvgjxpybczme\",\"isDataAction\":true,\"display\":{\"provider\":\"pbsphrupidgs\",\"resource\":\"bejhphoycmsxa\",\"operation\":\"hdxbmtqio\",\"description\":\"zehtbmu\"},\"origin\":\"user,system\",\"actionType\":\"Internal\"},{\"name\":\"izhwlrxy\",\"isDataAction\":false,\"display\":{\"provider\":\"ijgkdm\",\"resource\":\"azlobcufpdznrbt\",\"operation\":\"qjnqglhqgnufoooj\",\"description\":\"ifsqesaagdfmg\"},\"origin\":\"user,system\",\"actionType\":\"Internal\"},{\"name\":\"rifkwm\",\"isDataAction\":true,\"display\":{\"provider\":\"izntocipao\",\"resource\":\"jpsq\",\"operation\":\"mpoyfd\",\"description\":\"ogknygjofjdd\"},\"origin\":\"user,system\",\"actionType\":\"Internal\"}],\"nextLink\":\"upewnwreitjzy\"}") - .toObject(OperationListResult.class); + OperationListResult model = BinaryData.fromString( + "{\"value\":[{\"name\":\"quvgjxpybczme\",\"isDataAction\":true,\"display\":{\"provider\":\"pbsphrupidgs\",\"resource\":\"bejhphoycmsxa\",\"operation\":\"hdxbmtqio\",\"description\":\"zehtbmu\"},\"origin\":\"user,system\",\"actionType\":\"Internal\"},{\"name\":\"izhwlrxy\",\"isDataAction\":false,\"display\":{\"provider\":\"ijgkdm\",\"resource\":\"azlobcufpdznrbt\",\"operation\":\"qjnqglhqgnufoooj\",\"description\":\"ifsqesaagdfmg\"},\"origin\":\"user,system\",\"actionType\":\"Internal\"},{\"name\":\"rifkwm\",\"isDataAction\":true,\"display\":{\"provider\":\"izntocipao\",\"resource\":\"jpsq\",\"operation\":\"mpoyfd\",\"description\":\"ogknygjofjdd\"},\"origin\":\"user,system\",\"actionType\":\"Internal\"}],\"nextLink\":\"upewnwreitjzy\"}") + .toObject(OperationListResult.class); } @org.junit.jupiter.api.Test diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/OperationsListMockTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/OperationsListMockTests.java index 8120f87c3a9ac..ef462938a03fc 100644 --- a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/OperationsListMockTests.java +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/OperationsListMockTests.java @@ -30,35 +30,25 @@ public void testList() throws Exception { HttpResponse httpResponse = Mockito.mock(HttpResponse.class); ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - String responseStr = - "{\"value\":[{\"name\":\"zrnf\",\"isDataAction\":true,\"display\":{\"provider\":\"spemvtzfk\",\"resource\":\"ubljofxqe\",\"operation\":\"jaeq\",\"description\":\"qjbasvms\"},\"origin\":\"user\",\"actionType\":\"Internal\"}]}"; + String responseStr + = "{\"value\":[{\"name\":\"qwwncw\",\"isDataAction\":false,\"display\":{\"provider\":\"ktrmgucnapkt\",\"resource\":\"ellwptfdy\",\"operation\":\"fqbuaceopzf\",\"description\":\"hhuao\"},\"origin\":\"system\",\"actionType\":\"Internal\"}]}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) + Mockito.when(httpResponse.getBody()) .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) + Mockito.when(httpResponse.getBodyAsByteArray()) .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); + Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); - ApiCenterManager manager = - ApiCenterManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); + ApiCenterManager manager = ApiCenterManager.configure().withHttpClient(httpClient).authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); PagedIterable response = manager.operations().list(com.azure.core.util.Context.NONE); + } } diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ServiceCollectionTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ServiceCollectionTests.java deleted file mode 100644 index a4af32f599b6c..0000000000000 --- a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ServiceCollectionTests.java +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.apicenter.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.apicenter.fluent.models.ServiceInner; -import com.azure.resourcemanager.apicenter.models.ManagedServiceIdentity; -import com.azure.resourcemanager.apicenter.models.ManagedServiceIdentityType; -import com.azure.resourcemanager.apicenter.models.ServiceCollection; -import com.azure.resourcemanager.apicenter.models.UserAssignedIdentity; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class ServiceCollectionTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ServiceCollection model = - BinaryData - .fromString( - "{\"value\":[{\"properties\":{\"provisioningState\":\"Succeeded\"},\"identity\":{\"principalId\":\"d5c227d3-e0ef-4fc3-b3de-f34544ba7047\",\"tenantId\":\"9b522761-456f-4aec-a803-753e1fecbfa9\",\"type\":\"SystemAssigned,UserAssigned\",\"userAssignedIdentities\":{\"fpikxwczb\":{\"principalId\":\"31ccd157-65f2-4f42-81d6-445eb56563cb\",\"clientId\":\"206b9bbb-9dc6-4ce5-88d2-ecf6f95f1276\"},\"npqxuh\":{\"principalId\":\"1fa4e505-77df-4fea-960e-d59386b269d5\",\"clientId\":\"ece22af9-fae3-473d-b613-de8de42e80a8\"},\"qniwbybrkxvdumj\":{\"principalId\":\"6a9b163f-6960-46ed-a8bc-a41602ef7d69\",\"clientId\":\"9a8c80e6-3dff-4f89-a7cc-20bf79ce8039\"},\"fwvuk\":{\"principalId\":\"b79e122d-1510-47ff-9b3f-00e75de1f7f6\",\"clientId\":\"73629f88-e12c-4df0-88fb-26e7240429d2\"}}},\"location\":\"audccsnhs\",\"tags\":{\"yhtnapczwlokjye\":\"yejhk\",\"jnchgej\":\"kkvnipjox\",\"huxinpmqnj\":\"podmailzydehojwy\",\"vcputegj\":\"qwixjspro\"},\"id\":\"wmfdatscmdvpjhul\",\"name\":\"uuvmkjozkrwfnd\",\"type\":\"odjpslwejd\"}],\"nextLink\":\"wryoqpsoacc\"}") - .toObject(ServiceCollection.class); - Assertions.assertEquals("audccsnhs", model.value().get(0).location()); - Assertions.assertEquals("yejhk", model.value().get(0).tags().get("yhtnapczwlokjye")); - Assertions - .assertEquals( - ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED, model.value().get(0).identity().type()); - Assertions.assertEquals("wryoqpsoacc", model.nextLink()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ServiceCollection model = - new ServiceCollection() - .withValue( - Arrays - .asList( - new ServiceInner() - .withLocation("audccsnhs") - .withTags( - mapOf( - "yhtnapczwlokjye", - "yejhk", - "jnchgej", - "kkvnipjox", - "huxinpmqnj", - "podmailzydehojwy", - "vcputegj", - "qwixjspro")) - .withIdentity( - new ManagedServiceIdentity() - .withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED) - .withUserAssignedIdentities( - mapOf( - "fpikxwczb", - new UserAssignedIdentity(), - "npqxuh", - new UserAssignedIdentity(), - "qniwbybrkxvdumj", - new UserAssignedIdentity(), - "fwvuk", - new UserAssignedIdentity()))))) - .withNextLink("wryoqpsoacc"); - model = BinaryData.fromObject(model).toObject(ServiceCollection.class); - Assertions.assertEquals("audccsnhs", model.value().get(0).location()); - Assertions.assertEquals("yejhk", model.value().get(0).tags().get("yhtnapczwlokjye")); - Assertions - .assertEquals( - ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED, model.value().get(0).identity().type()); - Assertions.assertEquals("wryoqpsoacc", model.nextLink()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ServiceInnerTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ServiceInnerTests.java index 20cdb35d1f11e..72209a21efd7e 100644 --- a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ServiceInnerTests.java +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ServiceInnerTests.java @@ -8,6 +8,7 @@ import com.azure.resourcemanager.apicenter.fluent.models.ServiceInner; import com.azure.resourcemanager.apicenter.models.ManagedServiceIdentity; import com.azure.resourcemanager.apicenter.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.apicenter.models.ServiceProperties; import com.azure.resourcemanager.apicenter.models.UserAssignedIdentity; import java.util.HashMap; import java.util.Map; @@ -16,11 +17,9 @@ public final class ServiceInnerTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { - ServiceInner model = - BinaryData - .fromString( - "{\"properties\":{\"provisioningState\":\"Failed\"},\"identity\":{\"principalId\":\"d5d0df07-26af-4baa-92d9-47bdb47df4cd\",\"tenantId\":\"61afb0e5-40b8-41b6-b5f2-f835b8c17c59\",\"type\":\"UserAssigned\",\"userAssignedIdentities\":{\"ryffdfdosy\":{\"principalId\":\"356f73d2-54c6-46f0-a527-369175dd5245\",\"clientId\":\"aa470577-53b5-49ee-8603-8a643614b9c7\"},\"paojakhmsbzjh\":{\"principalId\":\"c10a0704-c7b2-414b-af28-c00ed76ecf8e\",\"clientId\":\"6a27b9b8-d17c-40cb-934f-e9f2df2efccf\"},\"evdphlxaol\":{\"principalId\":\"0a2e3c70-446a-4bbd-95bf-7be6cab57a01\",\"clientId\":\"00efb53b-6b97-46dc-a25e-19af51ee25d9\"},\"trg\":{\"principalId\":\"b7da0e44-2f8c-47a5-8c82-8f8b6a90433a\",\"clientId\":\"0921520b-f5ba-4d8c-af40-e6fd9eb5e887\"}}},\"location\":\"bpf\",\"tags\":{\"wzo\":\"inzgvfcj\"},\"id\":\"xjtfelluwfzit\",\"name\":\"np\",\"type\":\"qfpjk\"}") - .toObject(ServiceInner.class); + ServiceInner model = BinaryData.fromString( + "{\"properties\":{\"provisioningState\":\"Failed\"},\"identity\":{\"principalId\":\"90ab8fdb-221e-43b1-839e-de2c0546a949\",\"tenantId\":\"8b5c622f-d4f0-4d67-b39b-dde9ec8b06e2\",\"type\":\"UserAssigned\",\"userAssignedIdentities\":{\"ryffdfdosy\":{\"principalId\":\"d37fd97e-c520-4d37-a9d0-5e8bf75d9b7a\",\"clientId\":\"a8560249-9871-49a1-879e-0a1916755369\"},\"paojakhmsbzjh\":{\"principalId\":\"c4c37c94-4ca9-4272-bf73-87ada01c64c7\",\"clientId\":\"b15bc063-e4f1-432c-a705-387406e56f19\"},\"evdphlxaol\":{\"principalId\":\"bedffab6-0b39-4e6c-b887-11adc65c9144\",\"clientId\":\"88aa154a-b7aa-4337-8560-deb9c37dd9c8\"},\"trg\":{\"principalId\":\"f5358cb3-028a-40f6-b54e-8b7359cc2ddb\",\"clientId\":\"41f3ddc7-bf06-420b-9ef5-4ec71f0e91b9\"}}},\"location\":\"bpf\",\"tags\":{\"wzo\":\"inzgvfcj\"},\"id\":\"xjtfelluwfzit\",\"name\":\"np\",\"type\":\"qfpjk\"}") + .toObject(ServiceInner.class); Assertions.assertEquals("bpf", model.location()); Assertions.assertEquals("inzgvfcj", model.tags().get("wzo")); Assertions.assertEquals(ManagedServiceIdentityType.USER_ASSIGNED, model.identity().type()); @@ -28,23 +27,12 @@ public void testDeserialize() throws Exception { @org.junit.jupiter.api.Test public void testSerialize() throws Exception { - ServiceInner model = - new ServiceInner() - .withLocation("bpf") - .withTags(mapOf("wzo", "inzgvfcj")) - .withIdentity( - new ManagedServiceIdentity() - .withType(ManagedServiceIdentityType.USER_ASSIGNED) - .withUserAssignedIdentities( - mapOf( - "ryffdfdosy", - new UserAssignedIdentity(), - "paojakhmsbzjh", - new UserAssignedIdentity(), - "evdphlxaol", - new UserAssignedIdentity(), - "trg", - new UserAssignedIdentity()))); + ServiceInner model = new ServiceInner().withLocation("bpf").withTags(mapOf("wzo", "inzgvfcj")) + .withProperties(new ServiceProperties()) + .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities( + mapOf("ryffdfdosy", new UserAssignedIdentity(), "paojakhmsbzjh", new UserAssignedIdentity(), + "evdphlxaol", new UserAssignedIdentity(), "trg", new UserAssignedIdentity()))); model = BinaryData.fromObject(model).toObject(ServiceInner.class); Assertions.assertEquals("bpf", model.location()); Assertions.assertEquals("inzgvfcj", model.tags().get("wzo")); diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ServiceListResultTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ServiceListResultTests.java new file mode 100644 index 0000000000000..ace68536cd5a6 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ServiceListResultTests.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.apicenter.models.ServiceListResult; + +public final class ServiceListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ServiceListResult model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"provisioningState\":\"Succeeded\"},\"identity\":{\"principalId\":\"53494acd-0159-49e3-9bb3-c8bcc3c5fbf3\",\"tenantId\":\"7296b274-e208-4a48-a855-2a03d2f3ad1b\",\"type\":\"SystemAssigned,UserAssigned\",\"userAssignedIdentities\":{\"fpikxwczb\":{\"principalId\":\"b9ee25f0-93ed-4784-83ce-e0538db0de19\",\"clientId\":\"619de22b-2179-490a-927d-95ffc7bfa7fc\"},\"npqxuh\":{\"principalId\":\"ad2de0fd-6403-4ecf-ae04-4e2578e77455\",\"clientId\":\"48b8ac28-d1c5-4d5f-a117-c2e528302cd6\"},\"qniwbybrkxvdumj\":{\"principalId\":\"dbe4b327-abc3-4faf-bdfb-80517e805829\",\"clientId\":\"a542f66a-8b57-4bd9-9800-0577400bffac\"},\"fwvuk\":{\"principalId\":\"ef7161d8-f83e-4c1a-b1c8-102828c22a08\",\"clientId\":\"4c6f675b-0517-4c9c-bc55-bc5c3f64be2d\"}}},\"location\":\"audccsnhs\",\"tags\":{\"yhtnapczwlokjye\":\"yejhk\",\"jnchgej\":\"kkvnipjox\",\"huxinpmqnj\":\"podmailzydehojwy\",\"vcputegj\":\"qwixjspro\"},\"id\":\"wmfdatscmdvpjhul\",\"name\":\"uuvmkjozkrwfnd\",\"type\":\"odjpslwejd\"}],\"nextLink\":\"wryoqpsoacc\"}") + .toObject(ServiceListResult.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ServiceListResult model = new ServiceListResult(); + model = BinaryData.fromObject(model).toObject(ServiceListResult.class); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ServicePropertiesTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ServicePropertiesTests.java index 11fd38cc933d1..8e3cd4e273f5a 100644 --- a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ServicePropertiesTests.java +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ServicePropertiesTests.java @@ -5,13 +5,13 @@ package com.azure.resourcemanager.apicenter.generated; import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.apicenter.fluent.models.ServiceProperties; +import com.azure.resourcemanager.apicenter.models.ServiceProperties; public final class ServicePropertiesTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { - ServiceProperties model = - BinaryData.fromString("{\"provisioningState\":\"Canceled\"}").toObject(ServiceProperties.class); + ServiceProperties model + = BinaryData.fromString("{\"provisioningState\":\"Canceled\"}").toObject(ServiceProperties.class); } @org.junit.jupiter.api.Test diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ServiceUpdateTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ServiceUpdateTests.java index b026e07d6328d..b2a4a797891aa 100644 --- a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ServiceUpdateTests.java +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ServiceUpdateTests.java @@ -5,18 +5,45 @@ package com.azure.resourcemanager.apicenter.generated; import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.apicenter.models.ManagedServiceIdentity; +import com.azure.resourcemanager.apicenter.models.ManagedServiceIdentityType; import com.azure.resourcemanager.apicenter.models.ServiceUpdate; +import com.azure.resourcemanager.apicenter.models.UserAssignedIdentity; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; public final class ServiceUpdateTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { - ServiceUpdate model = - BinaryData.fromString("{\"properties\":{\"provisioningState\":\"Failed\"}}").toObject(ServiceUpdate.class); + ServiceUpdate model = BinaryData.fromString( + "{\"identity\":{\"principalId\":\"0673ac01-ce57-4d04-8ae5-fa0811b1c484\",\"tenantId\":\"1ad444b4-1453-4801-9cb9-233b62fcc6c9\",\"type\":\"SystemAssigned\",\"userAssignedIdentities\":{\"ygxgispemvtz\":{\"principalId\":\"99645cd9-e4e9-49d8-96a4-c0da20d1e577\",\"clientId\":\"4e75dad7-4ffd-4bd2-b56a-aee5cca95938\"},\"fublj\":{\"principalId\":\"7813a81a-8d5b-472f-b2d1-392b181d70b1\",\"clientId\":\"41fa3722-244c-40e4-9235-b7a11cc355dd\"},\"qeof\":{\"principalId\":\"72a5928b-89f5-4674-9ef7-ad610504180e\",\"clientId\":\"8b5f4ce9-51a2-4bb0-835a-97a6017ea31d\"}}},\"tags\":{\"msmjqulngsntn\":\"qjhqjbas\"}}") + .toObject(ServiceUpdate.class); + Assertions.assertEquals(ManagedServiceIdentityType.SYSTEM_ASSIGNED, model.identity().type()); + Assertions.assertEquals("qjhqjbas", model.tags().get("msmjqulngsntn")); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { - ServiceUpdate model = new ServiceUpdate(); + ServiceUpdate model = new ServiceUpdate() + .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED) + .withUserAssignedIdentities(mapOf("ygxgispemvtz", new UserAssignedIdentity(), "fublj", + new UserAssignedIdentity(), "qeof", new UserAssignedIdentity()))) + .withTags(mapOf("msmjqulngsntn", "qjhqjbas")); model = BinaryData.fromObject(model).toObject(ServiceUpdate.class); + Assertions.assertEquals(ManagedServiceIdentityType.SYSTEM_ASSIGNED, model.identity().type()); + Assertions.assertEquals("qjhqjbas", model.tags().get("msmjqulngsntn")); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; } } diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ServicesCreateOrUpdateWithResponseMockTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ServicesCreateOrUpdateWithResponseMockTests.java index d256fdae20e3f..a8aa45a19e84b 100644 --- a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ServicesCreateOrUpdateWithResponseMockTests.java +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ServicesCreateOrUpdateWithResponseMockTests.java @@ -15,6 +15,7 @@ import com.azure.resourcemanager.apicenter.models.ManagedServiceIdentity; import com.azure.resourcemanager.apicenter.models.ManagedServiceIdentityType; import com.azure.resourcemanager.apicenter.models.Service; +import com.azure.resourcemanager.apicenter.models.ServiceProperties; import com.azure.resourcemanager.apicenter.models.UserAssignedIdentity; import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; @@ -35,58 +36,35 @@ public void testCreateOrUpdateWithResponse() throws Exception { HttpResponse httpResponse = Mockito.mock(HttpResponse.class); ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - String responseStr = - "{\"properties\":{\"provisioningState\":\"Failed\"},\"identity\":{\"principalId\":\"09d969e0-8912-41e0-83f3-4d59c3b38494\",\"tenantId\":\"8a8757af-25fc-4b22-8cba-6a7e879fef62\",\"type\":\"None\",\"userAssignedIdentities\":{\"nohjt\":{\"principalId\":\"faba7cbf-d116-4d99-bedc-38cc45aac6c7\",\"clientId\":\"3b143447-ee65-45e6-800a-709faf27b2f3\"},\"h\":{\"principalId\":\"250d95d1-1c2c-499a-85a2-8da1bf352c5f\",\"clientId\":\"194bab30-7616-4423-9bc5-8460f35a1d1f\"},\"ifiyipjxsqwpgrj\":{\"principalId\":\"e1176e05-a394-430d-b649-9352937f0b39\",\"clientId\":\"5805bba2-c4f5-49f4-b290-70d3ca8d9a48\"},\"orcjxvsnby\":{\"principalId\":\"0532ff43-0cbc-428d-9d18-2fab3317f8db\",\"clientId\":\"85e33bf6-eece-4e65-86a3-e09d2f837654\"}}},\"location\":\"abnmocpcyshu\",\"tags\":{\"gpbtoqcjmklj\":\"fblj\",\"qajzyulpkudjkr\":\"vbqid\",\"e\":\"khbzhfepgzg\",\"scpai\":\"zloc\"},\"id\":\"rhhbcs\",\"name\":\"l\",\"type\":\"mmajtjaodx\"}"; + String responseStr + = "{\"properties\":{\"provisioningState\":\"Succeeded\"},\"identity\":{\"principalId\":\"f61d776f-58df-489c-8d8a-4a2aa9a956aa\",\"tenantId\":\"f1e53774-6500-4c12-9baf-ead965993b37\",\"type\":\"SystemAssigned,UserAssigned\",\"userAssignedIdentities\":{\"mubyynt\":{\"principalId\":\"bb08376d-bb27-4ae2-aa13-ad3ee818d332\",\"clientId\":\"50e43af6-1b30-496b-8135-c8df929ddee8\"},\"bqtkoievseotgqr\":{\"principalId\":\"4118343a-b4c8-400b-8948-96d08b8b19ca\",\"clientId\":\"3f8ff19e-7f53-4f28-8100-f714a1280a05\"},\"muwlauwzizxbm\":{\"principalId\":\"005584e9-0237-448a-bfc2-a6205ee0325a\",\"clientId\":\"b7393661-ce8c-495f-bf6b-b20048537bf6\"}}},\"location\":\"cjefuzmu\",\"tags\":{\"bhjpglkfgohdne\":\"ttdumorppxebmnzb\",\"phsdyhto\":\"el\",\"v\":\"fikdowwqu\"},\"id\":\"zx\",\"name\":\"lvithhqzonosgg\",\"type\":\"hcohfwdsjnk\"}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) + Mockito.when(httpResponse.getBody()) .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) + Mockito.when(httpResponse.getBodyAsByteArray()) .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); + Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); - ApiCenterManager manager = - ApiCenterManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); + ApiCenterManager manager = ApiCenterManager.configure().withHttpClient(httpClient).authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); - Service response = - manager - .services() - .define("gazxuf") - .withRegion("mijcmmxdcufufs") - .withExistingResourceGroup("prwzwbnguitnwui") - .withTags(mapOf("sgfyccsnew", "mzidnsezcxtb", "oosflnr", "dwzjeiach")) - .withIdentity( - new ManagedServiceIdentity() - .withType(ManagedServiceIdentityType.NONE) - .withUserAssignedIdentities( - mapOf( - "dfvzwdzuhty", - new UserAssignedIdentity(), - "sdkf", - new UserAssignedIdentity(), - "xmnteiwaop", - new UserAssignedIdentity()))) - .create(); + Service response = manager.services().define("vwiwubmwmbesld").withRegion("ikvmkqzeqqk") + .withExistingResourceGroup("tshhszhedp").withTags(mapOf("bdagxt", "fzxmhhvhgureodkw")) + .withProperties(new ServiceProperties()) + .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED) + .withUserAssignedIdentities( + mapOf("ogaok", new UserAssignedIdentity(), "m", new UserAssignedIdentity()))) + .create(); - Assertions.assertEquals("abnmocpcyshu", response.location()); - Assertions.assertEquals("fblj", response.tags().get("gpbtoqcjmklj")); - Assertions.assertEquals(ManagedServiceIdentityType.NONE, response.identity().type()); + Assertions.assertEquals("cjefuzmu", response.location()); + Assertions.assertEquals("ttdumorppxebmnzb", response.tags().get("bhjpglkfgohdne")); + Assertions.assertEquals(ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED, response.identity().type()); } // Use "Map.of" if available diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ServicesDeleteByResourceGroupWithResponseMockTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ServicesDeleteByResourceGroupWithResponseMockTests.java index 30c7bb2764e4e..72de7fa2ea069 100644 --- a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ServicesDeleteByResourceGroupWithResponseMockTests.java +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ServicesDeleteByResourceGroupWithResponseMockTests.java @@ -32,30 +32,20 @@ public void testDeleteWithResponse() throws Exception { Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) + Mockito.when(httpResponse.getBody()) .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) + Mockito.when(httpResponse.getBodyAsByteArray()) .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - ApiCenterManager manager = - ApiCenterManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - manager.services().deleteByResourceGroupWithResponse("ysszdnrujqguh", "uouq", com.azure.core.util.Context.NONE); + Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + ApiCenterManager manager = ApiCenterManager.configure().withHttpClient(httpClient).authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + manager.services().deleteByResourceGroupWithResponse("dzu", "erscdntne", com.azure.core.util.Context.NONE); + } } diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ServicesExportMetadataSchemaMockTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ServicesExportMetadataSchemaMockTests.java new file mode 100644 index 0000000000000..143c74fc1cc47 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ServicesExportMetadataSchemaMockTests.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.apicenter.ApiCenterManager; +import com.azure.resourcemanager.apicenter.models.MetadataAssignmentEntity; +import com.azure.resourcemanager.apicenter.models.MetadataSchemaExportFormat; +import com.azure.resourcemanager.apicenter.models.MetadataSchemaExportRequest; +import com.azure.resourcemanager.apicenter.models.MetadataSchemaExportResult; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class ServicesExportMetadataSchemaMockTests { + @Test + public void testExportMetadataSchema() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = "{\"format\":\"inline\",\"value\":\"n\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito.when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito.when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + ApiCenterManager manager = ApiCenterManager.configure().withHttpClient(httpClient).authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + MetadataSchemaExportResult response = manager.services().exportMetadataSchema("fiwjmygtdssls", "tmweriofzpyq", + new MetadataSchemaExportRequest().withAssignedTo(MetadataAssignmentEntity.ENVIRONMENT), + com.azure.core.util.Context.NONE); + + Assertions.assertEquals(MetadataSchemaExportFormat.INLINE, response.format()); + Assertions.assertEquals("n", response.value()); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ServicesGetByResourceGroupWithResponseMockTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ServicesGetByResourceGroupWithResponseMockTests.java index 0efe7d20feeb9..4b7b41f37b786 100644 --- a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ServicesGetByResourceGroupWithResponseMockTests.java +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ServicesGetByResourceGroupWithResponseMockTests.java @@ -31,43 +31,29 @@ public void testGetByResourceGroupWithResponse() throws Exception { HttpResponse httpResponse = Mockito.mock(HttpResponse.class); ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - String responseStr = - "{\"properties\":{\"provisioningState\":\"Failed\"},\"identity\":{\"principalId\":\"6f731a29-0be4-47ba-9e85-1ba721e4cb58\",\"tenantId\":\"a2be8a43-20f4-4f59-a7ef-42b25de975e5\",\"type\":\"SystemAssigned\",\"userAssignedIdentities\":{\"pspwgcuertu\":{\"principalId\":\"16471a44-edb6-4247-a41a-7e80af6f4d86\",\"clientId\":\"54ec2277-3814-43c8-aa38-6a10cc1dd69f\"},\"o\":{\"principalId\":\"b5b2e62e-9887-47f1-b472-bc52fa99c0a4\",\"clientId\":\"88d6aec6-ef30-4c8b-b022-9bd241658394\"},\"whbmd\":{\"principalId\":\"bd1ee07d-b3f0-430c-8224-c57821fca4ad\",\"clientId\":\"468e7d9a-d6ea-4296-93c3-20165b3da059\"},\"jfddgmbmbe\":{\"principalId\":\"6ddfe660-9092-41f9-b6bc-5afd4f636e7e\",\"clientId\":\"8a0eea8d-485f-414b-9640-cd5b168da89f\"}}},\"location\":\"pbhtqqrolfpfpsa\",\"tags\":{\"gjyjgzjaoyfhrtxi\":\"qux\",\"rkujy\":\"n\"},\"id\":\"vlejuvfqa\",\"name\":\"rlyxwjkcprbnw\",\"type\":\"xgjvtbv\"}"; + String responseStr + = "{\"properties\":{\"provisioningState\":\"Canceled\"},\"identity\":{\"principalId\":\"a06d8e00-7cc0-4198-b8a3-ea2d32d2bb23\",\"tenantId\":\"396571b9-27f3-45b5-90da-f624a94ca3fc\",\"type\":\"SystemAssigned,UserAssigned\",\"userAssignedIdentities\":{\"uhavhql\":{\"principalId\":\"2c0055c5-f042-46a1-a2fc-e95f8b336f69\",\"clientId\":\"0affbc61-9d30-4a8a-b349-cfad9c10fc1c\"},\"umaq\":{\"principalId\":\"8406e33a-85b5-47db-b0aa-8415d4638704\",\"clientId\":\"0bcb29b0-0fe0-4452-9130-40c7e4c90c69\"}}},\"location\":\"bgycduiertgccym\",\"tags\":{\"ssl\":\"l\",\"d\":\"lfmmdnbbglzpswi\",\"bzmnvdfznud\":\"cwyhzdxssa\"},\"id\":\"od\",\"name\":\"xzb\",\"type\":\"cblylpstdbhhxsr\"}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) + Mockito.when(httpResponse.getBody()) .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) + Mockito.when(httpResponse.getBodyAsByteArray()) .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); + Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); - ApiCenterManager manager = - ApiCenterManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); + ApiCenterManager manager = ApiCenterManager.configure().withHttpClient(httpClient).authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); - Service response = - manager - .services() - .getByResourceGroupWithResponse("iqfouflmmnkz", "modmglougpb", com.azure.core.util.Context.NONE) - .getValue(); + Service response = manager.services() + .getByResourceGroupWithResponse("doy", "mifthnzdnd", com.azure.core.util.Context.NONE).getValue(); - Assertions.assertEquals("pbhtqqrolfpfpsa", response.location()); - Assertions.assertEquals("qux", response.tags().get("gjyjgzjaoyfhrtxi")); - Assertions.assertEquals(ManagedServiceIdentityType.SYSTEM_ASSIGNED, response.identity().type()); + Assertions.assertEquals("bgycduiertgccym", response.location()); + Assertions.assertEquals("l", response.tags().get("ssl")); + Assertions.assertEquals(ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED, response.identity().type()); } } diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ServicesListByResourceGroupMockTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ServicesListByResourceGroupMockTests.java index 4bdde9c178829..1f3f0083ea123 100644 --- a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ServicesListByResourceGroupMockTests.java +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ServicesListByResourceGroupMockTests.java @@ -32,40 +32,29 @@ public void testListByResourceGroup() throws Exception { HttpResponse httpResponse = Mockito.mock(HttpResponse.class); ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - String responseStr = - "{\"value\":[{\"properties\":{\"provisioningState\":\"Canceled\"},\"identity\":{\"principalId\":\"ca19e702-49f6-4557-935f-00d86f9c4a7e\",\"tenantId\":\"851c11a8-2022-4c51-864c-e4ef174a8471\",\"type\":\"UserAssigned\",\"userAssignedIdentities\":{\"pwcukjfkgiawxk\":{\"principalId\":\"9a8c92ff-3579-4df3-a371-41f629d9ffb6\",\"clientId\":\"1aad80e6-eccb-404f-b65b-5fee2b12c1c3\"},\"plwckbas\":{\"principalId\":\"9efd0e66-fb50-4315-8b05-e9e87247fcd0\",\"clientId\":\"d3830407-4127-464a-9c24-0882406e4ad3\"},\"nddhsgcbacph\":{\"principalId\":\"94662726-76b4-4444-98f2-c4d6c21d5d29\",\"clientId\":\"9c39ad31-605f-43d7-beb2-cd946e6318b8\"}}},\"location\":\"koty\",\"tags\":{\"gfgibm\":\"oulzndlikwyq\"},\"id\":\"dgak\",\"name\":\"qsrxybzqqed\",\"type\":\"ytb\"}]}"; + String responseStr + = "{\"value\":[{\"properties\":{\"provisioningState\":\"Failed\"},\"identity\":{\"principalId\":\"d481c023-b233-413f-ad56-d23029ade334\",\"tenantId\":\"6aad6db2-9441-49e8-bbe6-307eaf343503\",\"type\":\"None\",\"userAssignedIdentities\":{\"hqjohxcrsbfova\":{\"principalId\":\"293424b1-9c21-4ae1-be27-cdff040e4af9\",\"clientId\":\"8964597e-639a-4113-8f66-de1c97a3af27\"},\"uvwbhsqfs\":{\"principalId\":\"6dbf2210-57a8-4821-9900-03dfafcb71fc\",\"clientId\":\"17d01f92-41a9-45c3-a619-02a012bf1cf5\"},\"gjb\":{\"principalId\":\"3913798a-e8f0-4219-88bd-aa366449402f\",\"clientId\":\"6026d520-08e7-4910-8a6c-ebcd8552e0d5\"}}},\"location\":\"xb\",\"tags\":{\"t\":\"srfbjfdtwss\",\"vwpm\":\"tpvjzbexilzznfqq\"},\"id\":\"taruoujmkcj\",\"name\":\"wqytjrybnwjewgdr\",\"type\":\"ervnaenqpehi\"}]}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) + Mockito.when(httpResponse.getBody()) .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) + Mockito.when(httpResponse.getBodyAsByteArray()) .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); + Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); - ApiCenterManager manager = - ApiCenterManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); + ApiCenterManager manager = ApiCenterManager.configure().withHttpClient(httpClient).authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); - PagedIterable response = - manager.services().listByResourceGroup("aozwyiftyhxhu", com.azure.core.util.Context.NONE); + PagedIterable response + = manager.services().listByResourceGroup("ytkblmpew", com.azure.core.util.Context.NONE); - Assertions.assertEquals("koty", response.iterator().next().location()); - Assertions.assertEquals("oulzndlikwyq", response.iterator().next().tags().get("gfgibm")); - Assertions.assertEquals(ManagedServiceIdentityType.USER_ASSIGNED, response.iterator().next().identity().type()); + Assertions.assertEquals("xb", response.iterator().next().location()); + Assertions.assertEquals("srfbjfdtwss", response.iterator().next().tags().get("t")); + Assertions.assertEquals(ManagedServiceIdentityType.NONE, response.iterator().next().identity().type()); } } diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ServicesListMockTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ServicesListMockTests.java index 74f178759e31b..04435e6e5e905 100644 --- a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ServicesListMockTests.java +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ServicesListMockTests.java @@ -32,41 +32,28 @@ public void testList() throws Exception { HttpResponse httpResponse = Mockito.mock(HttpResponse.class); ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - String responseStr = - "{\"value\":[{\"properties\":{\"provisioningState\":\"Succeeded\"},\"identity\":{\"principalId\":\"48a3f512-7134-4ee4-aa24-ca905f619ca5\",\"tenantId\":\"7db02f48-1618-4f8a-8b83-ad0f5215e1e8\",\"type\":\"SystemAssigned,UserAssigned\",\"userAssignedIdentities\":{\"gc\":{\"principalId\":\"8523a145-df2c-4612-8aaa-dd0b78e6c31a\",\"clientId\":\"b0a8388c-970b-40f7-83dc-055df8b2d737\"},\"clxxwrljdo\":{\"principalId\":\"141690ac-3047-45e6-b13a-b9f1c2de8ff3\",\"clientId\":\"dcca8e7a-3249-4823-a9ec-482eb372a7a9\"},\"cqvkocrcjdkwtn\":{\"principalId\":\"1932a072-a923-48c2-a191-bb0c8fd4b7c9\",\"clientId\":\"582cc7d4-08ae-4dd0-a71c-9d84b1cd0d84\"}}},\"location\":\"bnjbiksqrglssain\",\"tags\":{\"mgxsab\":\"wnzlljfmppeeb\",\"jczdzevndh\":\"yqduujit\",\"feusnhut\":\"rwpdappdsbdkvwrw\"},\"id\":\"eltmrldhugjzzdat\",\"name\":\"xhocdgeablgphuti\",\"type\":\"ndv\"}]}"; + String responseStr + = "{\"value\":[{\"properties\":{\"provisioningState\":\"Succeeded\"},\"identity\":{\"principalId\":\"6a734486-5c53-4a37-b47b-df965b1665f1\",\"tenantId\":\"f7668c9a-9dea-4b04-99b7-775fccae75bd\",\"type\":\"UserAssigned\",\"userAssignedIdentities\":{\"ctobg\":{\"principalId\":\"73f7d595-a7fa-4e07-8f0a-5584d8814194\",\"clientId\":\"abc2645d-e551-4a56-8312-8db199d8a9d9\"},\"moizpos\":{\"principalId\":\"3ecb246c-6558-4017-92b0-499cf3b840bc\",\"clientId\":\"6d743c2e-dc54-4f13-9bea-45a9402233e6\"}}},\"location\":\"grcfb\",\"tags\":{\"jy\":\"mfqjhhkxbp\",\"u\":\"jhxxjyn\",\"xqzvszjfa\":\"ivkrtsw\",\"ivetvtcq\":\"vjfdx\"},\"id\":\"qtdo\",\"name\":\"mcbxvwvxysl\",\"type\":\"bhsfxob\"}]}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) + Mockito.when(httpResponse.getBody()) .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) + Mockito.when(httpResponse.getBodyAsByteArray()) .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); + Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); - ApiCenterManager manager = - ApiCenterManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); + ApiCenterManager manager = ApiCenterManager.configure().withHttpClient(httpClient).authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); PagedIterable response = manager.services().list(com.azure.core.util.Context.NONE); - Assertions.assertEquals("bnjbiksqrglssain", response.iterator().next().location()); - Assertions.assertEquals("wnzlljfmppeeb", response.iterator().next().tags().get("mgxsab")); - Assertions - .assertEquals( - ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED, response.iterator().next().identity().type()); + Assertions.assertEquals("grcfb", response.iterator().next().location()); + Assertions.assertEquals("mfqjhhkxbp", response.iterator().next().tags().get("jy")); + Assertions.assertEquals(ManagedServiceIdentityType.USER_ASSIGNED, response.iterator().next().identity().type()); } } diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/TermsOfServiceTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/TermsOfServiceTests.java new file mode 100644 index 0000000000000..436752c0352c9 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/TermsOfServiceTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.apicenter.models.TermsOfService; +import org.junit.jupiter.api.Assertions; + +public final class TermsOfServiceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + TermsOfService model = BinaryData.fromString("{\"url\":\"hocohslkev\"}").toObject(TermsOfService.class); + Assertions.assertEquals("hocohslkev", model.url()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + TermsOfService model = new TermsOfService().withUrl("hocohslkev"); + model = BinaryData.fromObject(model).toObject(TermsOfService.class); + Assertions.assertEquals("hocohslkev", model.url()); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/UserAssignedIdentityTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/UserAssignedIdentityTests.java index 8b7c0bdb73e75..90aad1701a445 100644 --- a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/UserAssignedIdentityTests.java +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/UserAssignedIdentityTests.java @@ -10,11 +10,9 @@ public final class UserAssignedIdentityTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { - UserAssignedIdentity model = - BinaryData - .fromString( - "{\"principalId\":\"ceac3661-ac7c-4dfa-ab12-469764584d98\",\"clientId\":\"78742b05-33ad-4741-afa7-43bace86d641\"}") - .toObject(UserAssignedIdentity.class); + UserAssignedIdentity model = BinaryData.fromString( + "{\"principalId\":\"2411aa04-f538-4add-ab88-7268c94832ca\",\"clientId\":\"32b93a77-bbad-42a1-87c8-a133b14e16c8\"}") + .toObject(UserAssignedIdentity.class); } @org.junit.jupiter.api.Test diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/WorkspaceInnerTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/WorkspaceInnerTests.java new file mode 100644 index 0000000000000..b509af569f5a3 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/WorkspaceInnerTests.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.apicenter.fluent.models.WorkspaceInner; +import com.azure.resourcemanager.apicenter.models.WorkspaceProperties; +import org.junit.jupiter.api.Assertions; + +public final class WorkspaceInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + WorkspaceInner model = BinaryData.fromString( + "{\"properties\":{\"title\":\"gjvtbv\",\"description\":\"sszdnru\"},\"id\":\"guhmuouqfpr\",\"name\":\"zw\",\"type\":\"nguitnwuizgazxu\"}") + .toObject(WorkspaceInner.class); + Assertions.assertEquals("gjvtbv", model.properties().title()); + Assertions.assertEquals("sszdnru", model.properties().description()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + WorkspaceInner model = new WorkspaceInner() + .withProperties(new WorkspaceProperties().withTitle("gjvtbv").withDescription("sszdnru")); + model = BinaryData.fromObject(model).toObject(WorkspaceInner.class); + Assertions.assertEquals("gjvtbv", model.properties().title()); + Assertions.assertEquals("sszdnru", model.properties().description()); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/WorkspaceListResultTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/WorkspaceListResultTests.java new file mode 100644 index 0000000000000..d9ab62c12a48d --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/WorkspaceListResultTests.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.apicenter.models.WorkspaceListResult; + +public final class WorkspaceListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + WorkspaceListResult model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"title\":\"ex\",\"description\":\"bhtqqrolfpfpsa\"},\"id\":\"bquxigjy\",\"name\":\"gzjaoyfhrtxilne\",\"type\":\"kujysvlejuvfq\"}],\"nextLink\":\"rlyxwjkcprbnw\"}") + .toObject(WorkspaceListResult.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + WorkspaceListResult model = new WorkspaceListResult(); + model = BinaryData.fromObject(model).toObject(WorkspaceListResult.class); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/WorkspacePropertiesTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/WorkspacePropertiesTests.java new file mode 100644 index 0000000000000..dc5c677c0e183 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/WorkspacePropertiesTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.apicenter.models.WorkspaceProperties; +import org.junit.jupiter.api.Assertions; + +public final class WorkspacePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + WorkspaceProperties model + = BinaryData.fromString("{\"title\":\"izuckyfihrfidfvz\",\"description\":\"zuhtymwisdkfthwx\"}") + .toObject(WorkspaceProperties.class); + Assertions.assertEquals("izuckyfihrfidfvz", model.title()); + Assertions.assertEquals("zuhtymwisdkfthwx", model.description()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + WorkspaceProperties model + = new WorkspaceProperties().withTitle("izuckyfihrfidfvz").withDescription("zuhtymwisdkfthwx"); + model = BinaryData.fromObject(model).toObject(WorkspaceProperties.class); + Assertions.assertEquals("izuckyfihrfidfvz", model.title()); + Assertions.assertEquals("zuhtymwisdkfthwx", model.description()); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/WorkspacesCreateOrUpdateWithResponseMockTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/WorkspacesCreateOrUpdateWithResponseMockTests.java new file mode 100644 index 0000000000000..69a54b81a5e9d --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/WorkspacesCreateOrUpdateWithResponseMockTests.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.apicenter.ApiCenterManager; +import com.azure.resourcemanager.apicenter.models.Workspace; +import com.azure.resourcemanager.apicenter.models.WorkspaceProperties; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class WorkspacesCreateOrUpdateWithResponseMockTests { + @Test + public void testCreateOrUpdateWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr + = "{\"properties\":{\"title\":\"sorgj\",\"description\":\"bldtlww\"},\"id\":\"kdmtncvokotll\",\"name\":\"d\",\"type\":\"h\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito.when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito.when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + ApiCenterManager manager = ApiCenterManager.configure().withHttpClient(httpClient).authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + Workspace response = manager.workspaces().define("ntorzihleosjswsr").withExistingService("n", "jphuopxodlqi") + .withProperties(new WorkspaceProperties().withTitle("lyzrpzbchckqqzqi").withDescription("iysui")).create(); + + Assertions.assertEquals("sorgj", response.properties().title()); + Assertions.assertEquals("bldtlww", response.properties().description()); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/WorkspacesDeleteWithResponseMockTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/WorkspacesDeleteWithResponseMockTests.java new file mode 100644 index 0000000000000..8532565901e91 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/WorkspacesDeleteWithResponseMockTests.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.apicenter.ApiCenterManager; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class WorkspacesDeleteWithResponseMockTests { + @Test + public void testDeleteWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = "{}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito.when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito.when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + ApiCenterManager manager = ApiCenterManager.configure().withHttpClient(httpClient).authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + manager.workspaces().deleteWithResponse("jfqka", "e", "iipfpubj", com.azure.core.util.Context.NONE); + + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/WorkspacesGetWithResponseMockTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/WorkspacesGetWithResponseMockTests.java new file mode 100644 index 0000000000000..e487939ba5e27 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/WorkspacesGetWithResponseMockTests.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.apicenter.ApiCenterManager; +import com.azure.resourcemanager.apicenter.models.Workspace; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class WorkspacesGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr + = "{\"properties\":{\"title\":\"xywsuws\",\"description\":\"s\"},\"id\":\"sytgadgvraea\",\"name\":\"neqn\",\"type\":\"arrwlquu\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito.when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito.when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + ApiCenterManager manager = ApiCenterManager.configure().withHttpClient(httpClient).authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + Workspace response = manager.workspaces() + .getWithResponse("h", "pkkpw", "reqnovvqfov", com.azure.core.util.Context.NONE).getValue(); + + Assertions.assertEquals("xywsuws", response.properties().title()); + Assertions.assertEquals("s", response.properties().description()); + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/WorkspacesHeadWithResponseMockTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/WorkspacesHeadWithResponseMockTests.java new file mode 100644 index 0000000000000..13e3001f8c45d --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/WorkspacesHeadWithResponseMockTests.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.apicenter.ApiCenterManager; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class WorkspacesHeadWithResponseMockTests { + @Test + public void testHeadWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = "{}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito.when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito.when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + ApiCenterManager manager = ApiCenterManager.configure().withHttpClient(httpClient).authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + manager.workspaces().headWithResponse("bwwift", "hqkvpuvksgplsak", "ynfs", com.azure.core.util.Context.NONE); + + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/WorkspacesListMockTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/WorkspacesListMockTests.java new file mode 100644 index 0000000000000..6da005e768f09 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/WorkspacesListMockTests.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.apicenter.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.apicenter.ApiCenterManager; +import com.azure.resourcemanager.apicenter.models.Workspace; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class WorkspacesListMockTests { + @Test + public void testList() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr + = "{\"value\":[{\"properties\":{\"title\":\"byuqerpqlp\",\"description\":\"cciuqgbdbutau\"},\"id\":\"btkuwhh\",\"name\":\"hykojoxafnndlpic\",\"type\":\"koymkcd\"}]}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito.when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito.when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + ApiCenterManager manager = ApiCenterManager.configure().withHttpClient(httpClient).authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response + = manager.workspaces().list("kcnqxwbpo", "ulpiuj", "aasipqi", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("byuqerpqlp", response.iterator().next().properties().title()); + Assertions.assertEquals("cciuqgbdbutau", response.iterator().next().properties().description()); + } +}