diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/CHANGELOG.md b/sdk/apicenter/azure-resourcemanager-apicenter/CHANGELOG.md index a05146efbc307..3098339f877d8 100644 --- a/sdk/apicenter/azure-resourcemanager-apicenter/CHANGELOG.md +++ b/sdk/apicenter/azure-resourcemanager-apicenter/CHANGELOG.md @@ -1,6 +1,8 @@ # Release History -## 1.0.0-beta.2 (Unreleased) +## 1.0.0-beta.1 (2023-09-29) + +- 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). ### Features Added diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/README.md b/sdk/apicenter/azure-resourcemanager-apicenter/README.md index f7ca9adbede7f..21235669edad5 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-beta.2 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/SAMPLE.md b/sdk/apicenter/azure-resourcemanager-apicenter/SAMPLE.md index 003b7d4c062cc..4ef1feb9a2e78 100644 --- a/sdk/apicenter/azure-resourcemanager-apicenter/SAMPLE.md +++ b/sdk/apicenter/azure-resourcemanager-apicenter/SAMPLE.md @@ -1,25 +1,887 @@ # 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) +- [List](#operations_list) + +## Services + +- [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") + .withTitle("OpenAPI") + .withDescription("Default spec") + .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() + .exportSpecificationWithResponse( + "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 +import com.azure.resourcemanager.apicenter.models.ApiSpecImportRequest; +import com.azure.resourcemanager.apicenter.models.ApiSpecImportRequestSpecification; +import com.azure.resourcemanager.apicenter.models.ApiSpecImportSourceFormat; + +/** 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() + .importSpecificationWithResponse( + "contoso-resources", + "contoso", + "default", + "echo-api", + "2023-01-01", + "openapi", + new ApiSpecImportRequest() + .withValue("https://...") + .withFormat(ApiSpecImportSourceFormat.LINK) + .withSpecification(new ApiSpecImportRequestSpecification().withName("openapi").withValue("3.0.1")), + 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_List. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void apiDefinitionsList(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 +import com.azure.resourcemanager.apicenter.models.LifecycleStage; + +/** 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") + .withTitle("2023-01-01") + .withLifecycleStage(LifecycleStage.PRODUCTION) + .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_List. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void apiVersionsList(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 +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.apicenter.models.ApiType; +import com.azure.resourcemanager.apicenter.models.ExternalDocumentation; +import com.azure.resourcemanager.apicenter.models.License; +import com.azure.resourcemanager.apicenter.models.TermsOfService; +import java.io.IOException; +import java.util.Arrays; + +/** 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) + throws IOException { + manager + .apis() + .define("echo-api") + .withExistingWorkspace("contoso-resources", "contoso", "default") + .withTitle("Echo API") + .withTypePropertiesType(ApiType.REST) + .withDescription("A simple HTTP request/response service.") + .withTermsOfService(new TermsOfService().withUrl("https://contoso.com/terms-of-service")) + .withExternalDocumentation( + Arrays + .asList( + new ExternalDocumentation().withTitle("Onboarding docs").withUrl("https://docs.contoso.com"))) + .withLicense(new License().withUrl("https://contoso.com/license")) + .withCustomProperties( + SerializerFactory + .createDefaultManagementSerializerAdapter() + .deserialize("{\"author\":\"John Doe\"}", Object.class, SerializerEncoding.JSON)) + .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_List. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void apisList(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { + manager.apis().list("contoso-resources", "contoso", "default", null, com.azure.core.util.Context.NONE); + } +} +``` + +### Deployments_CreateOrUpdate + +```java +import com.azure.resourcemanager.apicenter.models.DeploymentServer; +import com.azure.resourcemanager.apicenter.models.DeploymentState; +import java.util.Arrays; + +/** 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") + .withTitle("Production deployment") + .withDescription("Public cloud production deployment.") + .withEnvironmentId("/workspaces/default/environments/production") + .withDefinitionId("/workspaces/default/apis/echo-api/versions/2023-01-01/definitions/openapi") + .withState(DeploymentState.ACTIVE) + .withServer(new DeploymentServer().withRuntimeUri(Arrays.asList("https://api.contoso.com"))) + .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); + } +} +``` -## Services +### 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_List. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void deploymentsList(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 +import com.azure.resourcemanager.apicenter.models.EnvironmentServer; +import com.azure.resourcemanager.apicenter.models.EnvironmentServerType; +import com.azure.resourcemanager.apicenter.models.EnvironmentType; +import com.azure.resourcemanager.apicenter.models.Onboarding; +import java.util.Arrays; + +/** 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") + .withTitle("Contoso Europe Azure API Management") + .withDescription("The primary Azure API Management service for the European division of Contoso.") + .withTypePropertiesType(EnvironmentType.PRODUCTION) + .withServer( + new EnvironmentServer() + .withType(EnvironmentServerType.AZURE_API_MANAGEMENT) + .withManagementPortalUri( + Arrays + .asList( + "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso-resources/providers/Microsoft.ApiManagement/service/contoso"))) + .withOnboarding( + new Onboarding() + .withInstructions( + "Sign in or sign up in the specified developer portal to request API access. You must complete" + + " the internal privacy training for your account to be approved.") + .withDeveloperPortalUri(Arrays.asList("https://developer.contoso.com"))) + .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_List. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void environmentsList(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { + manager.environments().list("contoso-resources", "contoso", "default", null, com.azure.core.util.Context.NONE); + } +} +``` + +### MetadataSchemas_CreateOrUpdate + +```java +import com.azure.resourcemanager.apicenter.models.MetadataAssignment; +import com.azure.resourcemanager.apicenter.models.MetadataAssignmentEntity; +import java.util.Arrays; + +/** 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") + .withSchema("{\"type\":\"string\", \"title\":\"Author\", pattern: \"^[a-zA-Z]+$\"}") + .withAssignedTo( + Arrays.asList(new MetadataAssignment().withEntity(MetadataAssignmentEntity.API).withDeprecated(true))) + .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_List. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void metadataSchemasList(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { + manager.metadataSchemas().list("contoso-resources", "contoso", null, com.azure.core.util.Context.NONE); + } +} +``` -- [CreateOrUpdate](#services_createorupdate) -- [Delete](#services_delete) -- [GetByResourceGroup](#services_getbyresourcegroup) -- [List](#services_list) -- [ListByResourceGroup](#services_listbyresourcegroup) -- [Update](#services_update) ### Operations_List ```java /** 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. @@ -38,7 +900,7 @@ public final class OperationsListSamples { /** 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. @@ -62,7 +924,7 @@ public final class ServicesCreateOrUpdateSamples { /** 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. @@ -77,13 +939,41 @@ public final class ServicesDeleteSamples { } ``` +### Services_ExportMetadataSchema + +```java +import com.azure.resourcemanager.apicenter.models.MetadataAssignmentEntity; +import com.azure.resourcemanager.apicenter.models.MetadataSchemaExportRequest; + +/** 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() + .exportMetadataSchemaWithResponse( + "contoso-resources", + "contoso", + new MetadataSchemaExportRequest().withAssignedTo(MetadataAssignmentEntity.API), + com.azure.core.util.Context.NONE); + } +} +``` + ### Services_GetByResourceGroup ```java /** 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. @@ -104,7 +994,7 @@ public final class ServicesGetByResourceGroupSamples { /** 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. @@ -123,7 +1013,7 @@ public final class ServicesListSamples { /** 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. @@ -144,7 +1034,7 @@ import com.azure.resourcemanager.apicenter.models.Service; /** 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. @@ -162,3 +1052,109 @@ public final class ServicesUpdateSamples { } ``` +### 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: Workspace_CreateOrUpdate. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void workspaceCreateOrUpdate(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { + manager + .workspaces() + .define("default") + .withExistingService("contoso-resources", "contoso") + .withTitle("default") + .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_List. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void workspacesList(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 dcefbed2c4668..e14148dd72f96 100644 --- a/sdk/apicenter/azure-resourcemanager-apicenter/pom.xml +++ b/sdk/apicenter/azure-resourcemanager-apicenter/pom.xml @@ -18,7 +18,7 @@ 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 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..47aa8300e8e7b 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; @@ -42,6 +56,20 @@ public final class ApiCenterManager { private Services services; + private MetadataSchemas metadataSchemas; + + private Workspaces workspaces; + + private Apis apis; + + private ApiVersions apiVersions; + + private ApiDefinitions apiDefinitions; + + private Deployments deployments; + + private Environments environments; + private final AzureApiCenter clientObject; private ApiCenterManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { @@ -288,6 +316,90 @@ 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 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 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 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. 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..fd717acbd78f2 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/ApiDefinitionsClient.java @@ -0,0 +1,382 @@ +// 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.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 { + /** + * List API definitions + * + *

Returns a collection of API definitions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 collection as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String resourceGroupName, String serviceName, String workspaceName, String apiName, String versionName); + + /** + * List API definitions + * + *

Returns a collection of API definitions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 aPI version collection 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); + + /** + * Get API definition + * + *

Returns details of the API definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApiDefinitionsGetResponse getWithResponse( + String resourceGroupName, + String serviceName, + String workspaceName, + String apiName, + String versionName, + String definitionName, + Context context); + + /** + * Get API definition + * + *

Returns details of the API definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApiDefinitionInner get( + String resourceGroupName, + String serviceName, + String workspaceName, + String apiName, + String versionName, + String definitionName); + + /** + * Create or update API definition + * + *

Creates new or updates existing API definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 payload API definition entity. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApiDefinitionsCreateOrUpdateResponse createOrUpdateWithResponse( + String resourceGroupName, + String serviceName, + String workspaceName, + String apiName, + String versionName, + String definitionName, + ApiDefinitionInner payload, + Context context); + + /** + * Create or update API definition + * + *

Creates new or updates existing API definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 payload API definition entity. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApiDefinitionInner createOrUpdate( + String resourceGroupName, + String serviceName, + String workspaceName, + String apiName, + String versionName, + String definitionName, + ApiDefinitionInner payload); + + /** + * Delete API definition + * + *

Deletes specified API definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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); + + /** + * Delete API definition + * + *

Deletes specified API definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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); + + /** + * Check API definition exists + * + *

Checks if specified API definition exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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); + + /** + * Check API definition exists + * + *

Checks if specified API definition exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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); + + /** + * Import API specification + * + *

Imports the API specification. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 payload The API specification source entity. + * @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 importSpecificationWithResponse( + String resourceGroupName, + String serviceName, + String workspaceName, + String apiName, + String versionName, + String definitionName, + ApiSpecImportRequest payload, + Context context); + + /** + * Import API specification + * + *

Imports the API specification. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 payload The API specification source entity. + * @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 payload); + + /** + * Export API specification + * + *

Exports the API specification. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response exportSpecificationWithResponse( + String resourceGroupName, + String serviceName, + String workspaceName, + String apiName, + String versionName, + String definitionName, + Context context); + + /** + * Export API specification + * + *

Exports the API specification. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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); +} 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..4be82fc78ac4f --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/ApiVersionsClient.java @@ -0,0 +1,240 @@ +// 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 { + /** + * List API versions + * + *

Returns a collection of API versions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 version collection as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String resourceGroupName, String serviceName, String workspaceName, String apiName); + + /** + * List API versions + * + *

Returns a collection of API versions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 aPI version collection as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String resourceGroupName, + String serviceName, + String workspaceName, + String apiName, + String filter, + Context context); + + /** + * Get API version + * + *

Returns details of the API version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApiVersionsGetResponse getWithResponse( + String resourceGroupName, + String serviceName, + String workspaceName, + String apiName, + String versionName, + Context context); + + /** + * Get API version + * + *

Returns details of the API version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApiVersionInner get( + String resourceGroupName, String serviceName, String workspaceName, String apiName, String versionName); + + /** + * Create or update API version + * + *

Creates new or updates existing API version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param payload API version entity. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApiVersionsCreateOrUpdateResponse createOrUpdateWithResponse( + String resourceGroupName, + String serviceName, + String workspaceName, + String apiName, + String versionName, + ApiVersionInner payload, + Context context); + + /** + * Create or update API version + * + *

Creates new or updates existing API version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param payload API version entity. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApiVersionInner createOrUpdate( + String resourceGroupName, + String serviceName, + String workspaceName, + String apiName, + String versionName, + ApiVersionInner payload); + + /** + * Delete API version + * + *

Deletes specified API version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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); + + /** + * Delete API version + * + *

Deletes specified API version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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); + + /** + * Check API version exists + * + *

Checks if specified API version exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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); + + /** + * Check API version exists + * + *

Checks if specified API version exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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..66140f205e758 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/ApisClient.java @@ -0,0 +1,202 @@ +// 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 { + /** + * List APIs + * + *

Returns a collection of APIs. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 aPI collection as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String serviceName, String workspaceName); + + /** + * List APIs + * + *

Returns a collection of APIs. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 aPI collection as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String resourceGroupName, String serviceName, String workspaceName, String filter, Context context); + + /** + * Get API + * + *

Returns details of the API. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApisGetResponse getWithResponse( + String resourceGroupName, String serviceName, String workspaceName, String apiName, Context context); + + /** + * Get API + * + *

Returns details of the API. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApiInner get(String resourceGroupName, String serviceName, String workspaceName, String apiName); + + /** + * Create or update API + * + *

Creates new or updates existing API. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param payload API entity. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApisCreateOrUpdateResponse createOrUpdateWithResponse( + String resourceGroupName, + String serviceName, + String workspaceName, + String apiName, + ApiInner payload, + Context context); + + /** + * Create or update API + * + *

Creates new or updates existing API. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param payload API entity. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApiInner createOrUpdate( + String resourceGroupName, String serviceName, String workspaceName, String apiName, ApiInner payload); + + /** + * Delete API + * + *

Deletes specified API. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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); + + /** + * Delete API + * + *

Deletes specified API. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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); + + /** + * Check if API exists + * + *

Checks if specified API exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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); + + /** + * Check if API exists + * + *

Checks if specified API exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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..b36a047d19779 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 @@ -10,7 +10,7 @@ /** 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. */ @@ -57,4 +57,53 @@ public interface AzureApiCenter { * @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 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 DeploymentsClient object to access its operations. + * + * @return the DeploymentsClient object. + */ + DeploymentsClient getDeployments(); + + /** + * 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..db4d227894c40 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/DeploymentsClient.java @@ -0,0 +1,242 @@ +// 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 { + /** + * List deployments + * + *

Returns a collection of API deployments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 deployment collection as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String resourceGroupName, String serviceName, String workspaceName, String apiName); + + /** + * List deployments + * + *

Returns a collection of API deployments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 aPI deployment collection as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String resourceGroupName, + String serviceName, + String workspaceName, + String apiName, + String filter, + Context context); + + /** + * Delete API deployment + * + *

Deletes API deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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); + + /** + * Delete API deployment + * + *

Deletes API deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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); + + /** + * Get API deployment + * + *

Returns details of the API deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DeploymentsGetResponse getWithResponse( + String resourceGroupName, + String serviceName, + String workspaceName, + String apiName, + String deploymentName, + Context context); + + /** + * Get API deployment + * + *

Returns details of the API deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DeploymentInner get( + String resourceGroupName, String serviceName, String workspaceName, String apiName, String deploymentName); + + /** + * Create or update API deployment + * + *

Creates new or updates existing API deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param deploymentName The name of the API deployment. + * @param payload API deployment entity. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DeploymentsCreateOrUpdateResponse createOrUpdateWithResponse( + String resourceGroupName, + String serviceName, + String workspaceName, + String apiName, + String deploymentName, + DeploymentInner payload, + Context context); + + /** + * Create or update API deployment + * + *

Creates new or updates existing API deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param deploymentName The name of the API deployment. + * @param payload API deployment entity. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DeploymentInner createOrUpdate( + String resourceGroupName, + String serviceName, + String workspaceName, + String apiName, + String deploymentName, + DeploymentInner payload); + + /** + * Check if API deployment exists + * + *

Checks if specified API deployment exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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); + + /** + * Check if API deployment exists + * + *

Checks if specified API deployment exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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..12e78828da194 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/EnvironmentsClient.java @@ -0,0 +1,206 @@ +// 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 { + /** + * List environments + * + *

Returns a collection of environments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 environments collection as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String serviceName, String workspaceName); + + /** + * List environments + * + *

Returns a collection of environments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 environments collection as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String resourceGroupName, String serviceName, String workspaceName, String filter, Context context); + + /** + * Create or update environment + * + *

Creates new or updates existing environment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @param workspaceName The name of the workspace. + * @param environmentName The name of the environment. + * @param payload Environment entity. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + EnvironmentsCreateOrUpdateResponse createOrUpdateWithResponse( + String resourceGroupName, + String serviceName, + String workspaceName, + String environmentName, + EnvironmentInner payload, + Context context); + + /** + * Create or update environment + * + *

Creates new or updates existing environment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @param workspaceName The name of the workspace. + * @param environmentName The name of the environment. + * @param payload Environment entity. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + EnvironmentInner createOrUpdate( + String resourceGroupName, + String serviceName, + String workspaceName, + String environmentName, + EnvironmentInner payload); + + /** + * Delete environment + * + *

Deletes the environment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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); + + /** + * Delete environment + * + *

Deletes the environment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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); + + /** + * Check if environment exists + * + *

Checks if specified environment exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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); + + /** + * Check if environment exists + * + *

Checks if specified environment exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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); + + /** + * Get environment + * + *

Returns details of the environment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + EnvironmentsGetResponse getWithResponse( + String resourceGroupName, String serviceName, String workspaceName, String environmentName, Context context); + + /** + * Get environment + * + *

Returns details of the environment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + EnvironmentInner get(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..9b65dc31d3cfd --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/MetadataSchemasClient.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.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 { + /** + * List metadata schemas + * + *

Returns a collection of metadata schemas. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 collection as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String serviceName); + + /** + * List metadata schemas + * + *

Returns a collection of metadata schemas. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 metadata schema collection as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String resourceGroupName, String serviceName, String filter, Context context); + + /** + * Get metadata schema + * + *

Returns details of the metadata schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MetadataSchemasGetResponse getWithResponse( + String resourceGroupName, String serviceName, String metadataSchemaName, Context context); + + /** + * Get metadata schema + * + *

Returns details of the metadata schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MetadataSchemaInner get(String resourceGroupName, String serviceName, String metadataSchemaName); + + /** + * Create or update metadata schema + * + *

Creates new or updates existing metadata schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @param metadataSchemaName The name of the metadata schema. + * @param payload Metadata schema entity. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MetadataSchemasCreateOrUpdateResponse createOrUpdateWithResponse( + String resourceGroupName, + String serviceName, + String metadataSchemaName, + MetadataSchemaInner payload, + Context context); + + /** + * Create or update metadata schema + * + *

Creates new or updates existing metadata schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @param metadataSchemaName The name of the metadata schema. + * @param payload Metadata schema entity. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MetadataSchemaInner createOrUpdate( + String resourceGroupName, String serviceName, String metadataSchemaName, MetadataSchemaInner payload); + + /** + * Delete metadata schema + * + *

Deletes specified metadata schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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); + + /** + * Delete metadata schema + * + *

Deletes specified metadata schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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); + + /** + * Check metadata schema exists + * + *

Checks if specified metadata schema exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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); + + /** + * Check metadata schema exists + * + *

Checks if specified metadata schema exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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..adfbdb6978630 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 @@ -13,7 +13,9 @@ /** An instance of this class provides access to all the operations defined in OperationsClient. */ public interface OperationsClient { /** - * List the operations for the provider. + * List resource provider operations + * + *

Returns a collection of resource provider operations. * * @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. @@ -24,7 +26,9 @@ public interface OperationsClient { PagedIterable list(); /** - * List the operations for the provider. + * List resource provider operations + * + *

Returns a collection of resource provider operations. * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. 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..321bd2e380d43 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 @@ -9,7 +9,9 @@ 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.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. */ @@ -37,7 +39,7 @@ 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. @@ -49,7 +51,7 @@ 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. @@ -62,7 +64,9 @@ public interface ServicesClient { PagedIterable listByResourceGroup(String resourceGroupName, Context context); /** - * Get service. + * Get service + * + *

Returns details of the service. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serviceName Service name. @@ -70,31 +74,35 @@ public interface ServicesClient { * @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); /** - * Get service. + * Get service + * + *

Returns details of the service. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serviceName Service name. * @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. + * 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 payload The service entity. * @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. @@ -103,10 +111,12 @@ Response getByResourceGroupWithResponse( */ @ServiceMethod(returns = ReturnType.SINGLE) Response createOrUpdateWithResponse( - String resourceGroupName, String serviceName, ServiceInner resource, Context context); + String resourceGroupName, String serviceName, ServiceInner payload, Context context); /** - * Create or update service. + * 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. @@ -119,11 +129,13 @@ Response createOrUpdateWithResponse( ServiceInner createOrUpdate(String resourceGroupName, String serviceName); /** - * Update service. + * 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 payload The service 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. @@ -132,10 +144,12 @@ Response createOrUpdateWithResponse( */ @ServiceMethod(returns = ReturnType.SINGLE) Response updateWithResponse( - String resourceGroupName, String serviceName, ServiceUpdate parameters, Context context); + String resourceGroupName, String serviceName, ServiceUpdate payload, Context context); /** - * Update service. + * Update service + * + *

Updates existing service. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serviceName Service name. @@ -148,7 +162,9 @@ Response updateWithResponse( ServiceInner update(String resourceGroupName, String serviceName); /** - * Delete service. + * Delete service + * + *

Deletes specified service. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serviceName Service name. @@ -162,7 +178,9 @@ Response updateWithResponse( Response deleteWithResponse(String resourceGroupName, String serviceName, Context context); /** - * Delete service. + * Delete service + * + *

Deletes specified service. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serviceName Service name. @@ -172,4 +190,39 @@ Response updateWithResponse( */ @ServiceMethod(returns = ReturnType.SINGLE) void delete(String resourceGroupName, String serviceName); + + /** + * Export effective metadata schema + * + *

Exports the effective metadata schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @param payload The metadata schema request details. + * @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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response exportMetadataSchemaWithResponse( + String resourceGroupName, String serviceName, MetadataSchemaExportRequest payload, Context context); + + /** + * Export effective metadata schema + * + *

Exports the effective metadata schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @param payload The metadata schema request details. + * @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 payload); } 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..d6e6b546eac4f --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/WorkspacesClient.java @@ -0,0 +1,186 @@ +// 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 { + /** + * List workspaces + * + *

Returns a collection of workspaces. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 collection as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String serviceName); + + /** + * List workspaces + * + *

Returns a collection of workspaces. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 workspace collection as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String serviceName, String filter, Context context); + + /** + * Get workspace + * + *

Returns details of the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WorkspacesGetResponse getWithResponse( + String resourceGroupName, String serviceName, String workspaceName, Context context); + + /** + * Get workspace + * + *

Returns details of the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WorkspaceInner get(String resourceGroupName, String serviceName, String workspaceName); + + /** + * Create or update workspace + * + *

Creates new or updates existing workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @param workspaceName The name of the workspace. + * @param payload Workspace entity. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WorkspacesCreateOrUpdateResponse createOrUpdateWithResponse( + String resourceGroupName, String serviceName, String workspaceName, WorkspaceInner payload, Context context); + + /** + * Create or update workspace + * + *

Creates new or updates existing workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @param workspaceName The name of the workspace. + * @param payload Workspace entity. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WorkspaceInner createOrUpdate( + String resourceGroupName, String serviceName, String workspaceName, WorkspaceInner payload); + + /** + * Delete workspace + * + *

Deletes specified workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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); + + /** + * Delete workspace + * + *

Deletes specified workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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); + + /** + * Check workspace exists + * + *

Checks if specified workspace exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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); + + /** + * Check workspace exists + * + *

Checks if specified workspace exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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..b7faaf153e6ad --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/models/ApiDefinitionInner.java @@ -0,0 +1,123 @@ +// 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.ApiDefinitionPropertiesSpecification; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * API definition + * + *

API definition entity. + */ +@Fluent +public final class ApiDefinitionInner extends ProxyResource { + /* + * API version properties + * + * API version properties entity. + */ + @JsonProperty(value = "properties") + private ApiDefinitionProperties innerProperties; + + /* + * 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 innerProperties property: API version properties + * + *

API version properties entity. + * + * @return the innerProperties value. + */ + private ApiDefinitionProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the title property: API version. + * + * @return the title value. + */ + public String title() { + return this.innerProperties() == null ? null : this.innerProperties().title(); + } + + /** + * Set the title property: API version. + * + * @param title the title value to set. + * @return the ApiDefinitionInner object itself. + */ + public ApiDefinitionInner withTitle(String title) { + if (this.innerProperties() == null) { + this.innerProperties = new ApiDefinitionProperties(); + } + this.innerProperties().withTitle(title); + return this; + } + + /** + * Get the description property: API definition description. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Set the description property: API definition description. + * + * @param description the description value to set. + * @return the ApiDefinitionInner object itself. + */ + public ApiDefinitionInner withDescription(String description) { + if (this.innerProperties() == null) { + this.innerProperties = new ApiDefinitionProperties(); + } + this.innerProperties().withDescription(description); + return this; + } + + /** + * Get the specification property: The specification property. + * + * @return the specification value. + */ + public ApiDefinitionPropertiesSpecification specification() { + return this.innerProperties() == null ? null : this.innerProperties().specification(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/models/ApiDefinitionProperties.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/models/ApiDefinitionProperties.java new file mode 100644 index 0000000000000..8c8c5c065f631 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/models/ApiDefinitionProperties.java @@ -0,0 +1,107 @@ +// 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.util.logging.ClientLogger; +import com.azure.resourcemanager.apicenter.models.ApiDefinitionPropertiesSpecification; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * API version properties + * + *

API version properties entity. + */ +@Fluent +public final class ApiDefinitionProperties { + /* + * API version. + */ + @JsonProperty(value = "title", required = true) + private String title; + + /* + * API definition description. + */ + @JsonProperty(value = "description") + private String description; + + /* + * The specification property. + */ + @JsonProperty(value = "specification", access = JsonProperty.Access.WRITE_ONLY) + private ApiDefinitionPropertiesSpecification specification; + + /** Creates an instance of ApiDefinitionProperties class. */ + public ApiDefinitionProperties() { + } + + /** + * Get the title property: API version. + * + * @return the title value. + */ + public String title() { + return this.title; + } + + /** + * Set the title property: API version. + * + * @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: The specification property. + * + * @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/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..70d6dc94c6271 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/models/ApiInner.java @@ -0,0 +1,306 @@ +// 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.ApiType; +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.LifecycleStage; +import com.azure.resourcemanager.apicenter.models.TermsOfService; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * API + * + *

API entity. + */ +@Fluent +public final class ApiInner extends ProxyResource { + /* + * API properties + * + * API properties. + */ + @JsonProperty(value = "properties") + private ApiProperties innerProperties; + + /* + * 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 innerProperties property: API properties + * + *

API properties. + * + * @return the innerProperties value. + */ + private ApiProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the title property: API title. + * + * @return the title value. + */ + public String title() { + return this.innerProperties() == null ? null : this.innerProperties().title(); + } + + /** + * Set the title property: API title. + * + * @param title the title value to set. + * @return the ApiInner object itself. + */ + public ApiInner withTitle(String title) { + if (this.innerProperties() == null) { + this.innerProperties = new ApiProperties(); + } + this.innerProperties().withTitle(title); + return this; + } + + /** + * Get the type property: API type + * + *

Kind of API. For example, REST or GraphQL. + * + * @return the type value. + */ + public ApiType typePropertiesType() { + return this.innerProperties() == null ? null : this.innerProperties().type(); + } + + /** + * Set the type property: API type + * + *

Kind of API. For example, REST or GraphQL. + * + * @param type the type value to set. + * @return the ApiInner object itself. + */ + public ApiInner withTypePropertiesType(ApiType type) { + if (this.innerProperties() == null) { + this.innerProperties = new ApiProperties(); + } + this.innerProperties().withType(type); + return this; + } + + /** + * Get the description property: Description + * + *

Description of the API. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Set the description property: Description + * + *

Description of the API. + * + * @param description the description value to set. + * @return the ApiInner object itself. + */ + public ApiInner withDescription(String description) { + if (this.innerProperties() == null) { + this.innerProperties = new ApiProperties(); + } + this.innerProperties().withDescription(description); + return this; + } + + /** + * Get the summary property: Short description of the API. + * + * @return the summary value. + */ + public String summary() { + return this.innerProperties() == null ? null : this.innerProperties().summary(); + } + + /** + * Set the summary property: Short description of the API. + * + * @param summary the summary value to set. + * @return the ApiInner object itself. + */ + public ApiInner withSummary(String summary) { + if (this.innerProperties() == null) { + this.innerProperties = new ApiProperties(); + } + this.innerProperties().withSummary(summary); + return this; + } + + /** + * Get the lifecycleStage property: Current lifecycle stage of the API. + * + * @return the lifecycleStage value. + */ + public LifecycleStage lifecycleStage() { + return this.innerProperties() == null ? null : this.innerProperties().lifecycleStage(); + } + + /** + * Get the termsOfService property: Terms of service + * + *

Terms of service for the API. + * + * @return the termsOfService value. + */ + public TermsOfService termsOfService() { + return this.innerProperties() == null ? null : this.innerProperties().termsOfService(); + } + + /** + * Set the termsOfService property: Terms of service + * + *

Terms of service for the API. + * + * @param termsOfService the termsOfService value to set. + * @return the ApiInner object itself. + */ + public ApiInner withTermsOfService(TermsOfService termsOfService) { + if (this.innerProperties() == null) { + this.innerProperties = new ApiProperties(); + } + this.innerProperties().withTermsOfService(termsOfService); + return this; + } + + /** + * Get the externalDocumentation property: The externalDocumentation property. + * + * @return the externalDocumentation value. + */ + public List externalDocumentation() { + return this.innerProperties() == null ? null : this.innerProperties().externalDocumentation(); + } + + /** + * Set the externalDocumentation property: The externalDocumentation property. + * + * @param externalDocumentation the externalDocumentation value to set. + * @return the ApiInner object itself. + */ + public ApiInner withExternalDocumentation(List externalDocumentation) { + if (this.innerProperties() == null) { + this.innerProperties = new ApiProperties(); + } + this.innerProperties().withExternalDocumentation(externalDocumentation); + return this; + } + + /** + * Get the contacts property: The contacts property. + * + * @return the contacts value. + */ + public List contacts() { + return this.innerProperties() == null ? null : this.innerProperties().contacts(); + } + + /** + * Set the contacts property: The contacts property. + * + * @param contacts the contacts value to set. + * @return the ApiInner object itself. + */ + public ApiInner withContacts(List contacts) { + if (this.innerProperties() == null) { + this.innerProperties = new ApiProperties(); + } + this.innerProperties().withContacts(contacts); + return this; + } + + /** + * Get the license property: License + * + *

The license information for the API. + * + * @return the license value. + */ + public License license() { + return this.innerProperties() == null ? null : this.innerProperties().license(); + } + + /** + * Set the license property: License + * + *

The license information for the API. + * + * @param license the license value to set. + * @return the ApiInner object itself. + */ + public ApiInner withLicense(License license) { + if (this.innerProperties() == null) { + this.innerProperties = new ApiProperties(); + } + this.innerProperties().withLicense(license); + return this; + } + + /** + * Get the customProperties property: The custom metadata defined for API catalog entities. + * + * @return the customProperties value. + */ + public Object customProperties() { + return this.innerProperties() == null ? null : this.innerProperties().customProperties(); + } + + /** + * Set the customProperties property: The custom metadata defined for API catalog entities. + * + * @param customProperties the customProperties value to set. + * @return the ApiInner object itself. + */ + public ApiInner withCustomProperties(Object customProperties) { + if (this.innerProperties() == null) { + this.innerProperties = new ApiProperties(); + } + this.innerProperties().withCustomProperties(customProperties); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/models/ApiProperties.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/models/ApiProperties.java new file mode 100644 index 0000000000000..ae35ec165d0fa --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/models/ApiProperties.java @@ -0,0 +1,333 @@ +// 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.util.logging.ClientLogger; +import com.azure.resourcemanager.apicenter.models.ApiType; +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.LifecycleStage; +import com.azure.resourcemanager.apicenter.models.TermsOfService; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * API properties + * + *

API properties. + */ +@Fluent +public final class ApiProperties { + /* + * API title. + */ + @JsonProperty(value = "title", required = true) + private String title; + + /* + * API type + * + * Kind of API. For example, REST or GraphQL. + */ + @JsonProperty(value = "type", required = true) + private ApiType type; + + /* + * Description + * + * 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 + * + * Terms of service for the API. + */ + @JsonProperty(value = "termsOfService") + private TermsOfService termsOfService; + + /* + * The externalDocumentation property. + */ + @JsonProperty(value = "externalDocumentation") + private List externalDocumentation; + + /* + * The contacts property. + */ + @JsonProperty(value = "contacts") + private List contacts; + + /* + * License + * + * 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 type property: API type + * + *

Kind of API. For example, REST or GraphQL. + * + * @return the type value. + */ + public ApiType type() { + return this.type; + } + + /** + * Set the type property: API type + * + *

Kind of API. For example, REST or GraphQL. + * + * @param type the type value to set. + * @return the ApiProperties object itself. + */ + public ApiProperties withType(ApiType type) { + this.type = type; + return this; + } + + /** + * Get the description property: Description + * + *

Description of the API. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Description + * + *

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 + * + *

Terms of service for the API. + * + * @return the termsOfService value. + */ + public TermsOfService termsOfService() { + return this.termsOfService; + } + + /** + * Set the termsOfService property: Terms of service + * + *

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 externalDocumentation property. + * + * @return the externalDocumentation value. + */ + public List externalDocumentation() { + return this.externalDocumentation; + } + + /** + * Set the externalDocumentation property: The externalDocumentation property. + * + * @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 contacts property. + * + * @return the contacts value. + */ + public List contacts() { + return this.contacts; + } + + /** + * Set the contacts property: The contacts property. + * + * @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: License + * + *

The license information for the API. + * + * @return the license value. + */ + public License license() { + return this.license; + } + + /** + * Set the license property: License + * + *

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 (type() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property type 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/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..69bfed1041b7d --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/models/ApiSpecExportResultInner.java @@ -0,0 +1,77 @@ +// 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 property. + */ + @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 property. + * + * @return the format value. + */ + public ApiSpecExportResultFormat format() { + return this.format; + } + + /** + * Set the format property: The format property. + * + * @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..45b2bf6b1e2fb --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/models/ApiVersionInner.java @@ -0,0 +1,114 @@ +// 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.LifecycleStage; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * API version + * + *

API version entity. + */ +@Fluent +public final class ApiVersionInner extends ProxyResource { + /* + * API version properties + * + * API version properties entity. + */ + @JsonProperty(value = "properties") + private ApiVersionProperties innerProperties; + + /* + * 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 innerProperties property: API version properties + * + *

API version properties entity. + * + * @return the innerProperties value. + */ + private ApiVersionProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the title property: API version. + * + * @return the title value. + */ + public String title() { + return this.innerProperties() == null ? null : this.innerProperties().title(); + } + + /** + * Set the title property: API version. + * + * @param title the title value to set. + * @return the ApiVersionInner object itself. + */ + public ApiVersionInner withTitle(String title) { + if (this.innerProperties() == null) { + this.innerProperties = new ApiVersionProperties(); + } + this.innerProperties().withTitle(title); + return this; + } + + /** + * Get the lifecycleStage property: Current lifecycle stage of the API. + * + * @return the lifecycleStage value. + */ + public LifecycleStage lifecycleStage() { + return this.innerProperties() == null ? null : this.innerProperties().lifecycleStage(); + } + + /** + * Set the lifecycleStage property: Current lifecycle stage of the API. + * + * @param lifecycleStage the lifecycleStage value to set. + * @return the ApiVersionInner object itself. + */ + public ApiVersionInner withLifecycleStage(LifecycleStage lifecycleStage) { + if (this.innerProperties() == null) { + this.innerProperties = new ApiVersionProperties(); + } + this.innerProperties().withLifecycleStage(lifecycleStage); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/models/ApiVersionProperties.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/models/ApiVersionProperties.java new file mode 100644 index 0000000000000..dc6661ac822a4 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/models/ApiVersionProperties.java @@ -0,0 +1,89 @@ +// 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.util.logging.ClientLogger; +import com.azure.resourcemanager.apicenter.models.LifecycleStage; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * API version properties + * + *

API version properties entity. + */ +@Fluent +public final class ApiVersionProperties { + /* + * API version. + */ + @JsonProperty(value = "title", required = true) + private String title; + + /* + * Current lifecycle stage of the API. + */ + @JsonProperty(value = "lifecycleStage") + private LifecycleStage lifecycleStage; + + /** Creates an instance of ApiVersionProperties class. */ + public ApiVersionProperties() { + } + + /** + * Get the title property: API version. + * + * @return the title value. + */ + public String title() { + return this.title; + } + + /** + * Set the title property: API version. + * + * @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")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ApiVersionProperties.class); +} 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..3c7cbf654784a --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/models/DeploymentInner.java @@ -0,0 +1,238 @@ +// 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.DeploymentServer; +import com.azure.resourcemanager.apicenter.models.DeploymentState; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * API deployment + * + *

API deployment entity. + */ +@Fluent +public final class DeploymentInner extends ProxyResource { + /* + * API deployment properties + * + * API deployment entity properties. + */ + @JsonProperty(value = "properties") + private DeploymentProperties innerProperties; + + /* + * 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 innerProperties property: API deployment properties + * + *

API deployment entity properties. + * + * @return the innerProperties value. + */ + private DeploymentProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the title property: Title. + * + * @return the title value. + */ + public String title() { + return this.innerProperties() == null ? null : this.innerProperties().title(); + } + + /** + * Set the title property: Title. + * + * @param title the title value to set. + * @return the DeploymentInner object itself. + */ + public DeploymentInner withTitle(String title) { + if (this.innerProperties() == null) { + this.innerProperties = new DeploymentProperties(); + } + this.innerProperties().withTitle(title); + return this; + } + + /** + * Get the description property: Description + * + *

Description of the deployment. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Set the description property: Description + * + *

Description of the deployment. + * + * @param description the description value to set. + * @return the DeploymentInner object itself. + */ + public DeploymentInner withDescription(String description) { + if (this.innerProperties() == null) { + this.innerProperties = new DeploymentProperties(); + } + this.innerProperties().withDescription(description); + return this; + } + + /** + * Get the environmentId property: API center-scoped environment resource ID. + * + * @return the environmentId value. + */ + public String environmentId() { + return this.innerProperties() == null ? null : this.innerProperties().environmentId(); + } + + /** + * Set the environmentId property: API center-scoped environment resource ID. + * + * @param environmentId the environmentId value to set. + * @return the DeploymentInner object itself. + */ + public DeploymentInner withEnvironmentId(String environmentId) { + if (this.innerProperties() == null) { + this.innerProperties = new DeploymentProperties(); + } + this.innerProperties().withEnvironmentId(environmentId); + return this; + } + + /** + * Get the definitionId property: API center-scoped definition resource ID. + * + * @return the definitionId value. + */ + public String definitionId() { + return this.innerProperties() == null ? null : this.innerProperties().definitionId(); + } + + /** + * Set the definitionId property: API center-scoped definition resource ID. + * + * @param definitionId the definitionId value to set. + * @return the DeploymentInner object itself. + */ + public DeploymentInner withDefinitionId(String definitionId) { + if (this.innerProperties() == null) { + this.innerProperties = new DeploymentProperties(); + } + this.innerProperties().withDefinitionId(definitionId); + return this; + } + + /** + * Get the state property: State + * + *

State of API deployment. + * + * @return the state value. + */ + public DeploymentState state() { + return this.innerProperties() == null ? null : this.innerProperties().state(); + } + + /** + * Set the state property: State + * + *

State of API deployment. + * + * @param state the state value to set. + * @return the DeploymentInner object itself. + */ + public DeploymentInner withState(DeploymentState state) { + if (this.innerProperties() == null) { + this.innerProperties = new DeploymentProperties(); + } + this.innerProperties().withState(state); + return this; + } + + /** + * Get the server property: Server. + * + * @return the server value. + */ + public DeploymentServer server() { + return this.innerProperties() == null ? null : this.innerProperties().server(); + } + + /** + * Set the server property: Server. + * + * @param server the server value to set. + * @return the DeploymentInner object itself. + */ + public DeploymentInner withServer(DeploymentServer server) { + if (this.innerProperties() == null) { + this.innerProperties = new DeploymentProperties(); + } + this.innerProperties().withServer(server); + return this; + } + + /** + * Get the customProperties property: The custom metadata defined for API catalog entities. + * + * @return the customProperties value. + */ + public Object customProperties() { + return this.innerProperties() == null ? null : this.innerProperties().customProperties(); + } + + /** + * Set the customProperties property: The custom metadata defined for API catalog entities. + * + * @param customProperties the customProperties value to set. + * @return the DeploymentInner object itself. + */ + public DeploymentInner withCustomProperties(Object customProperties) { + if (this.innerProperties() == null) { + this.innerProperties = new DeploymentProperties(); + } + this.innerProperties().withCustomProperties(customProperties); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/models/DeploymentProperties.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/models/DeploymentProperties.java new file mode 100644 index 0000000000000..2b955b8a86cb6 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/models/DeploymentProperties.java @@ -0,0 +1,227 @@ +// 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.DeploymentServer; +import com.azure.resourcemanager.apicenter.models.DeploymentState; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * API deployment properties + * + *

API deployment entity properties. + */ +@Fluent +public final class DeploymentProperties { + /* + * Title + */ + @JsonProperty(value = "title") + private String title; + + /* + * Description + * + * 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 + * + * State of API deployment. + */ + @JsonProperty(value = "state") + private DeploymentState state; + + /* + * 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: Title. + * + * @return the title value. + */ + public String title() { + return this.title; + } + + /** + * Set the title property: 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 + * + *

Description of the deployment. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Description + * + *

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 + * + *

State of API deployment. + * + * @return the state value. + */ + public DeploymentState state() { + return this.state; + } + + /** + * Set the state property: State + * + *

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: Server. + * + * @return the server value. + */ + public DeploymentServer server() { + return this.server; + } + + /** + * Set the server property: 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/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..7f27017398ce8 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/models/EnvironmentInner.java @@ -0,0 +1,212 @@ +// 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.EnvironmentServer; +import com.azure.resourcemanager.apicenter.models.EnvironmentType; +import com.azure.resourcemanager.apicenter.models.Onboarding; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Environment + * + *

Environment entity. + */ +@Fluent +public final class EnvironmentInner extends ProxyResource { + /* + * Environment entity properties + * + * Environment properties entity. + */ + @JsonProperty(value = "properties") + private EnvironmentProperties innerProperties; + + /* + * 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 innerProperties property: Environment entity properties + * + *

Environment properties entity. + * + * @return the innerProperties value. + */ + private EnvironmentProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the title property: Title. + * + * @return the title value. + */ + public String title() { + return this.innerProperties() == null ? null : this.innerProperties().title(); + } + + /** + * Set the title property: Title. + * + * @param title the title value to set. + * @return the EnvironmentInner object itself. + */ + public EnvironmentInner withTitle(String title) { + if (this.innerProperties() == null) { + this.innerProperties = new EnvironmentProperties(); + } + this.innerProperties().withTitle(title); + return this; + } + + /** + * Get the description property: Description. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Set the description property: Description. + * + * @param description the description value to set. + * @return the EnvironmentInner object itself. + */ + public EnvironmentInner withDescription(String description) { + if (this.innerProperties() == null) { + this.innerProperties = new EnvironmentProperties(); + } + this.innerProperties().withDescription(description); + return this; + } + + /** + * Get the type property: Environment type. + * + * @return the type value. + */ + public EnvironmentType typePropertiesType() { + return this.innerProperties() == null ? null : this.innerProperties().type(); + } + + /** + * Set the type property: Environment type. + * + * @param type the type value to set. + * @return the EnvironmentInner object itself. + */ + public EnvironmentInner withTypePropertiesType(EnvironmentType type) { + if (this.innerProperties() == null) { + this.innerProperties = new EnvironmentProperties(); + } + this.innerProperties().withType(type); + return this; + } + + /** + * Get the server property: Server + * + *

Server information of the environment. + * + * @return the server value. + */ + public EnvironmentServer server() { + return this.innerProperties() == null ? null : this.innerProperties().server(); + } + + /** + * Set the server property: Server + * + *

Server information of the environment. + * + * @param server the server value to set. + * @return the EnvironmentInner object itself. + */ + public EnvironmentInner withServer(EnvironmentServer server) { + if (this.innerProperties() == null) { + this.innerProperties = new EnvironmentProperties(); + } + this.innerProperties().withServer(server); + return this; + } + + /** + * Get the onboarding property: The onboarding property. + * + * @return the onboarding value. + */ + public Onboarding onboarding() { + return this.innerProperties() == null ? null : this.innerProperties().onboarding(); + } + + /** + * Set the onboarding property: The onboarding property. + * + * @param onboarding the onboarding value to set. + * @return the EnvironmentInner object itself. + */ + public EnvironmentInner withOnboarding(Onboarding onboarding) { + if (this.innerProperties() == null) { + this.innerProperties = new EnvironmentProperties(); + } + this.innerProperties().withOnboarding(onboarding); + return this; + } + + /** + * Get the customProperties property: The custom metadata defined for API catalog entities. + * + * @return the customProperties value. + */ + public Object customProperties() { + return this.innerProperties() == null ? null : this.innerProperties().customProperties(); + } + + /** + * Set the customProperties property: The custom metadata defined for API catalog entities. + * + * @param customProperties the customProperties value to set. + * @return the EnvironmentInner object itself. + */ + public EnvironmentInner withCustomProperties(Object customProperties) { + if (this.innerProperties() == null) { + this.innerProperties = new EnvironmentProperties(); + } + this.innerProperties().withCustomProperties(customProperties); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/models/EnvironmentProperties.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/models/EnvironmentProperties.java new file mode 100644 index 0000000000000..b9b2c5fadaf23 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/models/EnvironmentProperties.java @@ -0,0 +1,199 @@ +// 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.EnvironmentServer; +import com.azure.resourcemanager.apicenter.models.EnvironmentType; +import com.azure.resourcemanager.apicenter.models.Onboarding; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Environment entity properties + * + *

Environment properties entity. + */ +@Fluent +public final class EnvironmentProperties { + /* + * Title + */ + @JsonProperty(value = "title") + private String title; + + /* + * Description. + */ + @JsonProperty(value = "description") + private String description; + + /* + * Environment type. + */ + @JsonProperty(value = "type") + private EnvironmentType type; + + /* + * Server + * + * Server information of the environment. + */ + @JsonProperty(value = "server") + private EnvironmentServer server; + + /* + * The onboarding property. + */ + @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: Title. + * + * @return the title value. + */ + public String title() { + return this.title; + } + + /** + * Set the title property: 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: Description. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: 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 type property: Environment type. + * + * @return the type value. + */ + public EnvironmentType type() { + return this.type; + } + + /** + * Set the type property: Environment type. + * + * @param type the type value to set. + * @return the EnvironmentProperties object itself. + */ + public EnvironmentProperties withType(EnvironmentType type) { + this.type = type; + return this; + } + + /** + * Get the server property: Server + * + *

Server information of the environment. + * + * @return the server value. + */ + public EnvironmentServer server() { + return this.server; + } + + /** + * Set the server property: Server + * + *

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: The onboarding property. + * + * @return the onboarding value. + */ + public Onboarding onboarding() { + return this.onboarding; + } + + /** + * Set the onboarding property: The onboarding property. + * + * @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 (server() != null) { + server().validate(); + } + if (onboarding() != null) { + onboarding().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..2907231d6fa75 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/models/MetadataSchemaExportResultInner.java @@ -0,0 +1,77 @@ +// 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 format property. + */ + @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 format property. + * + * @return the format value. + */ + public MetadataSchemaExportFormat format() { + return this.format; + } + + /** + * Set the format property: The format property. + * + * @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..e254237e804d1 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/models/MetadataSchemaInner.java @@ -0,0 +1,115 @@ +// 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.MetadataAssignment; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * Metadata schema + * + *

Metadata schema entity. Used to define metadata for the entities in API catalog. + */ +@Fluent +public final class MetadataSchemaInner extends ProxyResource { + /* + * Metadata schema properties + * + * Metadata schema properties. + */ + @JsonProperty(value = "properties") + private MetadataSchemaProperties innerProperties; + + /* + * 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 innerProperties property: Metadata schema properties + * + *

Metadata schema properties. + * + * @return the innerProperties value. + */ + private MetadataSchemaProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the schema property: YAML schema defining the type. + * + * @return the schema value. + */ + public String schema() { + return this.innerProperties() == null ? null : this.innerProperties().schema(); + } + + /** + * Set the schema property: YAML schema defining the type. + * + * @param schema the schema value to set. + * @return the MetadataSchemaInner object itself. + */ + public MetadataSchemaInner withSchema(String schema) { + if (this.innerProperties() == null) { + this.innerProperties = new MetadataSchemaProperties(); + } + this.innerProperties().withSchema(schema); + return this; + } + + /** + * Get the assignedTo property: The assignedTo property. + * + * @return the assignedTo value. + */ + public List assignedTo() { + return this.innerProperties() == null ? null : this.innerProperties().assignedTo(); + } + + /** + * Set the assignedTo property: The assignedTo property. + * + * @param assignedTo the assignedTo value to set. + * @return the MetadataSchemaInner object itself. + */ + public MetadataSchemaInner withAssignedTo(List assignedTo) { + if (this.innerProperties() == null) { + this.innerProperties = new MetadataSchemaProperties(); + } + this.innerProperties().withAssignedTo(assignedTo); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/models/MetadataSchemaProperties.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/models/MetadataSchemaProperties.java new file mode 100644 index 0000000000000..00eae552d590c --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/models/MetadataSchemaProperties.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.apicenter.models.MetadataAssignment; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * Metadata schema properties + * + *

Metadata schema properties. + */ +@Fluent +public final class MetadataSchemaProperties { + /* + * YAML schema defining the type. + */ + @JsonProperty(value = "schema", required = true) + private String schema; + + /* + * The assignedTo property. + */ + @JsonProperty(value = "assignedTo") + private List assignedTo; + + /** Creates an instance of MetadataSchemaProperties class. */ + public MetadataSchemaProperties() { + } + + /** + * Get the schema property: YAML schema defining the type. + * + * @return the schema value. + */ + public String schema() { + return this.schema; + } + + /** + * Set the schema property: YAML 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 assignedTo property. + * + * @return the assignedTo value. + */ + public List assignedTo() { + return this.assignedTo; + } + + /** + * Set the assignedTo property: The assignedTo property. + * + * @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/fluent/models/ServiceInner.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/models/ServiceInner.java index 7e7ca4c0ac3df..8b56eeda3c15c 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 @@ -22,7 +22,7 @@ public final class ServiceInner extends Resource { private ServiceProperties innerProperties; /* - * The identity of the service. + * Managed service identity (system assigned and/or user assigned identities) */ @JsonProperty(value = "identity") private ManagedServiceIdentity identity; @@ -47,7 +47,7 @@ private ServiceProperties innerProperties() { } /** - * Get the identity property: The identity of the service. + * Get the identity property: Managed service identity (system assigned and/or user assigned identities). * * @return the identity value. */ @@ -56,7 +56,7 @@ public ManagedServiceIdentity identity() { } /** - * Set the identity property: The identity of the service. + * Set the identity property: Managed service identity (system assigned and/or user assigned identities). * * @param identity the identity value to set. * @return the ServiceInner object itself. @@ -90,7 +90,7 @@ public ServiceInner withTags(Map tags) { } /** - * Get the provisioningState property: The status of the last operation. + * Get the provisioningState property: Provisioning state of the service. * * @return the provisioningState value. */ 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/fluent/models/ServiceProperties.java index eb486532f809a..057c0af799e1a 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/fluent/models/ServiceProperties.java @@ -12,7 +12,7 @@ @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; @@ -22,7 +22,7 @@ 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. */ 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..878b7c8e68799 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/models/WorkspaceInner.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Workspace + * + *

Workspace entity. + */ +@Fluent +public final class WorkspaceInner extends ProxyResource { + /* + * Workspace properties + * + * Workspace properties. + */ + @JsonProperty(value = "properties") + private WorkspaceProperties innerProperties; + + /* + * 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 innerProperties property: Workspace properties + * + *

Workspace properties. + * + * @return the innerProperties value. + */ + private WorkspaceProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the title property: Workspace display name. + * + * @return the title value. + */ + public String title() { + return this.innerProperties() == null ? null : this.innerProperties().title(); + } + + /** + * Set the title property: Workspace display name. + * + * @param title the title value to set. + * @return the WorkspaceInner object itself. + */ + public WorkspaceInner withTitle(String title) { + if (this.innerProperties() == null) { + this.innerProperties = new WorkspaceProperties(); + } + this.innerProperties().withTitle(title); + return this; + } + + /** + * Get the description property: Workspace description. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Set the description property: Workspace description. + * + * @param description the description value to set. + * @return the WorkspaceInner object itself. + */ + public WorkspaceInner withDescription(String description) { + if (this.innerProperties() == null) { + this.innerProperties = new WorkspaceProperties(); + } + this.innerProperties().withDescription(description); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/models/WorkspaceProperties.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/models/WorkspaceProperties.java new file mode 100644 index 0000000000000..ed2ad4d232169 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/fluent/models/WorkspaceProperties.java @@ -0,0 +1,88 @@ +// 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.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Workspace properties + * + *

Workspace properties. + */ +@Fluent +public final class WorkspaceProperties { + /* + * Workspace display name. + */ + @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 display name. + * + * @return the title value. + */ + public String title() { + return this.title; + } + + /** + * Set the title property: Workspace display name. + * + * @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/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..2fd45ec26aa77 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/ApiDefinitionImpl.java @@ -0,0 +1,235 @@ +// 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.Response; +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.ApiDefinitionPropertiesSpecification; +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 SystemData systemData() { + return this.innerModel().systemData(); + } + + public String title() { + return this.innerModel().title(); + } + + public String description() { + return this.innerModel().description(); + } + + public ApiDefinitionPropertiesSpecification specification() { + return this.innerModel().specification(); + } + + 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 = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serviceName = Utils.getValueFromIdByName(innerObject.id(), "services"); + this.workspaceName = Utils.getValueFromIdByName(innerObject.id(), "workspaces"); + this.apiName = Utils.getValueFromIdByName(innerObject.id(), "apis"); + this.versionName = Utils.getValueFromIdByName(innerObject.id(), "versions"); + this.definitionName = Utils.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 Response importSpecificationWithResponse(ApiSpecImportRequest payload, Context context) { + return serviceManager + .apiDefinitions() + .importSpecificationWithResponse( + resourceGroupName, serviceName, workspaceName, apiName, versionName, definitionName, payload, context); + } + + public void importSpecification(ApiSpecImportRequest payload) { + serviceManager + .apiDefinitions() + .importSpecification( + resourceGroupName, serviceName, workspaceName, apiName, versionName, definitionName, payload); + } + + public Response exportSpecificationWithResponse(Context context) { + return serviceManager + .apiDefinitions() + .exportSpecificationWithResponse( + resourceGroupName, serviceName, workspaceName, apiName, versionName, definitionName, context); + } + + public ApiSpecExportResult exportSpecification() { + return serviceManager + .apiDefinitions() + .exportSpecification(resourceGroupName, serviceName, workspaceName, apiName, versionName, definitionName); + } + + public ApiDefinitionImpl withTitle(String title) { + this.innerModel().withTitle(title); + return this; + } + + public ApiDefinitionImpl withDescription(String description) { + this.innerModel().withDescription(description); + 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..357a719e04510 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/ApiDefinitionsClientImpl.java @@ -0,0 +1,2051 @@ +// 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.util.Context; +import com.azure.core.util.FluxUtil; +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.ApiDefinitionCollection; +import com.azure.resourcemanager.apicenter.models.ApiDefinitionsCreateOrUpdateResponse; +import com.azure.resourcemanager.apicenter.models.ApiDefinitionsGetResponse; +import com.azure.resourcemanager.apicenter.models.ApiSpecImportRequest; +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, + @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("api-version") String apiVersion, + @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, + @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, + @QueryParam("api-version") String apiVersion, + @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, + @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, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ApiDefinitionInner payload, + @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, + @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, + @QueryParam("api-version") String apiVersion, + @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, + @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, + @QueryParam("api-version") String apiVersion, + @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, + @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, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ApiSpecImportRequest payload, + @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, + @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, + @QueryParam("api-version") String apiVersion, + @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); + } + + /** + * List API definitions + * + *

Returns a collection of API definitions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 aPI version collection 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.getSubscriptionId(), + resourceGroupName, + serviceName, + workspaceName, + apiName, + versionName, + this.client.getApiVersion(), + 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())); + } + + /** + * List API definitions + * + *

Returns a collection of API definitions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 aPI version collection 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.getSubscriptionId(), + resourceGroupName, + serviceName, + workspaceName, + apiName, + versionName, + this.client.getApiVersion(), + filter, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List API definitions + * + *

Returns a collection of API definitions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 aPI version collection 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)); + } + + /** + * List API definitions + * + *

Returns a collection of API definitions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 collection 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)); + } + + /** + * List API definitions + * + *

Returns a collection of API definitions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 aPI version collection 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)); + } + + /** + * List API definitions + * + *

Returns a collection of API definitions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 collection 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)); + } + + /** + * List API definitions + * + *

Returns a collection of API definitions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 aPI version collection 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)); + } + + /** + * Get API definition + * + *

Returns details of the API definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 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.getSubscriptionId(), + resourceGroupName, + serviceName, + workspaceName, + apiName, + versionName, + definitionName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get API definition + * + *

Returns details of the API definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 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.getSubscriptionId(), + resourceGroupName, + serviceName, + workspaceName, + apiName, + versionName, + definitionName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Get API definition + * + *

Returns details of the API definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 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())); + } + + /** + * Get API definition + * + *

Returns details of the API definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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. + */ + @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(); + } + + /** + * Get API definition + * + *

Returns details of the API definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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. + */ + @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(); + } + + /** + * Create or update API definition + * + *

Creates new or updates existing API definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 payload API definition entity. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 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 payload) { + 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 (payload == null) { + return Mono.error(new IllegalArgumentException("Parameter payload is required and cannot be null.")); + } else { + payload.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + workspaceName, + apiName, + versionName, + definitionName, + this.client.getApiVersion(), + payload, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create or update API definition + * + *

Creates new or updates existing API definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 payload API definition entity. + * @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 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 payload, + 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 (payload == null) { + return Mono.error(new IllegalArgumentException("Parameter payload is required and cannot be null.")); + } else { + payload.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + workspaceName, + apiName, + versionName, + definitionName, + this.client.getApiVersion(), + payload, + accept, + context); + } + + /** + * Create or update API definition + * + *

Creates new or updates existing API definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 payload API definition entity. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 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 payload) { + return createOrUpdateWithResponseAsync( + resourceGroupName, serviceName, workspaceName, apiName, versionName, definitionName, payload) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Create or update API definition + * + *

Creates new or updates existing API definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 payload API definition entity. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApiDefinitionsCreateOrUpdateResponse createOrUpdateWithResponse( + String resourceGroupName, + String serviceName, + String workspaceName, + String apiName, + String versionName, + String definitionName, + ApiDefinitionInner payload, + Context context) { + return createOrUpdateWithResponseAsync( + resourceGroupName, serviceName, workspaceName, apiName, versionName, definitionName, payload, context) + .block(); + } + + /** + * Create or update API definition + * + *

Creates new or updates existing API definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 payload API definition entity. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApiDefinitionInner createOrUpdate( + String resourceGroupName, + String serviceName, + String workspaceName, + String apiName, + String versionName, + String definitionName, + ApiDefinitionInner payload) { + return createOrUpdateWithResponse( + resourceGroupName, + serviceName, + workspaceName, + apiName, + versionName, + definitionName, + payload, + Context.NONE) + .getValue(); + } + + /** + * Delete API definition + * + *

Deletes specified API definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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.getSubscriptionId(), + resourceGroupName, + serviceName, + workspaceName, + apiName, + versionName, + definitionName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete API definition + * + *

Deletes specified API definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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.getSubscriptionId(), + resourceGroupName, + serviceName, + workspaceName, + apiName, + versionName, + definitionName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Delete API definition + * + *

Deletes specified API definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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()); + } + + /** + * Delete API definition + * + *

Deletes specified API definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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(); + } + + /** + * Delete API definition + * + *

Deletes specified API definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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); + } + + /** + * Check API definition exists + * + *

Checks if specified API definition exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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.getSubscriptionId(), + resourceGroupName, + serviceName, + workspaceName, + apiName, + versionName, + definitionName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Check API definition exists + * + *

Checks if specified API definition exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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.getSubscriptionId(), + resourceGroupName, + serviceName, + workspaceName, + apiName, + versionName, + definitionName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Check API definition exists + * + *

Checks if specified API definition exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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()); + } + + /** + * Check API definition exists + * + *

Checks if specified API definition exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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(); + } + + /** + * Check API definition exists + * + *

Checks if specified API definition exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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); + } + + /** + * Import API specification + * + *

Imports the API specification. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 payload The API specification source entity. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 payload) { + 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 (payload == null) { + return Mono.error(new IllegalArgumentException("Parameter payload is required and cannot be null.")); + } else { + payload.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .importSpecification( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + workspaceName, + apiName, + versionName, + definitionName, + this.client.getApiVersion(), + payload, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Import API specification + * + *

Imports the API specification. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 payload The API specification source entity. + * @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 payload, + 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 (payload == null) { + return Mono.error(new IllegalArgumentException("Parameter payload is required and cannot be null.")); + } else { + payload.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .importSpecification( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + workspaceName, + apiName, + versionName, + definitionName, + this.client.getApiVersion(), + payload, + accept, + context); + } + + /** + * Import API specification + * + *

Imports the API specification. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 payload The API specification source entity. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 payload) { + return importSpecificationWithResponseAsync( + resourceGroupName, serviceName, workspaceName, apiName, versionName, definitionName, payload) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Import API specification + * + *

Imports the API specification. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 payload The API specification source entity. + * @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 importSpecificationWithResponse( + String resourceGroupName, + String serviceName, + String workspaceName, + String apiName, + String versionName, + String definitionName, + ApiSpecImportRequest payload, + Context context) { + return importSpecificationWithResponseAsync( + resourceGroupName, serviceName, workspaceName, apiName, versionName, definitionName, payload, context) + .block(); + } + + /** + * Import API specification + * + *

Imports the API specification. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 payload The API specification source entity. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 payload) { + importSpecificationWithResponse( + resourceGroupName, serviceName, workspaceName, apiName, versionName, definitionName, payload, Context.NONE); + } + + /** + * Export API specification + * + *

Exports the API specification. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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.getSubscriptionId(), + resourceGroupName, + serviceName, + workspaceName, + apiName, + versionName, + definitionName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Export API specification + * + *

Exports the API specification. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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.getSubscriptionId(), + resourceGroupName, + serviceName, + workspaceName, + apiName, + versionName, + definitionName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Export API specification + * + *

Exports the API specification. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 exportSpecificationWithResponseAsync( + resourceGroupName, serviceName, workspaceName, apiName, versionName, definitionName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Export API specification + * + *

Exports the API specification. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response exportSpecificationWithResponse( + String resourceGroupName, + String serviceName, + String workspaceName, + String apiName, + String versionName, + String definitionName, + Context context) { + return exportSpecificationWithResponseAsync( + resourceGroupName, serviceName, workspaceName, apiName, versionName, definitionName, context) + .block(); + } + + /** + * Export API specification + * + *

Exports the API specification. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 exportSpecificationWithResponse( + resourceGroupName, serviceName, workspaceName, apiName, versionName, definitionName, Context.NONE) + .getValue(); + } + + /** + * 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 aPI version collection 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 aPI version collection 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..9ae020807a4de --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/ApiDefinitionsImpl.java @@ -0,0 +1,428 @@ +// 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 Utils.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 Utils.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 Response importSpecificationWithResponse( + String resourceGroupName, + String serviceName, + String workspaceName, + String apiName, + String versionName, + String definitionName, + ApiSpecImportRequest payload, + Context context) { + return this + .serviceClient() + .importSpecificationWithResponse( + resourceGroupName, serviceName, workspaceName, apiName, versionName, definitionName, payload, context); + } + + public void importSpecification( + String resourceGroupName, + String serviceName, + String workspaceName, + String apiName, + String versionName, + String definitionName, + ApiSpecImportRequest payload) { + this + .serviceClient() + .importSpecification( + resourceGroupName, serviceName, workspaceName, apiName, versionName, definitionName, payload); + } + + public Response exportSpecificationWithResponse( + String resourceGroupName, + String serviceName, + String workspaceName, + String apiName, + String versionName, + String definitionName, + Context context) { + Response inner = + this + .serviceClient() + .exportSpecificationWithResponse( + resourceGroupName, serviceName, workspaceName, apiName, versionName, definitionName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ApiSpecExportResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + 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 ApiDefinition getById(String id) { + String resourceGroupName = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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..b6495e2797e77 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/ApiImpl.java @@ -0,0 +1,245 @@ +// 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.ApiType; +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.LifecycleStage; +import com.azure.resourcemanager.apicenter.models.TermsOfService; +import java.util.Collections; +import java.util.List; + +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 SystemData systemData() { + return this.innerModel().systemData(); + } + + public String title() { + return this.innerModel().title(); + } + + public ApiType typePropertiesType() { + return this.innerModel().typePropertiesType(); + } + + public String description() { + return this.innerModel().description(); + } + + public String summary() { + return this.innerModel().summary(); + } + + public LifecycleStage lifecycleStage() { + return this.innerModel().lifecycleStage(); + } + + public TermsOfService termsOfService() { + return this.innerModel().termsOfService(); + } + + public List externalDocumentation() { + List inner = this.innerModel().externalDocumentation(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List contacts() { + List inner = this.innerModel().contacts(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public License license() { + return this.innerModel().license(); + } + + public Object customProperties() { + return this.innerModel().customProperties(); + } + + 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 = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serviceName = Utils.getValueFromIdByName(innerObject.id(), "services"); + this.workspaceName = Utils.getValueFromIdByName(innerObject.id(), "workspaces"); + this.apiName = Utils.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 withTitle(String title) { + this.innerModel().withTitle(title); + return this; + } + + public ApiImpl withTypePropertiesType(ApiType typePropertiesType) { + this.innerModel().withTypePropertiesType(typePropertiesType); + return this; + } + + public ApiImpl withDescription(String description) { + this.innerModel().withDescription(description); + return this; + } + + public ApiImpl withSummary(String summary) { + this.innerModel().withSummary(summary); + return this; + } + + public ApiImpl withTermsOfService(TermsOfService termsOfService) { + this.innerModel().withTermsOfService(termsOfService); + return this; + } + + public ApiImpl withExternalDocumentation(List externalDocumentation) { + this.innerModel().withExternalDocumentation(externalDocumentation); + return this; + } + + public ApiImpl withContacts(List contacts) { + this.innerModel().withContacts(contacts); + return this; + } + + public ApiImpl withLicense(License license) { + this.innerModel().withLicense(license); + return this; + } + + public ApiImpl withCustomProperties(Object customProperties) { + this.innerModel().withCustomProperties(customProperties); + 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..477cc93c85894 --- /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..a1ec449b3adce --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/ApiVersionImpl.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.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.LifecycleStage; + +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 SystemData systemData() { + return this.innerModel().systemData(); + } + + public String title() { + return this.innerModel().title(); + } + + public LifecycleStage lifecycleStage() { + return this.innerModel().lifecycleStage(); + } + + 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 = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serviceName = Utils.getValueFromIdByName(innerObject.id(), "services"); + this.workspaceName = Utils.getValueFromIdByName(innerObject.id(), "workspaces"); + this.apiName = Utils.getValueFromIdByName(innerObject.id(), "apis"); + this.versionName = Utils.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 withTitle(String title) { + this.innerModel().withTitle(title); + return this; + } + + public ApiVersionImpl withLifecycleStage(LifecycleStage lifecycleStage) { + this.innerModel().withLifecycleStage(lifecycleStage); + 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..7c14c983dc146 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/ApiVersionsClientImpl.java @@ -0,0 +1,1355 @@ +// 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.ApiVersionCollection; +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, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serviceName") String serviceName, + @PathParam("workspaceName") String workspaceName, + @PathParam("apiName") String apiName, + @QueryParam("api-version") String apiVersion, + @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, + @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("api-version") String apiVersion, + @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, + @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("api-version") String apiVersion, + @BodyParam("application/json") ApiVersionInner payload, + @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, + @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("api-version") String apiVersion, + @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, + @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("api-version") String apiVersion, + @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); + } + + /** + * List API versions + * + *

Returns a collection of API versions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 aPI version collection 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.getSubscriptionId(), + resourceGroupName, + serviceName, + workspaceName, + apiName, + this.client.getApiVersion(), + 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())); + } + + /** + * List API versions + * + *

Returns a collection of API versions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 aPI version collection 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.getSubscriptionId(), + resourceGroupName, + serviceName, + workspaceName, + apiName, + this.client.getApiVersion(), + filter, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List API versions + * + *

Returns a collection of API versions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 aPI version collection 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)); + } + + /** + * List API versions + * + *

Returns a collection of API versions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 version collection 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)); + } + + /** + * List API versions + * + *

Returns a collection of API versions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 aPI version collection 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)); + } + + /** + * List API versions + * + *

Returns a collection of API versions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 version collection 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)); + } + + /** + * List API versions + * + *

Returns a collection of API versions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 aPI version collection 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)); + } + + /** + * Get API version + * + *

Returns details of the API version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 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.getSubscriptionId(), + resourceGroupName, + serviceName, + workspaceName, + apiName, + versionName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get API version + * + *

Returns details of the API version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 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.getSubscriptionId(), + resourceGroupName, + serviceName, + workspaceName, + apiName, + versionName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Get API version + * + *

Returns details of the API version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 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())); + } + + /** + * Get API version + * + *

Returns details of the API version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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. + */ + @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(); + } + + /** + * Get API version + * + *

Returns details of the API version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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. + */ + @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(); + } + + /** + * Create or update API version + * + *

Creates new or updates existing API version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param payload API version entity. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateWithResponseAsync( + String resourceGroupName, + String serviceName, + String workspaceName, + String apiName, + String versionName, + ApiVersionInner payload) { + 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 (payload == null) { + return Mono.error(new IllegalArgumentException("Parameter payload is required and cannot be null.")); + } else { + payload.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + workspaceName, + apiName, + versionName, + this.client.getApiVersion(), + payload, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create or update API version + * + *

Creates new or updates existing API version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param payload API version entity. + * @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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateWithResponseAsync( + String resourceGroupName, + String serviceName, + String workspaceName, + String apiName, + String versionName, + ApiVersionInner payload, + 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 (payload == null) { + return Mono.error(new IllegalArgumentException("Parameter payload is required and cannot be null.")); + } else { + payload.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + workspaceName, + apiName, + versionName, + this.client.getApiVersion(), + payload, + accept, + context); + } + + /** + * Create or update API version + * + *

Creates new or updates existing API version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param payload API version entity. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serviceName, + String workspaceName, + String apiName, + String versionName, + ApiVersionInner payload) { + return createOrUpdateWithResponseAsync( + resourceGroupName, serviceName, workspaceName, apiName, versionName, payload) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Create or update API version + * + *

Creates new or updates existing API version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param payload API version entity. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApiVersionsCreateOrUpdateResponse createOrUpdateWithResponse( + String resourceGroupName, + String serviceName, + String workspaceName, + String apiName, + String versionName, + ApiVersionInner payload, + Context context) { + return createOrUpdateWithResponseAsync( + resourceGroupName, serviceName, workspaceName, apiName, versionName, payload, context) + .block(); + } + + /** + * Create or update API version + * + *

Creates new or updates existing API version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param payload API version entity. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApiVersionInner createOrUpdate( + String resourceGroupName, + String serviceName, + String workspaceName, + String apiName, + String versionName, + ApiVersionInner payload) { + return createOrUpdateWithResponse( + resourceGroupName, serviceName, workspaceName, apiName, versionName, payload, Context.NONE) + .getValue(); + } + + /** + * Delete API version + * + *

Deletes specified API version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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.getSubscriptionId(), + resourceGroupName, + serviceName, + workspaceName, + apiName, + versionName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete API version + * + *

Deletes specified API version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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.getSubscriptionId(), + resourceGroupName, + serviceName, + workspaceName, + apiName, + versionName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Delete API version + * + *

Deletes specified API version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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()); + } + + /** + * Delete API version + * + *

Deletes specified API version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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(); + } + + /** + * Delete API version + * + *

Deletes specified API version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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); + } + + /** + * Check API version exists + * + *

Checks if specified API version exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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.getSubscriptionId(), + resourceGroupName, + serviceName, + workspaceName, + apiName, + versionName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Check API version exists + * + *

Checks if specified API version exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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.getSubscriptionId(), + resourceGroupName, + serviceName, + workspaceName, + apiName, + versionName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Check API version exists + * + *

Checks if specified API version exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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()); + } + + /** + * Check API version exists + * + *

Checks if specified API version exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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(); + } + + /** + * Check API version exists + * + *

Checks if specified API version exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 aPI version collection 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 aPI version collection 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..9dea265811683 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/ApiVersionsImpl.java @@ -0,0 +1,290 @@ +// 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 Utils.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 Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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..2ecc42eb74103 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/ApisClientImpl.java @@ -0,0 +1,1206 @@ +// 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.ApiCollection; +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, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serviceName") String serviceName, + @PathParam("workspaceName") String workspaceName, + @QueryParam("api-version") String apiVersion, + @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, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serviceName") String serviceName, + @PathParam("workspaceName") String workspaceName, + @PathParam("apiName") String apiName, + @QueryParam("api-version") String apiVersion, + @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, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serviceName") String serviceName, + @PathParam("workspaceName") String workspaceName, + @PathParam("apiName") String apiName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ApiInner payload, + @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, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serviceName") String serviceName, + @PathParam("workspaceName") String workspaceName, + @PathParam("apiName") String apiName, + @QueryParam("api-version") String apiVersion, + @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, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serviceName") String serviceName, + @PathParam("workspaceName") String workspaceName, + @PathParam("apiName") String apiName, + @QueryParam("api-version") String apiVersion, + @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); + } + + /** + * List APIs + * + *

Returns a collection of APIs. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 aPI collection 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.getSubscriptionId(), + resourceGroupName, + serviceName, + workspaceName, + this.client.getApiVersion(), + 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())); + } + + /** + * List APIs + * + *

Returns a collection of APIs. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 aPI collection 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.getSubscriptionId(), + resourceGroupName, + serviceName, + workspaceName, + this.client.getApiVersion(), + filter, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List APIs + * + *

Returns a collection of APIs. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 aPI collection 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)); + } + + /** + * List APIs + * + *

Returns a collection of APIs. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 aPI collection 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)); + } + + /** + * List APIs + * + *

Returns a collection of APIs. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 aPI collection 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)); + } + + /** + * List APIs + * + *

Returns a collection of APIs. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 aPI collection 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)); + } + + /** + * List APIs + * + *

Returns a collection of APIs. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 aPI collection 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)); + } + + /** + * Get API + * + *

Returns details of the API. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 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.getSubscriptionId(), + resourceGroupName, + serviceName, + workspaceName, + apiName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get API + * + *

Returns details of the API. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 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.getSubscriptionId(), + resourceGroupName, + serviceName, + workspaceName, + apiName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Get API + * + *

Returns details of the API. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 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())); + } + + /** + * Get API + * + *

Returns details of the API. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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. + */ + @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(); + } + + /** + * Get API + * + *

Returns details of the API. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApiInner get(String resourceGroupName, String serviceName, String workspaceName, String apiName) { + return getWithResponse(resourceGroupName, serviceName, workspaceName, apiName, Context.NONE).getValue(); + } + + /** + * Create or update API + * + *

Creates new or updates existing API. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param payload API entity. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateWithResponseAsync( + String resourceGroupName, String serviceName, String workspaceName, String apiName, ApiInner payload) { + 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 (payload == null) { + return Mono.error(new IllegalArgumentException("Parameter payload is required and cannot be null.")); + } else { + payload.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + workspaceName, + apiName, + this.client.getApiVersion(), + payload, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create or update API + * + *

Creates new or updates existing API. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param payload API entity. + * @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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateWithResponseAsync( + String resourceGroupName, + String serviceName, + String workspaceName, + String apiName, + ApiInner payload, + 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 (payload == null) { + return Mono.error(new IllegalArgumentException("Parameter payload is required and cannot be null.")); + } else { + payload.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + workspaceName, + apiName, + this.client.getApiVersion(), + payload, + accept, + context); + } + + /** + * Create or update API + * + *

Creates new or updates existing API. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param payload API entity. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String serviceName, String workspaceName, String apiName, ApiInner payload) { + return createOrUpdateWithResponseAsync(resourceGroupName, serviceName, workspaceName, apiName, payload) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Create or update API + * + *

Creates new or updates existing API. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param payload API entity. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApisCreateOrUpdateResponse createOrUpdateWithResponse( + String resourceGroupName, + String serviceName, + String workspaceName, + String apiName, + ApiInner payload, + Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, serviceName, workspaceName, apiName, payload, context) + .block(); + } + + /** + * Create or update API + * + *

Creates new or updates existing API. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param payload API entity. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApiInner createOrUpdate( + String resourceGroupName, String serviceName, String workspaceName, String apiName, ApiInner payload) { + return createOrUpdateWithResponse(resourceGroupName, serviceName, workspaceName, apiName, payload, Context.NONE) + .getValue(); + } + + /** + * Delete API + * + *

Deletes specified API. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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.getSubscriptionId(), + resourceGroupName, + serviceName, + workspaceName, + apiName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete API + * + *

Deletes specified API. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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.getSubscriptionId(), + resourceGroupName, + serviceName, + workspaceName, + apiName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Delete API + * + *

Deletes specified API. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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()); + } + + /** + * Delete API + * + *

Deletes specified API. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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(); + } + + /** + * Delete API + * + *

Deletes specified API. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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); + } + + /** + * Check if API exists + * + *

Checks if specified API exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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.getSubscriptionId(), + resourceGroupName, + serviceName, + workspaceName, + apiName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Check if API exists + * + *

Checks if specified API exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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.getSubscriptionId(), + resourceGroupName, + serviceName, + workspaceName, + apiName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Check if API exists + * + *

Checks if specified API exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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()); + } + + /** + * Check if API exists + * + *

Checks if specified API exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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(); + } + + /** + * Check if API exists + * + *

Checks if specified API exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 aPI collection 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 aPI collection 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..ff5eb04005307 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/ApisImpl.java @@ -0,0 +1,227 @@ +// 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 Utils.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 Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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..d81cb319d4d7c 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 @@ -18,12 +18,12 @@ @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. 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..c1c0bb43daca5 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; @@ -37,11 +44,11 @@ /** 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. */ @@ -133,6 +140,90 @@ 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 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 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 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. * @@ -140,7 +231,7 @@ public ServicesClient getServices() { * @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( @@ -155,9 +246,16 @@ public ServicesClient getServices() { 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.apiVersions = new ApiVersionsClientImpl(this); + this.apiDefinitions = new ApiDefinitionsClientImpl(this); + this.deployments = new DeploymentsClientImpl(this); + this.environments = new EnvironmentsClientImpl(this); } /** 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..ff085bdf4499b --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/DeploymentImpl.java @@ -0,0 +1,224 @@ +// 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.DeploymentServer; +import com.azure.resourcemanager.apicenter.models.DeploymentState; + +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 SystemData systemData() { + return this.innerModel().systemData(); + } + + public String title() { + return this.innerModel().title(); + } + + public String description() { + return this.innerModel().description(); + } + + public String environmentId() { + return this.innerModel().environmentId(); + } + + public String definitionId() { + return this.innerModel().definitionId(); + } + + public DeploymentState state() { + return this.innerModel().state(); + } + + public DeploymentServer server() { + return this.innerModel().server(); + } + + public Object customProperties() { + return this.innerModel().customProperties(); + } + + 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 = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serviceName = Utils.getValueFromIdByName(innerObject.id(), "services"); + this.workspaceName = Utils.getValueFromIdByName(innerObject.id(), "workspaces"); + this.apiName = Utils.getValueFromIdByName(innerObject.id(), "apis"); + this.deploymentName = Utils.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 withTitle(String title) { + this.innerModel().withTitle(title); + return this; + } + + public DeploymentImpl withDescription(String description) { + this.innerModel().withDescription(description); + return this; + } + + public DeploymentImpl withEnvironmentId(String environmentId) { + this.innerModel().withEnvironmentId(environmentId); + return this; + } + + public DeploymentImpl withDefinitionId(String definitionId) { + this.innerModel().withDefinitionId(definitionId); + return this; + } + + public DeploymentImpl withState(DeploymentState state) { + this.innerModel().withState(state); + return this; + } + + public DeploymentImpl withServer(DeploymentServer server) { + this.innerModel().withServer(server); + return this; + } + + public DeploymentImpl withCustomProperties(Object customProperties) { + this.innerModel().withCustomProperties(customProperties); + 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..1ce5f5c77011a --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/DeploymentsClientImpl.java @@ -0,0 +1,1355 @@ +// 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.DeploymentCollection; +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, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serviceName") String serviceName, + @PathParam("workspaceName") String workspaceName, + @PathParam("apiName") String apiName, + @QueryParam("api-version") String apiVersion, + @QueryParam("$filter") String filter, + @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, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serviceName") String serviceName, + @PathParam("workspaceName") String workspaceName, + @PathParam("apiName") String apiName, + @PathParam("deploymentName") String deploymentName, + @QueryParam("api-version") String apiVersion, + @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, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serviceName") String serviceName, + @PathParam("workspaceName") String workspaceName, + @PathParam("apiName") String apiName, + @PathParam("deploymentName") String deploymentName, + @QueryParam("api-version") String apiVersion, + @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, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serviceName") String serviceName, + @PathParam("workspaceName") String workspaceName, + @PathParam("apiName") String apiName, + @PathParam("deploymentName") String deploymentName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") DeploymentInner payload, + @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, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serviceName") String serviceName, + @PathParam("workspaceName") String workspaceName, + @PathParam("apiName") String apiName, + @PathParam("deploymentName") String deploymentName, + @QueryParam("api-version") String apiVersion, + @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); + } + + /** + * List deployments + * + *

Returns a collection of API deployments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 aPI deployment collection 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.getSubscriptionId(), + resourceGroupName, + serviceName, + workspaceName, + apiName, + this.client.getApiVersion(), + 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())); + } + + /** + * List deployments + * + *

Returns a collection of API deployments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 aPI deployment collection 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.getSubscriptionId(), + resourceGroupName, + serviceName, + workspaceName, + apiName, + this.client.getApiVersion(), + filter, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List deployments + * + *

Returns a collection of API deployments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 aPI deployment collection 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)); + } + + /** + * List deployments + * + *

Returns a collection of API deployments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 deployment collection 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)); + } + + /** + * List deployments + * + *

Returns a collection of API deployments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 aPI deployment collection 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)); + } + + /** + * List deployments + * + *

Returns a collection of API deployments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 deployment collection 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)); + } + + /** + * List deployments + * + *

Returns a collection of API deployments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 aPI deployment collection 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)); + } + + /** + * Delete API deployment + * + *

Deletes API deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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.getSubscriptionId(), + resourceGroupName, + serviceName, + workspaceName, + apiName, + deploymentName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete API deployment + * + *

Deletes API deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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.getSubscriptionId(), + resourceGroupName, + serviceName, + workspaceName, + apiName, + deploymentName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Delete API deployment + * + *

Deletes API deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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()); + } + + /** + * Delete API deployment + * + *

Deletes API deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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(); + } + + /** + * Delete API deployment + * + *

Deletes API deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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); + } + + /** + * Get API deployment + * + *

Returns details of the API deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 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.getSubscriptionId(), + resourceGroupName, + serviceName, + workspaceName, + apiName, + deploymentName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get API deployment + * + *

Returns details of the API deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 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.getSubscriptionId(), + resourceGroupName, + serviceName, + workspaceName, + apiName, + deploymentName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Get API deployment + * + *

Returns details of the API deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 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())); + } + + /** + * Get API deployment + * + *

Returns details of the API deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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. + */ + @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(); + } + + /** + * Get API deployment + * + *

Returns details of the API deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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. + */ + @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(); + } + + /** + * Create or update API deployment + * + *

Creates new or updates existing API deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param deploymentName The name of the API deployment. + * @param payload API deployment entity. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateWithResponseAsync( + String resourceGroupName, + String serviceName, + String workspaceName, + String apiName, + String deploymentName, + DeploymentInner payload) { + 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 (payload == null) { + return Mono.error(new IllegalArgumentException("Parameter payload is required and cannot be null.")); + } else { + payload.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + workspaceName, + apiName, + deploymentName, + this.client.getApiVersion(), + payload, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create or update API deployment + * + *

Creates new or updates existing API deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param deploymentName The name of the API deployment. + * @param payload API deployment entity. + * @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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateWithResponseAsync( + String resourceGroupName, + String serviceName, + String workspaceName, + String apiName, + String deploymentName, + DeploymentInner payload, + 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 (payload == null) { + return Mono.error(new IllegalArgumentException("Parameter payload is required and cannot be null.")); + } else { + payload.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + workspaceName, + apiName, + deploymentName, + this.client.getApiVersion(), + payload, + accept, + context); + } + + /** + * Create or update API deployment + * + *

Creates new or updates existing API deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param deploymentName The name of the API deployment. + * @param payload API deployment entity. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serviceName, + String workspaceName, + String apiName, + String deploymentName, + DeploymentInner payload) { + return createOrUpdateWithResponseAsync( + resourceGroupName, serviceName, workspaceName, apiName, deploymentName, payload) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Create or update API deployment + * + *

Creates new or updates existing API deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param deploymentName The name of the API deployment. + * @param payload API deployment entity. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DeploymentsCreateOrUpdateResponse createOrUpdateWithResponse( + String resourceGroupName, + String serviceName, + String workspaceName, + String apiName, + String deploymentName, + DeploymentInner payload, + Context context) { + return createOrUpdateWithResponseAsync( + resourceGroupName, serviceName, workspaceName, apiName, deploymentName, payload, context) + .block(); + } + + /** + * Create or update API deployment + * + *

Creates new or updates existing API deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param deploymentName The name of the API deployment. + * @param payload API deployment entity. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DeploymentInner createOrUpdate( + String resourceGroupName, + String serviceName, + String workspaceName, + String apiName, + String deploymentName, + DeploymentInner payload) { + return createOrUpdateWithResponse( + resourceGroupName, serviceName, workspaceName, apiName, deploymentName, payload, Context.NONE) + .getValue(); + } + + /** + * Check if API deployment exists + * + *

Checks if specified API deployment exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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.getSubscriptionId(), + resourceGroupName, + serviceName, + workspaceName, + apiName, + deploymentName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Check if API deployment exists + * + *

Checks if specified API deployment exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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.getSubscriptionId(), + resourceGroupName, + serviceName, + workspaceName, + apiName, + deploymentName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Check if API deployment exists + * + *

Checks if specified API deployment exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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()); + } + + /** + * Check if API deployment exists + * + *

Checks if specified API deployment exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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(); + } + + /** + * Check if API deployment exists + * + *

Checks if specified API deployment exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 aPI deployment collection 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 aPI deployment collection 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..5599dc623ee8c --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/DeploymentsImpl.java @@ -0,0 +1,290 @@ +// 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 Utils.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 Utils.mapPage(inner, inner1 -> new DeploymentImpl(inner1, this.manager())); + } + + 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 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 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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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..eb4ab3b6c49ba --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/EnvironmentImpl.java @@ -0,0 +1,199 @@ +// 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.EnvironmentServer; +import com.azure.resourcemanager.apicenter.models.EnvironmentType; +import com.azure.resourcemanager.apicenter.models.Onboarding; + +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 SystemData systemData() { + return this.innerModel().systemData(); + } + + public String title() { + return this.innerModel().title(); + } + + public String description() { + return this.innerModel().description(); + } + + public EnvironmentType typePropertiesType() { + return this.innerModel().typePropertiesType(); + } + + public EnvironmentServer server() { + return this.innerModel().server(); + } + + public Onboarding onboarding() { + return this.innerModel().onboarding(); + } + + public Object customProperties() { + return this.innerModel().customProperties(); + } + + 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 = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serviceName = Utils.getValueFromIdByName(innerObject.id(), "services"); + this.workspaceName = Utils.getValueFromIdByName(innerObject.id(), "workspaces"); + this.environmentName = Utils.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 withTitle(String title) { + this.innerModel().withTitle(title); + return this; + } + + public EnvironmentImpl withDescription(String description) { + this.innerModel().withDescription(description); + return this; + } + + public EnvironmentImpl withTypePropertiesType(EnvironmentType typePropertiesType) { + this.innerModel().withTypePropertiesType(typePropertiesType); + return this; + } + + public EnvironmentImpl withServer(EnvironmentServer server) { + this.innerModel().withServer(server); + return this; + } + + public EnvironmentImpl withOnboarding(Onboarding onboarding) { + this.innerModel().withOnboarding(onboarding); + return this; + } + + public EnvironmentImpl withCustomProperties(Object customProperties) { + this.innerModel().withCustomProperties(customProperties); + 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..4a58db940b73c --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/EnvironmentsClientImpl.java @@ -0,0 +1,1232 @@ +// 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.EnvironmentCollection; +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, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serviceName") String serviceName, + @PathParam("workspaceName") String workspaceName, + @QueryParam("api-version") String apiVersion, + @QueryParam("$filter") String filter, + @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, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serviceName") String serviceName, + @PathParam("workspaceName") String workspaceName, + @PathParam("environmentName") String environmentName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") EnvironmentInner payload, + @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, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serviceName") String serviceName, + @PathParam("workspaceName") String workspaceName, + @PathParam("environmentName") String environmentName, + @QueryParam("api-version") String apiVersion, + @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, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serviceName") String serviceName, + @PathParam("workspaceName") String workspaceName, + @PathParam("environmentName") String environmentName, + @QueryParam("api-version") String apiVersion, + @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, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serviceName") String serviceName, + @PathParam("workspaceName") String workspaceName, + @PathParam("environmentName") String environmentName, + @QueryParam("api-version") String apiVersion, + @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); + } + + /** + * List environments + * + *

Returns a collection of environments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 environments collection 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.getSubscriptionId(), + resourceGroupName, + serviceName, + workspaceName, + this.client.getApiVersion(), + 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())); + } + + /** + * List environments + * + *

Returns a collection of environments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 environments collection 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.getSubscriptionId(), + resourceGroupName, + serviceName, + workspaceName, + this.client.getApiVersion(), + filter, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List environments + * + *

Returns a collection of environments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 environments collection 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)); + } + + /** + * List environments + * + *

Returns a collection of environments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 environments collection 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)); + } + + /** + * List environments + * + *

Returns a collection of environments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 environments collection 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)); + } + + /** + * List environments + * + *

Returns a collection of environments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 environments collection 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)); + } + + /** + * List environments + * + *

Returns a collection of environments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 environments collection 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)); + } + + /** + * Create or update environment + * + *

Creates new or updates existing environment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @param workspaceName The name of the workspace. + * @param environmentName The name of the environment. + * @param payload Environment entity. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateWithResponseAsync( + String resourceGroupName, + String serviceName, + String workspaceName, + String environmentName, + EnvironmentInner payload) { + 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 (payload == null) { + return Mono.error(new IllegalArgumentException("Parameter payload is required and cannot be null.")); + } else { + payload.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + workspaceName, + environmentName, + this.client.getApiVersion(), + payload, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create or update environment + * + *

Creates new or updates existing environment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @param workspaceName The name of the workspace. + * @param environmentName The name of the environment. + * @param payload Environment entity. + * @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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateWithResponseAsync( + String resourceGroupName, + String serviceName, + String workspaceName, + String environmentName, + EnvironmentInner payload, + 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 (payload == null) { + return Mono.error(new IllegalArgumentException("Parameter payload is required and cannot be null.")); + } else { + payload.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + workspaceName, + environmentName, + this.client.getApiVersion(), + payload, + accept, + context); + } + + /** + * Create or update environment + * + *

Creates new or updates existing environment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @param workspaceName The name of the workspace. + * @param environmentName The name of the environment. + * @param payload Environment entity. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serviceName, + String workspaceName, + String environmentName, + EnvironmentInner payload) { + return createOrUpdateWithResponseAsync(resourceGroupName, serviceName, workspaceName, environmentName, payload) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Create or update environment + * + *

Creates new or updates existing environment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @param workspaceName The name of the workspace. + * @param environmentName The name of the environment. + * @param payload Environment entity. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public EnvironmentsCreateOrUpdateResponse createOrUpdateWithResponse( + String resourceGroupName, + String serviceName, + String workspaceName, + String environmentName, + EnvironmentInner payload, + Context context) { + return createOrUpdateWithResponseAsync( + resourceGroupName, serviceName, workspaceName, environmentName, payload, context) + .block(); + } + + /** + * Create or update environment + * + *

Creates new or updates existing environment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @param workspaceName The name of the workspace. + * @param environmentName The name of the environment. + * @param payload Environment entity. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public EnvironmentInner createOrUpdate( + String resourceGroupName, + String serviceName, + String workspaceName, + String environmentName, + EnvironmentInner payload) { + return createOrUpdateWithResponse( + resourceGroupName, serviceName, workspaceName, environmentName, payload, Context.NONE) + .getValue(); + } + + /** + * Delete environment + * + *

Deletes the environment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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.getSubscriptionId(), + resourceGroupName, + serviceName, + workspaceName, + environmentName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete environment + * + *

Deletes the environment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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.getSubscriptionId(), + resourceGroupName, + serviceName, + workspaceName, + environmentName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Delete environment + * + *

Deletes the environment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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()); + } + + /** + * Delete environment + * + *

Deletes the environment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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(); + } + + /** + * Delete environment + * + *

Deletes the environment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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); + } + + /** + * Check if environment exists + * + *

Checks if specified environment exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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.getSubscriptionId(), + resourceGroupName, + serviceName, + workspaceName, + environmentName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Check if environment exists + * + *

Checks if specified environment exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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.getSubscriptionId(), + resourceGroupName, + serviceName, + workspaceName, + environmentName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Check if environment exists + * + *

Checks if specified environment exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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()); + } + + /** + * Check if environment exists + * + *

Checks if specified environment exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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(); + } + + /** + * Check if environment exists + * + *

Checks if specified environment exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 environment + * + *

Returns details of the environment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 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.getSubscriptionId(), + resourceGroupName, + serviceName, + workspaceName, + environmentName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get environment + * + *

Returns details of the environment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 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.getSubscriptionId(), + resourceGroupName, + serviceName, + workspaceName, + environmentName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Get environment + * + *

Returns details of the environment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 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())); + } + + /** + * Get environment + * + *

Returns details of the environment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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. + */ + @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(); + } + + /** + * Get environment + * + *

Returns details of the environment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public EnvironmentInner get( + String resourceGroupName, String serviceName, String workspaceName, String environmentName) { + return getWithResponse(resourceGroupName, serviceName, workspaceName, environmentName, Context.NONE).getValue(); + } + + /** + * 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 environments collection 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 environments collection 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..dd6b8cc5cec9e --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/EnvironmentsImpl.java @@ -0,0 +1,238 @@ +// 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 Utils.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 Utils.mapPage(inner, inner1 -> new EnvironmentImpl(inner1, this.manager())); + } + + 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 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 Environment getById(String id) { + String resourceGroupName = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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..71575b5c618e5 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/MetadataSchemaExportResultImpl.java @@ -0,0 +1,38 @@ +// 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..1f84be6b8ec76 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/MetadataSchemaImpl.java @@ -0,0 +1,165 @@ +// 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.MetadataAssignment; +import com.azure.resourcemanager.apicenter.models.MetadataSchema; +import java.util.Collections; +import java.util.List; + +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 SystemData systemData() { + return this.innerModel().systemData(); + } + + public String schema() { + return this.innerModel().schema(); + } + + public List assignedTo() { + List inner = this.innerModel().assignedTo(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + 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 = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serviceName = Utils.getValueFromIdByName(innerObject.id(), "services"); + this.metadataSchemaName = Utils.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 withSchema(String schema) { + this.innerModel().withSchema(schema); + return this; + } + + public MetadataSchemaImpl withAssignedTo(List assignedTo) { + this.innerModel().withAssignedTo(assignedTo); + 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..0809a8656fd56 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/MetadataSchemasClientImpl.java @@ -0,0 +1,1140 @@ +// 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.MetadataSchemaCollection; +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, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serviceName") String serviceName, + @QueryParam("api-version") String apiVersion, + @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, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serviceName") String serviceName, + @PathParam("metadataSchemaName") String metadataSchemaName, + @QueryParam("api-version") String apiVersion, + @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, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serviceName") String serviceName, + @PathParam("metadataSchemaName") String metadataSchemaName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") MetadataSchemaInner payload, + @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, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serviceName") String serviceName, + @PathParam("metadataSchemaName") String metadataSchemaName, + @QueryParam("api-version") String apiVersion, + @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, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serviceName") String serviceName, + @PathParam("metadataSchemaName") String metadataSchemaName, + @QueryParam("api-version") String apiVersion, + @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); + } + + /** + * List metadata schemas + * + *

Returns a collection of metadata schemas. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 metadata schema collection 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.getSubscriptionId(), + resourceGroupName, + serviceName, + this.client.getApiVersion(), + 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())); + } + + /** + * List metadata schemas + * + *

Returns a collection of metadata schemas. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 metadata schema collection 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.getSubscriptionId(), + resourceGroupName, + serviceName, + this.client.getApiVersion(), + filter, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List metadata schemas + * + *

Returns a collection of metadata schemas. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 metadata schema collection 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)); + } + + /** + * List metadata schemas + * + *

Returns a collection of metadata schemas. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 collection 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)); + } + + /** + * List metadata schemas + * + *

Returns a collection of metadata schemas. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 metadata schema collection 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)); + } + + /** + * List metadata schemas + * + *

Returns a collection of metadata schemas. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 collection 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)); + } + + /** + * List metadata schemas + * + *

Returns a collection of metadata schemas. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 metadata schema collection 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)); + } + + /** + * Get metadata schema + * + *

Returns details of the metadata schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 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.getSubscriptionId(), + resourceGroupName, + serviceName, + metadataSchemaName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get metadata schema + * + *

Returns details of the metadata schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 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.getSubscriptionId(), + resourceGroupName, + serviceName, + metadataSchemaName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Get metadata schema + * + *

Returns details of the metadata schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 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())); + } + + /** + * Get metadata schema + * + *

Returns details of the metadata schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MetadataSchemasGetResponse getWithResponse( + String resourceGroupName, String serviceName, String metadataSchemaName, Context context) { + return getWithResponseAsync(resourceGroupName, serviceName, metadataSchemaName, context).block(); + } + + /** + * Get metadata schema + * + *

Returns details of the metadata schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MetadataSchemaInner get(String resourceGroupName, String serviceName, String metadataSchemaName) { + return getWithResponse(resourceGroupName, serviceName, metadataSchemaName, Context.NONE).getValue(); + } + + /** + * Create or update metadata schema + * + *

Creates new or updates existing metadata schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @param metadataSchemaName The name of the metadata schema. + * @param payload Metadata schema entity. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateWithResponseAsync( + String resourceGroupName, String serviceName, String metadataSchemaName, MetadataSchemaInner payload) { + 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 (payload == null) { + return Mono.error(new IllegalArgumentException("Parameter payload is required and cannot be null.")); + } else { + payload.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + metadataSchemaName, + this.client.getApiVersion(), + payload, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create or update metadata schema + * + *

Creates new or updates existing metadata schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @param metadataSchemaName The name of the metadata schema. + * @param payload Metadata schema entity. + * @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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateWithResponseAsync( + String resourceGroupName, + String serviceName, + String metadataSchemaName, + MetadataSchemaInner payload, + 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 (payload == null) { + return Mono.error(new IllegalArgumentException("Parameter payload is required and cannot be null.")); + } else { + payload.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + metadataSchemaName, + this.client.getApiVersion(), + payload, + accept, + context); + } + + /** + * Create or update metadata schema + * + *

Creates new or updates existing metadata schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @param metadataSchemaName The name of the metadata schema. + * @param payload Metadata schema entity. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String serviceName, String metadataSchemaName, MetadataSchemaInner payload) { + return createOrUpdateWithResponseAsync(resourceGroupName, serviceName, metadataSchemaName, payload) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Create or update metadata schema + * + *

Creates new or updates existing metadata schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @param metadataSchemaName The name of the metadata schema. + * @param payload Metadata schema entity. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MetadataSchemasCreateOrUpdateResponse createOrUpdateWithResponse( + String resourceGroupName, + String serviceName, + String metadataSchemaName, + MetadataSchemaInner payload, + Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, serviceName, metadataSchemaName, payload, context) + .block(); + } + + /** + * Create or update metadata schema + * + *

Creates new or updates existing metadata schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @param metadataSchemaName The name of the metadata schema. + * @param payload Metadata schema entity. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MetadataSchemaInner createOrUpdate( + String resourceGroupName, String serviceName, String metadataSchemaName, MetadataSchemaInner payload) { + return createOrUpdateWithResponse(resourceGroupName, serviceName, metadataSchemaName, payload, Context.NONE) + .getValue(); + } + + /** + * Delete metadata schema + * + *

Deletes specified metadata schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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.getSubscriptionId(), + resourceGroupName, + serviceName, + metadataSchemaName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete metadata schema + * + *

Deletes specified metadata schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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.getSubscriptionId(), + resourceGroupName, + serviceName, + metadataSchemaName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Delete metadata schema + * + *

Deletes specified metadata schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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()); + } + + /** + * Delete metadata schema + * + *

Deletes specified metadata schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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(); + } + + /** + * Delete metadata schema + * + *

Deletes specified metadata schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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); + } + + /** + * Check metadata schema exists + * + *

Checks if specified metadata schema exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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.getSubscriptionId(), + resourceGroupName, + serviceName, + metadataSchemaName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Check metadata schema exists + * + *

Checks if specified metadata schema exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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.getSubscriptionId(), + resourceGroupName, + serviceName, + metadataSchemaName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Check metadata schema exists + * + *

Checks if specified metadata schema exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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()); + } + + /** + * Check metadata schema exists + * + *

Checks if specified metadata schema exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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(); + } + + /** + * Check metadata schema exists + * + *

Checks if specified metadata schema exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 metadata schema collection 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 metadata schema collection 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..3925f28364a8f --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/MetadataSchemasImpl.java @@ -0,0 +1,204 @@ +// 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 Utils.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 Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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..28f4cd4c59f82 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 @@ -78,7 +78,9 @@ Mono> listNext( } /** - * List the operations for the provider. + * List resource provider operations + * + *

Returns a collection of resource provider operations. * * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -110,7 +112,9 @@ private Mono> listSinglePageAsync() { } /** - * List the operations for the provider. + * List resource provider operations + * + *

Returns a collection of resource provider operations. * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -143,7 +147,9 @@ private Mono> listSinglePageAsync(Context context) } /** - * List the operations for the provider. + * List resource provider operations + * + *

Returns a collection of resource provider operations. * * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -156,7 +162,9 @@ private PagedFlux listAsync() { } /** - * List the operations for the provider. + * List resource provider operations + * + *

Returns a collection of resource provider operations. * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -172,7 +180,9 @@ private PagedFlux listAsync(Context context) { } /** - * List the operations for the provider. + * List resource provider operations + * + *

Returns a collection of resource provider operations. * * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -185,7 +195,9 @@ public PagedIterable list() { } /** - * List the operations for the provider. + * List resource provider operations + * + *

Returns a collection of resource provider operations. * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. 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..3373785a8d543 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 @@ -4,11 +4,14 @@ package com.azure.resourcemanager.apicenter.implementation; +import com.azure.core.http.rest.Response; import com.azure.core.management.Region; import com.azure.core.management.SystemData; 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.MetadataSchemaExportRequest; +import com.azure.resourcemanager.apicenter.models.MetadataSchemaExportResult; import com.azure.resourcemanager.apicenter.models.ProvisioningState; import com.azure.resourcemanager.apicenter.models.Service; import com.azure.resourcemanager.apicenter.models.ServiceUpdate; @@ -81,7 +84,7 @@ private com.azure.resourcemanager.apicenter.ApiCenterManager manager() { private String serviceName; - private ServiceUpdate updateParameters; + private ServiceUpdate updatePayload; public ServiceImpl withExistingResourceGroup(String resourceGroupName) { this.resourceGroupName = resourceGroupName; @@ -115,7 +118,7 @@ public Service create(Context context) { } public ServiceImpl update() { - this.updateParameters = new ServiceUpdate(); + this.updatePayload = new ServiceUpdate(); return this; } @@ -124,7 +127,7 @@ public Service apply() { serviceManager .serviceClient() .getServices() - .updateWithResponse(resourceGroupName, serviceName, updateParameters, Context.NONE) + .updateWithResponse(resourceGroupName, serviceName, updatePayload, Context.NONE) .getValue(); return this; } @@ -134,7 +137,7 @@ public Service apply(Context context) { serviceManager .serviceClient() .getServices() - .updateWithResponse(resourceGroupName, serviceName, updateParameters, context) + .updateWithResponse(resourceGroupName, serviceName, updatePayload, context) .getValue(); return this; } @@ -166,6 +169,17 @@ public Service refresh(Context context) { return this; } + public Response exportMetadataSchemaWithResponse( + MetadataSchemaExportRequest payload, Context context) { + return serviceManager + .services() + .exportMetadataSchemaWithResponse(resourceGroupName, serviceName, payload, context); + } + + public MetadataSchemaExportResult exportMetadataSchema(MetadataSchemaExportRequest payload) { + return serviceManager.services().exportMetadataSchema(resourceGroupName, serviceName, payload); + } + public ServiceImpl withRegion(Region location) { this.innerModel().withLocation(location.toString()); return this; 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..503b1ee47179e 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; @@ -30,7 +31,9 @@ import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; 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.ServiceCollection; import com.azure.resourcemanager.apicenter.models.ServiceUpdate; import reactor.core.publisher.Mono; @@ -109,7 +112,7 @@ Mono> createOrUpdate( @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("serviceName") String serviceName, - @BodyParam("application/json") ServiceInner resource, + @BodyParam("application/json") ServiceInner payload, @HeaderParam("Accept") String accept, Context context); @@ -124,7 +127,7 @@ Mono> update( @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("serviceName") String serviceName, - @BodyParam("application/json") ServiceUpdate parameters, + @BodyParam("application/json") ServiceUpdate payload, @HeaderParam("Accept") String accept, Context context); @@ -142,6 +145,21 @@ Mono> delete( @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, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serviceName") String serviceName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") MetadataSchemaExportRequest payload, + @HeaderParam("Accept") String accept, + Context context); + @Headers({"Content-Type: application/json"}) @Get("{nextLink}") @ExpectedResponses({200}) @@ -307,7 +325,7 @@ 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. @@ -359,7 +377,7 @@ private Mono> listByResourceGroupSinglePageAsync(Str } /** - * 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. @@ -410,7 +428,7 @@ private Mono> listByResourceGroupSinglePageAsync( } /** - * 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. @@ -426,7 +444,7 @@ private PagedFlux listByResourceGroupAsync(String resourceGroupNam } /** - * 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. @@ -443,7 +461,7 @@ private PagedFlux listByResourceGroupAsync(String resourceGroupNam } /** - * 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. @@ -457,7 +475,7 @@ 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. @@ -472,14 +490,16 @@ public PagedIterable listByResourceGroup(String resourceGroupName, } /** - * Get service. + * Get service + * + *

Returns details of the service. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serviceName Service name. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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( @@ -520,7 +540,9 @@ private Mono> getByResourceGroupWithResponseAsync( } /** - * Get service. + * Get service + * + *

Returns details of the service. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serviceName Service name. @@ -528,7 +550,7 @@ private Mono> getByResourceGroupWithResponseAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @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( @@ -566,14 +588,16 @@ private Mono> getByResourceGroupWithResponseAsync( } /** - * Get service. + * Get service + * + *

Returns details of the service. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serviceName Service name. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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,7 +606,9 @@ private Mono getByResourceGroupAsync(String resourceGroupName, Str } /** - * Get service. + * Get service + * + *

Returns details of the service. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serviceName Service name. @@ -590,7 +616,7 @@ private Mono getByResourceGroupAsync(String resourceGroupName, Str * @throws IllegalArgumentException thrown if parameters fail the validation. * @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( @@ -599,14 +625,16 @@ public Response getByResourceGroupWithResponse( } /** - * Get service. + * Get service + * + *

Returns details of the service. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serviceName Service name. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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,11 +642,13 @@ public ServiceInner getByResourceGroup(String resourceGroupName, String serviceN } /** - * Create or update service. + * 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 payload The service entity. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -626,7 +656,7 @@ public ServiceInner getByResourceGroup(String resourceGroupName, String serviceN */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> createOrUpdateWithResponseAsync( - String resourceGroupName, String serviceName, ServiceInner resource) { + String resourceGroupName, String serviceName, ServiceInner payload) { if (this.client.getEndpoint() == null) { return Mono .error( @@ -646,8 +676,8 @@ private Mono> createOrUpdateWithResponseAsync( if (serviceName == null) { return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); } - if (resource != null) { - resource.validate(); + if (payload != null) { + payload.validate(); } final String accept = "application/json"; return FluxUtil @@ -660,18 +690,20 @@ private Mono> createOrUpdateWithResponseAsync( this.client.getSubscriptionId(), resourceGroupName, serviceName, - resource, + payload, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * Create or update service. + * 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 payload The service entity. * @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. @@ -680,7 +712,7 @@ private Mono> createOrUpdateWithResponseAsync( */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> createOrUpdateWithResponseAsync( - String resourceGroupName, String serviceName, ServiceInner resource, Context context) { + String resourceGroupName, String serviceName, ServiceInner payload, Context context) { if (this.client.getEndpoint() == null) { return Mono .error( @@ -700,8 +732,8 @@ private Mono> createOrUpdateWithResponseAsync( if (serviceName == null) { return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); } - if (resource != null) { - resource.validate(); + if (payload != null) { + payload.validate(); } final String accept = "application/json"; context = this.client.mergeContext(context); @@ -712,13 +744,15 @@ private Mono> createOrUpdateWithResponseAsync( this.client.getSubscriptionId(), resourceGroupName, serviceName, - resource, + payload, accept, context); } /** - * Create or update service. + * 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. @@ -729,17 +763,19 @@ private Mono> createOrUpdateWithResponseAsync( */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono createOrUpdateAsync(String resourceGroupName, String serviceName) { - final ServiceInner resource = null; - return createOrUpdateWithResponseAsync(resourceGroupName, serviceName, resource) + final ServiceInner payload = null; + return createOrUpdateWithResponseAsync(resourceGroupName, serviceName, payload) .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** - * Create or update service. + * 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 payload The service entity. * @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. @@ -748,12 +784,14 @@ private Mono createOrUpdateAsync(String resourceGroupName, String */ @ServiceMethod(returns = ReturnType.SINGLE) public Response createOrUpdateWithResponse( - String resourceGroupName, String serviceName, ServiceInner resource, Context context) { - return createOrUpdateWithResponseAsync(resourceGroupName, serviceName, resource, context).block(); + String resourceGroupName, String serviceName, ServiceInner payload, Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, serviceName, payload, context).block(); } /** - * Create or update service. + * 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. @@ -764,16 +802,18 @@ public Response createOrUpdateWithResponse( */ @ServiceMethod(returns = ReturnType.SINGLE) public ServiceInner createOrUpdate(String resourceGroupName, String serviceName) { - final ServiceInner resource = null; - return createOrUpdateWithResponse(resourceGroupName, serviceName, resource, Context.NONE).getValue(); + final ServiceInner payload = null; + return createOrUpdateWithResponse(resourceGroupName, serviceName, payload, Context.NONE).getValue(); } /** - * Update service. + * 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 payload The service 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. @@ -781,7 +821,7 @@ public ServiceInner createOrUpdate(String resourceGroupName, String serviceName) */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> updateWithResponseAsync( - String resourceGroupName, String serviceName, ServiceUpdate parameters) { + String resourceGroupName, String serviceName, ServiceUpdate payload) { if (this.client.getEndpoint() == null) { return Mono .error( @@ -801,8 +841,8 @@ 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 (payload != null) { + payload.validate(); } final String accept = "application/json"; return FluxUtil @@ -815,18 +855,20 @@ private Mono> updateWithResponseAsync( this.client.getSubscriptionId(), resourceGroupName, serviceName, - parameters, + payload, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * Update service. + * 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 payload The service 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. @@ -835,7 +877,7 @@ private Mono> updateWithResponseAsync( */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> updateWithResponseAsync( - String resourceGroupName, String serviceName, ServiceUpdate parameters, Context context) { + String resourceGroupName, String serviceName, ServiceUpdate payload, Context context) { if (this.client.getEndpoint() == null) { return Mono .error( @@ -855,8 +897,8 @@ 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 (payload != null) { + payload.validate(); } final String accept = "application/json"; context = this.client.mergeContext(context); @@ -867,13 +909,15 @@ private Mono> updateWithResponseAsync( this.client.getSubscriptionId(), resourceGroupName, serviceName, - parameters, + payload, accept, context); } /** - * Update service. + * Update service + * + *

Updates existing service. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serviceName Service name. @@ -884,17 +928,19 @@ private Mono> updateWithResponseAsync( */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono updateAsync(String resourceGroupName, String serviceName) { - final ServiceUpdate parameters = null; - return updateWithResponseAsync(resourceGroupName, serviceName, parameters) + final ServiceUpdate payload = null; + return updateWithResponseAsync(resourceGroupName, serviceName, payload) .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** - * Update service. + * 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 payload The service 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. @@ -903,12 +949,14 @@ private Mono updateAsync(String resourceGroupName, String serviceN */ @ServiceMethod(returns = ReturnType.SINGLE) public Response updateWithResponse( - String resourceGroupName, String serviceName, ServiceUpdate parameters, Context context) { - return updateWithResponseAsync(resourceGroupName, serviceName, parameters, context).block(); + String resourceGroupName, String serviceName, ServiceUpdate payload, Context context) { + return updateWithResponseAsync(resourceGroupName, serviceName, payload, context).block(); } /** - * Update service. + * Update service + * + *

Updates existing service. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serviceName Service name. @@ -919,12 +967,14 @@ public Response updateWithResponse( */ @ServiceMethod(returns = ReturnType.SINGLE) public ServiceInner update(String resourceGroupName, String serviceName) { - final ServiceUpdate parameters = null; - return updateWithResponse(resourceGroupName, serviceName, parameters, Context.NONE).getValue(); + final ServiceUpdate payload = null; + return updateWithResponse(resourceGroupName, serviceName, payload, Context.NONE).getValue(); } /** - * Delete service. + * Delete service + * + *

Deletes specified service. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serviceName Service name. @@ -971,7 +1021,9 @@ private Mono> deleteWithResponseAsync(String resourceGroupName, S } /** - * Delete service. + * Delete service + * + *

Deletes specified service. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serviceName Service name. @@ -1017,7 +1069,9 @@ private Mono> deleteWithResponseAsync( } /** - * Delete service. + * Delete service + * + *

Deletes specified service. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serviceName Service name. @@ -1032,7 +1086,9 @@ private Mono deleteAsync(String resourceGroupName, String serviceName) { } /** - * Delete service. + * Delete service + * + *

Deletes specified service. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serviceName Service name. @@ -1048,7 +1104,9 @@ public Response deleteWithResponse(String resourceGroupName, String servic } /** - * Delete service. + * Delete service + * + *

Deletes specified service. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serviceName Service name. @@ -1061,6 +1119,177 @@ public void delete(String resourceGroupName, String serviceName) { deleteWithResponse(resourceGroupName, serviceName, Context.NONE); } + /** + * Export effective metadata schema + * + *

Exports the effective metadata schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @param payload The metadata schema request details. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 payload) { + 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 (payload == null) { + return Mono.error(new IllegalArgumentException("Parameter payload is required and cannot be null.")); + } else { + payload.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .exportMetadataSchema( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + this.client.getApiVersion(), + payload, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Export effective metadata schema + * + *

Exports the effective metadata schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @param payload The metadata schema request details. + * @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 payload, 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 (payload == null) { + return Mono.error(new IllegalArgumentException("Parameter payload is required and cannot be null.")); + } else { + payload.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .exportMetadataSchema( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + this.client.getApiVersion(), + payload, + accept, + context); + } + + /** + * Export effective metadata schema + * + *

Exports the effective metadata schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @param payload The metadata schema request details. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 payload) { + return exportMetadataSchemaWithResponseAsync(resourceGroupName, serviceName, payload) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Export effective metadata schema + * + *

Exports the effective metadata schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @param payload The metadata schema request details. + * @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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response exportMetadataSchemaWithResponse( + String resourceGroupName, String serviceName, MetadataSchemaExportRequest payload, Context context) { + return exportMetadataSchemaWithResponseAsync(resourceGroupName, serviceName, payload, context).block(); + } + + /** + * Export effective metadata schema + * + *

Exports the effective metadata schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @param payload The metadata schema request details. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 payload) { + return exportMetadataSchemaWithResponse(resourceGroupName, serviceName, payload, Context.NONE).getValue(); + } + /** * Get the next page of items. * 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..ffa504659e65f 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; @@ -80,6 +83,32 @@ public void deleteByResourceGroup(String resourceGroupName, String serviceName) this.serviceClient().delete(resourceGroupName, serviceName); } + public Response exportMetadataSchemaWithResponse( + String resourceGroupName, String serviceName, MetadataSchemaExportRequest payload, Context context) { + Response inner = + this.serviceClient().exportMetadataSchemaWithResponse(resourceGroupName, serviceName, payload, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new MetadataSchemaExportResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public MetadataSchemaExportResult exportMetadataSchema( + String resourceGroupName, String serviceName, MetadataSchemaExportRequest payload) { + MetadataSchemaExportResultInner inner = + this.serviceClient().exportMetadataSchema(resourceGroupName, serviceName, payload); + if (inner != null) { + return new MetadataSchemaExportResultImpl(inner, this.manager()); + } else { + return null; + } + } + public Service getById(String id) { String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); if (resourceGroupName == null) { 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..ac18549f1a2cf --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/WorkspaceImpl.java @@ -0,0 +1,154 @@ +// 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; + +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 SystemData systemData() { + return this.innerModel().systemData(); + } + + public String title() { + return this.innerModel().title(); + } + + public String description() { + return this.innerModel().description(); + } + + 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 = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serviceName = Utils.getValueFromIdByName(innerObject.id(), "services"); + this.workspaceName = Utils.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 withTitle(String title) { + this.innerModel().withTitle(title); + return this; + } + + public WorkspaceImpl withDescription(String description) { + this.innerModel().withDescription(description); + 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..214bd31639b14 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/WorkspacesClientImpl.java @@ -0,0 +1,1120 @@ +// 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.WorkspaceCollection; +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, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serviceName") String serviceName, + @QueryParam("api-version") String apiVersion, + @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, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serviceName") String serviceName, + @PathParam("workspaceName") String workspaceName, + @QueryParam("api-version") String apiVersion, + @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, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serviceName") String serviceName, + @PathParam("workspaceName") String workspaceName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") WorkspaceInner payload, + @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, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serviceName") String serviceName, + @PathParam("workspaceName") String workspaceName, + @QueryParam("api-version") String apiVersion, + @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, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serviceName") String serviceName, + @PathParam("workspaceName") String workspaceName, + @QueryParam("api-version") String apiVersion, + @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); + } + + /** + * List workspaces + * + *

Returns a collection of workspaces. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 workspace collection 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.getSubscriptionId(), + resourceGroupName, + serviceName, + this.client.getApiVersion(), + 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())); + } + + /** + * List workspaces + * + *

Returns a collection of workspaces. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 workspace collection 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.getSubscriptionId(), + resourceGroupName, + serviceName, + this.client.getApiVersion(), + filter, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List workspaces + * + *

Returns a collection of workspaces. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 workspace collection 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)); + } + + /** + * List workspaces + * + *

Returns a collection of workspaces. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 collection 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)); + } + + /** + * List workspaces + * + *

Returns a collection of workspaces. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 workspace collection 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)); + } + + /** + * List workspaces + * + *

Returns a collection of workspaces. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 collection 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)); + } + + /** + * List workspaces + * + *

Returns a collection of workspaces. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 workspace collection 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)); + } + + /** + * Get workspace + * + *

Returns details of the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 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.getSubscriptionId(), + resourceGroupName, + serviceName, + workspaceName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get workspace + * + *

Returns details of the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 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.getSubscriptionId(), + resourceGroupName, + serviceName, + workspaceName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Get workspace + * + *

Returns details of the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 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())); + } + + /** + * Get workspace + * + *

Returns details of the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WorkspacesGetResponse getWithResponse( + String resourceGroupName, String serviceName, String workspaceName, Context context) { + return getWithResponseAsync(resourceGroupName, serviceName, workspaceName, context).block(); + } + + /** + * Get workspace + * + *

Returns details of the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WorkspaceInner get(String resourceGroupName, String serviceName, String workspaceName) { + return getWithResponse(resourceGroupName, serviceName, workspaceName, Context.NONE).getValue(); + } + + /** + * Create or update workspace + * + *

Creates new or updates existing workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @param workspaceName The name of the workspace. + * @param payload Workspace entity. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateWithResponseAsync( + String resourceGroupName, String serviceName, String workspaceName, WorkspaceInner payload) { + 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 (payload == null) { + return Mono.error(new IllegalArgumentException("Parameter payload is required and cannot be null.")); + } else { + payload.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + workspaceName, + this.client.getApiVersion(), + payload, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create or update workspace + * + *

Creates new or updates existing workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @param workspaceName The name of the workspace. + * @param payload Workspace entity. + * @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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateWithResponseAsync( + String resourceGroupName, String serviceName, String workspaceName, WorkspaceInner payload, 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 (payload == null) { + return Mono.error(new IllegalArgumentException("Parameter payload is required and cannot be null.")); + } else { + payload.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceName, + workspaceName, + this.client.getApiVersion(), + payload, + accept, + context); + } + + /** + * Create or update workspace + * + *

Creates new or updates existing workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @param workspaceName The name of the workspace. + * @param payload Workspace entity. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String serviceName, String workspaceName, WorkspaceInner payload) { + return createOrUpdateWithResponseAsync(resourceGroupName, serviceName, workspaceName, payload) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Create or update workspace + * + *

Creates new or updates existing workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @param workspaceName The name of the workspace. + * @param payload Workspace entity. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WorkspacesCreateOrUpdateResponse createOrUpdateWithResponse( + String resourceGroupName, String serviceName, String workspaceName, WorkspaceInner payload, Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, serviceName, workspaceName, payload, context).block(); + } + + /** + * Create or update workspace + * + *

Creates new or updates existing workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @param workspaceName The name of the workspace. + * @param payload Workspace entity. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WorkspaceInner createOrUpdate( + String resourceGroupName, String serviceName, String workspaceName, WorkspaceInner payload) { + return createOrUpdateWithResponse(resourceGroupName, serviceName, workspaceName, payload, Context.NONE) + .getValue(); + } + + /** + * Delete workspace + * + *

Deletes specified workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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.getSubscriptionId(), + resourceGroupName, + serviceName, + workspaceName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete workspace + * + *

Deletes specified workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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.getSubscriptionId(), + resourceGroupName, + serviceName, + workspaceName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Delete workspace + * + *

Deletes specified workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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()); + } + + /** + * Delete workspace + * + *

Deletes specified workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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(); + } + + /** + * Delete workspace + * + *

Deletes specified workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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); + } + + /** + * Check workspace exists + * + *

Checks if specified workspace exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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.getSubscriptionId(), + resourceGroupName, + serviceName, + workspaceName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Check workspace exists + * + *

Checks if specified workspace exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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.getSubscriptionId(), + resourceGroupName, + serviceName, + workspaceName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Check workspace exists + * + *

Checks if specified workspace exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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()); + } + + /** + * Check workspace exists + * + *

Checks if specified workspace exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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(); + } + + /** + * Check workspace exists + * + *

Checks if specified workspace exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 workspace collection 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 workspace collection 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..92aef1829d775 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/implementation/WorkspacesImpl.java @@ -0,0 +1,199 @@ +// 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 Utils.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 Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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 = Utils.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/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..d7d754b96dc58 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/Api.java @@ -0,0 +1,462 @@ +// 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; +import java.util.List; + +/** 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 systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the title property: API title. + * + * @return the title value. + */ + String title(); + + /** + * Gets the typePropertiesType property: API type + * + *

Kind of API. For example, REST or GraphQL. + * + * @return the typePropertiesType value. + */ + ApiType typePropertiesType(); + + /** + * Gets the description property: Description + * + *

Description of the API. + * + * @return the description value. + */ + String description(); + + /** + * Gets the summary property: Short description of the API. + * + * @return the summary value. + */ + String summary(); + + /** + * Gets the lifecycleStage property: Current lifecycle stage of the API. + * + * @return the lifecycleStage value. + */ + LifecycleStage lifecycleStage(); + + /** + * Gets the termsOfService property: Terms of service + * + *

Terms of service for the API. + * + * @return the termsOfService value. + */ + TermsOfService termsOfService(); + + /** + * Gets the externalDocumentation property: The externalDocumentation property. + * + * @return the externalDocumentation value. + */ + List externalDocumentation(); + + /** + * Gets the contacts property: The contacts property. + * + * @return the contacts value. + */ + List contacts(); + + /** + * Gets the license property: License + * + *

The license information for the API. + * + * @return the license value. + */ + License license(); + + /** + * Gets the customProperties property: The custom metadata defined for API catalog entities. + * + * @return the customProperties value. + */ + Object customProperties(); + + /** + * 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 Service name. + * @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.WithTitle, + DefinitionStages.WithTypePropertiesType, + DefinitionStages.WithDescription, + DefinitionStages.WithSummary, + DefinitionStages.WithTermsOfService, + DefinitionStages.WithExternalDocumentation, + DefinitionStages.WithContacts, + DefinitionStages.WithLicense, + DefinitionStages.WithCustomProperties { + /** + * 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 title. */ + interface WithTitle { + /** + * Specifies the title property: API title.. + * + * @param title API title. + * @return the next definition stage. + */ + WithCreate withTitle(String title); + } + + /** The stage of the Api definition allowing to specify typePropertiesType. */ + interface WithTypePropertiesType { + /** + * Specifies the typePropertiesType property: API type + * + *

Kind of API. For example, REST or GraphQL.. + * + * @param typePropertiesType API type + *

Kind of API. For example, REST or GraphQL. + * @return the next definition stage. + */ + WithCreate withTypePropertiesType(ApiType typePropertiesType); + } + + /** The stage of the Api definition allowing to specify description. */ + interface WithDescription { + /** + * Specifies the description property: Description + * + *

Description of the API.. + * + * @param description Description + *

Description of the API. + * @return the next definition stage. + */ + WithCreate withDescription(String description); + } + + /** The stage of the Api definition allowing to specify summary. */ + interface WithSummary { + /** + * Specifies the summary property: Short description of the API.. + * + * @param summary Short description of the API. + * @return the next definition stage. + */ + WithCreate withSummary(String summary); + } + + /** The stage of the Api definition allowing to specify termsOfService. */ + interface WithTermsOfService { + /** + * Specifies the termsOfService property: Terms of service + * + *

Terms of service for the API.. + * + * @param termsOfService Terms of service + *

Terms of service for the API. + * @return the next definition stage. + */ + WithCreate withTermsOfService(TermsOfService termsOfService); + } + + /** The stage of the Api definition allowing to specify externalDocumentation. */ + interface WithExternalDocumentation { + /** + * Specifies the externalDocumentation property: The externalDocumentation property.. + * + * @param externalDocumentation The externalDocumentation property. + * @return the next definition stage. + */ + WithCreate withExternalDocumentation(List externalDocumentation); + } + + /** The stage of the Api definition allowing to specify contacts. */ + interface WithContacts { + /** + * Specifies the contacts property: The contacts property.. + * + * @param contacts The contacts property. + * @return the next definition stage. + */ + WithCreate withContacts(List contacts); + } + + /** The stage of the Api definition allowing to specify license. */ + interface WithLicense { + /** + * Specifies the license property: License + * + *

The license information for the API.. + * + * @param license License + *

The license information for the API. + * @return the next definition stage. + */ + WithCreate withLicense(License license); + } + + /** The stage of the Api definition allowing to specify customProperties. */ + interface WithCustomProperties { + /** + * Specifies the customProperties property: The custom metadata defined for API catalog entities.. + * + * @param customProperties The custom metadata defined for API catalog entities. + * @return the next definition stage. + */ + WithCreate withCustomProperties(Object customProperties); + } + } + + /** + * Begins update for the Api resource. + * + * @return the stage of resource update. + */ + Api.Update update(); + + /** The template for Api update. */ + interface Update + extends UpdateStages.WithTitle, + UpdateStages.WithTypePropertiesType, + UpdateStages.WithDescription, + UpdateStages.WithSummary, + UpdateStages.WithTermsOfService, + UpdateStages.WithExternalDocumentation, + UpdateStages.WithContacts, + UpdateStages.WithLicense, + UpdateStages.WithCustomProperties { + /** + * 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 { + /** The stage of the Api update allowing to specify title. */ + interface WithTitle { + /** + * Specifies the title property: API title.. + * + * @param title API title. + * @return the next definition stage. + */ + Update withTitle(String title); + } + + /** The stage of the Api update allowing to specify typePropertiesType. */ + interface WithTypePropertiesType { + /** + * Specifies the typePropertiesType property: API type + * + *

Kind of API. For example, REST or GraphQL.. + * + * @param typePropertiesType API type + *

Kind of API. For example, REST or GraphQL. + * @return the next definition stage. + */ + Update withTypePropertiesType(ApiType typePropertiesType); + } + + /** The stage of the Api update allowing to specify description. */ + interface WithDescription { + /** + * Specifies the description property: Description + * + *

Description of the API.. + * + * @param description Description + *

Description of the API. + * @return the next definition stage. + */ + Update withDescription(String description); + } + + /** The stage of the Api update allowing to specify summary. */ + interface WithSummary { + /** + * Specifies the summary property: Short description of the API.. + * + * @param summary Short description of the API. + * @return the next definition stage. + */ + Update withSummary(String summary); + } + + /** The stage of the Api update allowing to specify termsOfService. */ + interface WithTermsOfService { + /** + * Specifies the termsOfService property: Terms of service + * + *

Terms of service for the API.. + * + * @param termsOfService Terms of service + *

Terms of service for the API. + * @return the next definition stage. + */ + Update withTermsOfService(TermsOfService termsOfService); + } + + /** The stage of the Api update allowing to specify externalDocumentation. */ + interface WithExternalDocumentation { + /** + * Specifies the externalDocumentation property: The externalDocumentation property.. + * + * @param externalDocumentation The externalDocumentation property. + * @return the next definition stage. + */ + Update withExternalDocumentation(List externalDocumentation); + } + + /** The stage of the Api update allowing to specify contacts. */ + interface WithContacts { + /** + * Specifies the contacts property: The contacts property.. + * + * @param contacts The contacts property. + * @return the next definition stage. + */ + Update withContacts(List contacts); + } + + /** The stage of the Api update allowing to specify license. */ + interface WithLicense { + /** + * Specifies the license property: License + * + *

The license information for the API.. + * + * @param license License + *

The license information for the API. + * @return the next definition stage. + */ + Update withLicense(License license); + } + + /** The stage of the Api update allowing to specify customProperties. */ + interface WithCustomProperties { + /** + * Specifies the customProperties property: The custom metadata defined for API catalog entities.. + * + * @param customProperties The custom metadata defined for API catalog entities. + * @return the next definition stage. + */ + Update withCustomProperties(Object customProperties); + } + } + + /** + * 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/ApiCollection.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiCollection.java new file mode 100644 index 0000000000000..4a0c736000579 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiCollection.java @@ -0,0 +1,89 @@ +// 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.resourcemanager.apicenter.fluent.models.ApiInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * API collection + * + *

Paginated collection of APIs. + */ +@Fluent +public final class ApiCollection { + /* + * Page items. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Total record count number across all pages. + */ + @JsonProperty(value = "count") + private Long count; + + /* + * Next page link if any. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of ApiCollection class. */ + public ApiCollection() { + } + + /** + * Get the value property: Page items. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the count property: Total record count number across all pages. + * + * @return the count value. + */ + public Long count() { + return this.count; + } + + /** + * Set the count property: Total record count number across all pages. + * + * @param count the count value to set. + * @return the ApiCollection object itself. + */ + public ApiCollection withCount(Long count) { + this.count = count; + return this; + } + + /** + * Get the nextLink property: Next page link if any. + * + * @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/ApiDefinition.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiDefinition.java new file mode 100644 index 0000000000000..e1a7034a85d07 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiDefinition.java @@ -0,0 +1,262 @@ +// 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.Response; +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 systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the title property: API version. + * + * @return the title value. + */ + String title(); + + /** + * Gets the description property: API definition description. + * + * @return the description value. + */ + String description(); + + /** + * Gets the specification property: The specification property. + * + * @return the specification value. + */ + ApiDefinitionPropertiesSpecification specification(); + + /** + * 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 Service name. + * @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.WithTitle, DefinitionStages.WithDescription { + /** + * 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 title. */ + interface WithTitle { + /** + * Specifies the title property: API version.. + * + * @param title API version. + * @return the next definition stage. + */ + WithCreate withTitle(String title); + } + + /** The stage of the ApiDefinition definition allowing to specify description. */ + interface WithDescription { + /** + * Specifies the description property: API definition description.. + * + * @param description API definition description. + * @return the next definition stage. + */ + WithCreate withDescription(String description); + } + } + + /** + * Begins update for the ApiDefinition resource. + * + * @return the stage of resource update. + */ + ApiDefinition.Update update(); + + /** The template for ApiDefinition update. */ + interface Update extends UpdateStages.WithTitle, UpdateStages.WithDescription { + /** + * 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 { + /** The stage of the ApiDefinition update allowing to specify title. */ + interface WithTitle { + /** + * Specifies the title property: API version.. + * + * @param title API version. + * @return the next definition stage. + */ + Update withTitle(String title); + } + + /** The stage of the ApiDefinition update allowing to specify description. */ + interface WithDescription { + /** + * Specifies the description property: API definition description.. + * + * @param description API definition description. + * @return the next definition stage. + */ + Update withDescription(String description); + } + } + + /** + * 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); + + /** + * Import API specification + * + *

Imports the API specification. + * + * @param payload The API specification source entity. + * @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 importSpecificationWithResponse(ApiSpecImportRequest payload, Context context); + + /** + * Import API specification + * + *

Imports the API specification. + * + * @param payload The API specification source entity. + * @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 payload); + + /** + * Export API specification + * + *

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 along with {@link Response}. + */ + Response exportSpecificationWithResponse(Context context); + + /** + * Export API specification + * + *

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(); +} diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiDefinitionCollection.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiDefinitionCollection.java new file mode 100644 index 0000000000000..3d32d56c66833 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiDefinitionCollection.java @@ -0,0 +1,89 @@ +// 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.resourcemanager.apicenter.fluent.models.ApiDefinitionInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * API version collection + * + *

Paginated collection of API definitions. + */ +@Fluent +public final class ApiDefinitionCollection { + /* + * Page items. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Total record count number across all pages. + */ + @JsonProperty(value = "count") + private Long count; + + /* + * Next page link if any. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of ApiDefinitionCollection class. */ + public ApiDefinitionCollection() { + } + + /** + * Get the value property: Page items. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the count property: Total record count number across all pages. + * + * @return the count value. + */ + public Long count() { + return this.count; + } + + /** + * Set the count property: Total record count number across all pages. + * + * @param count the count value to set. + * @return the ApiDefinitionCollection object itself. + */ + public ApiDefinitionCollection withCount(Long count) { + this.count = count; + return this; + } + + /** + * Get the nextLink property: Next page link if any. + * + * @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/ApiDefinitionPropertiesSpecification.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiDefinitionPropertiesSpecification.java new file mode 100644 index 0000000000000..7b35d1eeef3a9 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiDefinitionPropertiesSpecification.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.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The ApiDefinitionPropertiesSpecification model. */ +@Fluent +public final class ApiDefinitionPropertiesSpecification { + /* + * The name property. + */ + @JsonProperty(value = "name") + private String name; + + /* + * The version property. + */ + @JsonProperty(value = "version") + private String version; + + /** Creates an instance of ApiDefinitionPropertiesSpecification class. */ + public ApiDefinitionPropertiesSpecification() { + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name property. + * + * @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: The version property. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Set the version property: The version property. + * + * @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..1a537825f8870 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiDefinitions.java @@ -0,0 +1,368 @@ +// 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 { + /** + * List API definitions + * + *

Returns a collection of API definitions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 collection as paginated response with {@link PagedIterable}. + */ + PagedIterable list( + String resourceGroupName, String serviceName, String workspaceName, String apiName, String versionName); + + /** + * List API definitions + * + *

Returns a collection of API definitions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 aPI version collection as paginated response with {@link PagedIterable}. + */ + PagedIterable list( + String resourceGroupName, + String serviceName, + String workspaceName, + String apiName, + String versionName, + String filter, + Context context); + + /** + * Get API definition + * + *

Returns details of the API definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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. + */ + Response getWithResponse( + String resourceGroupName, + String serviceName, + String workspaceName, + String apiName, + String versionName, + String definitionName, + Context context); + + /** + * Get API definition + * + *

Returns details of the API definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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. + */ + ApiDefinition get( + String resourceGroupName, + String serviceName, + String workspaceName, + String apiName, + String versionName, + String definitionName); + + /** + * Delete API definition + * + *

Deletes specified API definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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); + + /** + * Delete API definition + * + *

Deletes specified API definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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); + + /** + * Check API definition exists + * + *

Checks if specified API definition exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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); + + /** + * Check API definition exists + * + *

Checks if specified API definition exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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); + + /** + * Import API specification + * + *

Imports the API specification. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 payload The API specification source entity. + * @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 importSpecificationWithResponse( + String resourceGroupName, + String serviceName, + String workspaceName, + String apiName, + String versionName, + String definitionName, + ApiSpecImportRequest payload, + Context context); + + /** + * Import API specification + * + *

Imports the API specification. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 payload The API specification source entity. + * @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 payload); + + /** + * Export API specification + * + *

Exports the API specification. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 along with {@link Response}. + */ + Response exportSpecificationWithResponse( + String resourceGroupName, + String serviceName, + String workspaceName, + String apiName, + String versionName, + String definitionName, + Context context); + + /** + * Export API specification + * + *

Exports the API specification. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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); + + /** + * Get API definition + * + *

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. + */ + ApiDefinition getById(String id); + + /** + * Get API definition + * + *

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. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete API definition + * + *

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); + + /** + * Delete API definition + * + *

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..9233dc6b8f799 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiDefinitionsCreateOrUpdateHeaders.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.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..fb065ac33157c --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiDefinitionsCreateOrUpdateResponse.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.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..3c4622c39969d --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiDefinitionsGetHeaders.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.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..de82ecc724d02 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiDefinitionsGetResponse.java @@ -0,0 +1,41 @@ +// 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/ApiSpecExportResult.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiSpecExportResult.java new file mode 100644 index 0000000000000..7e5a24b83fc4f --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiSpecExportResult.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.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 property. + * + * @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..adec61f72071f --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiSpecExportResultFormat.java @@ -0,0 +1,47 @@ +// 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; + +/** Defines values for ApiSpecExportResultFormat. */ +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..64f68fa9d6620 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiSpecImportRequest.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.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; + + /* + * The specification property. + */ + @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: The specification property. + * + * @return the specification value. + */ + public ApiSpecImportRequestSpecification specification() { + return this.specification; + } + + /** + * Set the specification property: The specification property. + * + * @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..f98bc1e43bbf5 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiSpecImportRequestSpecification.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.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The ApiSpecImportRequestSpecification model. */ +@Fluent +public final class ApiSpecImportRequestSpecification { + /* + * The name property. + */ + @JsonProperty(value = "name") + private String name; + + /* + * The value property. + */ + @JsonProperty(value = "value") + private String value; + + /** Creates an instance of ApiSpecImportRequestSpecification class. */ + public ApiSpecImportRequestSpecification() { + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name property. + * + * @param name the name value to set. + * @return the ApiSpecImportRequestSpecification object itself. + */ + public ApiSpecImportRequestSpecification withName(String name) { + this.name = name; + return this; + } + + /** + * Get the value property: The value property. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Set the value property: The value property. + * + * @param value the value value to set. + * @return the ApiSpecImportRequestSpecification object itself. + */ + public ApiSpecImportRequestSpecification 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/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..32e192517156b --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiSpecImportSourceFormat.java @@ -0,0 +1,47 @@ +// 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; + +/** Format of the API specification source. */ +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/ApiType.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiType.java new file mode 100644 index 0000000000000..b8cd0f0fac79c --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiType.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; + +/** + * API type + * + *

Kind of API. For example, REST or GraphQL. + */ +public final class ApiType extends ExpandableStringEnum { + /** Static value rest for ApiType. */ + public static final ApiType REST = fromString("rest"); + + /** Static value graphql for ApiType. */ + public static final ApiType GRAPHQL = fromString("graphql"); + + /** Static value grpc for ApiType. */ + public static final ApiType GRPC = fromString("grpc"); + + /** Static value soap for ApiType. */ + public static final ApiType SOAP = fromString("soap"); + + /** Static value webhook for ApiType. */ + public static final ApiType WEBHOOK = fromString("webhook"); + + /** Static value websocket for ApiType. */ + public static final ApiType WEBSOCKET = fromString("websocket"); + + /** + * Creates a new instance of ApiType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ApiType() { + } + + /** + * Creates or finds a ApiType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ApiType. + */ + @JsonCreator + public static ApiType fromString(String name) { + return fromString(name, ApiType.class); + } + + /** + * Gets known ApiType values. + * + * @return known ApiType values. + */ + public static Collection values() { + return values(ApiType.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..b0cf966234058 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiVersion.java @@ -0,0 +1,203 @@ +// 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 systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the title property: API version. + * + * @return the title value. + */ + String title(); + + /** + * Gets the lifecycleStage property: Current lifecycle stage of the API. + * + * @return the lifecycleStage value. + */ + LifecycleStage lifecycleStage(); + + /** + * 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 Service name. + * @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.WithTitle, DefinitionStages.WithLifecycleStage { + /** + * 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 title. */ + interface WithTitle { + /** + * Specifies the title property: API version.. + * + * @param title API version. + * @return the next definition stage. + */ + WithCreate withTitle(String title); + } + + /** The stage of the ApiVersion definition allowing to specify lifecycleStage. */ + interface WithLifecycleStage { + /** + * Specifies the lifecycleStage property: Current lifecycle stage of the API.. + * + * @param lifecycleStage Current lifecycle stage of the API. + * @return the next definition stage. + */ + WithCreate withLifecycleStage(LifecycleStage lifecycleStage); + } + } + + /** + * Begins update for the ApiVersion resource. + * + * @return the stage of resource update. + */ + ApiVersion.Update update(); + + /** The template for ApiVersion update. */ + interface Update extends UpdateStages.WithTitle, UpdateStages.WithLifecycleStage { + /** + * 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 { + /** The stage of the ApiVersion update allowing to specify title. */ + interface WithTitle { + /** + * Specifies the title property: API version.. + * + * @param title API version. + * @return the next definition stage. + */ + Update withTitle(String title); + } + + /** The stage of the ApiVersion update allowing to specify lifecycleStage. */ + interface WithLifecycleStage { + /** + * Specifies the lifecycleStage property: Current lifecycle stage of the API.. + * + * @param lifecycleStage Current lifecycle stage of the API. + * @return the next definition stage. + */ + Update withLifecycleStage(LifecycleStage lifecycleStage); + } + } + + /** + * 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/ApiVersionCollection.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiVersionCollection.java new file mode 100644 index 0000000000000..494308bfa79c5 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiVersionCollection.java @@ -0,0 +1,89 @@ +// 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.resourcemanager.apicenter.fluent.models.ApiVersionInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * API version collection + * + *

Paginated collection of API versions. + */ +@Fluent +public final class ApiVersionCollection { + /* + * Page items. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Total record count number across all pages. + */ + @JsonProperty(value = "count") + private Long count; + + /* + * Next page link if any. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of ApiVersionCollection class. */ + public ApiVersionCollection() { + } + + /** + * Get the value property: Page items. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the count property: Total record count number across all pages. + * + * @return the count value. + */ + public Long count() { + return this.count; + } + + /** + * Set the count property: Total record count number across all pages. + * + * @param count the count value to set. + * @return the ApiVersionCollection object itself. + */ + public ApiVersionCollection withCount(Long count) { + this.count = count; + return this; + } + + /** + * Get the nextLink property: Next page link if any. + * + * @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/ApiVersions.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiVersions.java new file mode 100644 index 0000000000000..36bb0ebae75a2 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiVersions.java @@ -0,0 +1,235 @@ +// 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 { + /** + * List API versions + * + *

Returns a collection of API versions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 version collection as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String serviceName, String workspaceName, String apiName); + + /** + * List API versions + * + *

Returns a collection of API versions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 aPI version collection as paginated response with {@link PagedIterable}. + */ + PagedIterable list( + String resourceGroupName, + String serviceName, + String workspaceName, + String apiName, + String filter, + Context context); + + /** + * Get API version + * + *

Returns details of the API version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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. + */ + Response getWithResponse( + String resourceGroupName, + String serviceName, + String workspaceName, + String apiName, + String versionName, + Context context); + + /** + * Get API version + * + *

Returns details of the API version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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. + */ + ApiVersion get( + String resourceGroupName, String serviceName, String workspaceName, String apiName, String versionName); + + /** + * Delete API version + * + *

Deletes specified API version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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); + + /** + * Delete API version + * + *

Deletes specified API version. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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); + + /** + * Check API version exists + * + *

Checks if specified API version exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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); + + /** + * Check API version exists + * + *

Checks if specified API version exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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); + + /** + * Get API version + * + *

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. + */ + ApiVersion getById(String id); + + /** + * Get API version + * + *

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. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete API version + * + *

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); + + /** + * Delete API version + * + *

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..7e2c9c40d58fc --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiVersionsCreateOrUpdateHeaders.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.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..3c13c9f247679 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiVersionsCreateOrUpdateResponse.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.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..c18165561e31c --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiVersionsGetHeaders.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.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..47f3e2900bc22 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApiVersionsGetResponse.java @@ -0,0 +1,41 @@ +// 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..50fa734f892d1 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/Apis.java @@ -0,0 +1,206 @@ +// 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 { + /** + * List APIs + * + *

Returns a collection of APIs. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 aPI collection as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String serviceName, String workspaceName); + + /** + * List APIs + * + *

Returns a collection of APIs. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 aPI collection as paginated response with {@link PagedIterable}. + */ + PagedIterable list( + String resourceGroupName, String serviceName, String workspaceName, String filter, Context context); + + /** + * Get API + * + *

Returns details of the API. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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. + */ + Response getWithResponse( + String resourceGroupName, String serviceName, String workspaceName, String apiName, Context context); + + /** + * Get API + * + *

Returns details of the API. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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. + */ + Api get(String resourceGroupName, String serviceName, String workspaceName, String apiName); + + /** + * Delete API + * + *

Deletes specified API. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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); + + /** + * Delete API + * + *

Deletes specified API. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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); + + /** + * Check if API exists + * + *

Checks if specified API exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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); + + /** + * Check if API exists + * + *

Checks if specified API exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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); + + /** + * Get API + * + *

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. + */ + Api getById(String id); + + /** + * Get API + * + *

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. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete API + * + *

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); + + /** + * Delete API + * + *

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..da9aa1cad7fb8 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApisCreateOrUpdateHeaders.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.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..a826140f00500 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApisCreateOrUpdateResponse.java @@ -0,0 +1,41 @@ +// 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..023e4ccca5af2 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApisGetHeaders.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.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..a4133421a5e32 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ApisGetResponse.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.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..9e32ce52127dc --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/Contact.java @@ -0,0 +1,120 @@ +// 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 Contact model. */ +@Fluent +public final class Contact { + /* + * Name + * + * Name of the contact. + */ + @JsonProperty(value = "name") + private String name; + + /* + * URL + * + * URL for the contact. + */ + @JsonProperty(value = "url") + private String url; + + /* + * Email address + * + * Email address of the contact. + */ + @JsonProperty(value = "email") + private String email; + + /** Creates an instance of Contact class. */ + public Contact() { + } + + /** + * Get the name property: Name + * + *

Name of the contact. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name + * + *

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 + * + *

URL for the contact. + * + * @return the url value. + */ + public String url() { + return this.url; + } + + /** + * Set the url property: URL + * + *

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 + * + *

Email address of the contact. + * + * @return the email value. + */ + public String email() { + return this.email; + } + + /** + * Set the email property: Email address + * + *

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..494bc2d308f84 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/Deployment.java @@ -0,0 +1,378 @@ +// 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 systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the title property: Title. + * + * @return the title value. + */ + String title(); + + /** + * Gets the description property: Description + * + *

Description of the deployment. + * + * @return the description value. + */ + String description(); + + /** + * Gets the environmentId property: API center-scoped environment resource ID. + * + * @return the environmentId value. + */ + String environmentId(); + + /** + * Gets the definitionId property: API center-scoped definition resource ID. + * + * @return the definitionId value. + */ + String definitionId(); + + /** + * Gets the state property: State + * + *

State of API deployment. + * + * @return the state value. + */ + DeploymentState state(); + + /** + * Gets the server property: Server. + * + * @return the server value. + */ + DeploymentServer server(); + + /** + * Gets the customProperties property: The custom metadata defined for API catalog entities. + * + * @return the customProperties value. + */ + Object customProperties(); + + /** + * 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 Service name. + * @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.WithTitle, + DefinitionStages.WithDescription, + DefinitionStages.WithEnvironmentId, + DefinitionStages.WithDefinitionId, + DefinitionStages.WithState, + DefinitionStages.WithServer, + DefinitionStages.WithCustomProperties { + /** + * 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 title. */ + interface WithTitle { + /** + * Specifies the title property: Title. + * + * @param title Title. + * @return the next definition stage. + */ + WithCreate withTitle(String title); + } + + /** The stage of the Deployment definition allowing to specify description. */ + interface WithDescription { + /** + * Specifies the description property: Description + * + *

Description of the deployment.. + * + * @param description Description + *

Description of the deployment. + * @return the next definition stage. + */ + WithCreate withDescription(String description); + } + + /** The stage of the Deployment definition allowing to specify environmentId. */ + interface WithEnvironmentId { + /** + * Specifies the environmentId property: API center-scoped environment resource ID.. + * + * @param environmentId API center-scoped environment resource ID. + * @return the next definition stage. + */ + WithCreate withEnvironmentId(String environmentId); + } + + /** The stage of the Deployment definition allowing to specify definitionId. */ + interface WithDefinitionId { + /** + * Specifies the definitionId property: API center-scoped definition resource ID.. + * + * @param definitionId API center-scoped definition resource ID. + * @return the next definition stage. + */ + WithCreate withDefinitionId(String definitionId); + } + + /** The stage of the Deployment definition allowing to specify state. */ + interface WithState { + /** + * Specifies the state property: State + * + *

State of API deployment.. + * + * @param state State + *

State of API deployment. + * @return the next definition stage. + */ + WithCreate withState(DeploymentState state); + } + + /** The stage of the Deployment definition allowing to specify server. */ + interface WithServer { + /** + * Specifies the server property: Server. + * + * @param server Server. + * @return the next definition stage. + */ + WithCreate withServer(DeploymentServer server); + } + + /** The stage of the Deployment definition allowing to specify customProperties. */ + interface WithCustomProperties { + /** + * Specifies the customProperties property: The custom metadata defined for API catalog entities.. + * + * @param customProperties The custom metadata defined for API catalog entities. + * @return the next definition stage. + */ + WithCreate withCustomProperties(Object customProperties); + } + } + + /** + * Begins update for the Deployment resource. + * + * @return the stage of resource update. + */ + Deployment.Update update(); + + /** The template for Deployment update. */ + interface Update + extends UpdateStages.WithTitle, + UpdateStages.WithDescription, + UpdateStages.WithEnvironmentId, + UpdateStages.WithDefinitionId, + UpdateStages.WithState, + UpdateStages.WithServer, + UpdateStages.WithCustomProperties { + /** + * 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 { + /** The stage of the Deployment update allowing to specify title. */ + interface WithTitle { + /** + * Specifies the title property: Title. + * + * @param title Title. + * @return the next definition stage. + */ + Update withTitle(String title); + } + + /** The stage of the Deployment update allowing to specify description. */ + interface WithDescription { + /** + * Specifies the description property: Description + * + *

Description of the deployment.. + * + * @param description Description + *

Description of the deployment. + * @return the next definition stage. + */ + Update withDescription(String description); + } + + /** The stage of the Deployment update allowing to specify environmentId. */ + interface WithEnvironmentId { + /** + * Specifies the environmentId property: API center-scoped environment resource ID.. + * + * @param environmentId API center-scoped environment resource ID. + * @return the next definition stage. + */ + Update withEnvironmentId(String environmentId); + } + + /** The stage of the Deployment update allowing to specify definitionId. */ + interface WithDefinitionId { + /** + * Specifies the definitionId property: API center-scoped definition resource ID.. + * + * @param definitionId API center-scoped definition resource ID. + * @return the next definition stage. + */ + Update withDefinitionId(String definitionId); + } + + /** The stage of the Deployment update allowing to specify state. */ + interface WithState { + /** + * Specifies the state property: State + * + *

State of API deployment.. + * + * @param state State + *

State of API deployment. + * @return the next definition stage. + */ + Update withState(DeploymentState state); + } + + /** The stage of the Deployment update allowing to specify server. */ + interface WithServer { + /** + * Specifies the server property: Server. + * + * @param server Server. + * @return the next definition stage. + */ + Update withServer(DeploymentServer server); + } + + /** The stage of the Deployment update allowing to specify customProperties. */ + interface WithCustomProperties { + /** + * Specifies the customProperties property: The custom metadata defined for API catalog entities.. + * + * @param customProperties The custom metadata defined for API catalog entities. + * @return the next definition stage. + */ + Update withCustomProperties(Object customProperties); + } + } + + /** + * 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/DeploymentCollection.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/DeploymentCollection.java new file mode 100644 index 0000000000000..32d9f29a9eafa --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/DeploymentCollection.java @@ -0,0 +1,89 @@ +// 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.resourcemanager.apicenter.fluent.models.DeploymentInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * API deployment collection + * + *

Paginated collection of API deployments. + */ +@Fluent +public final class DeploymentCollection { + /* + * Page items. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Total record count number across all pages. + */ + @JsonProperty(value = "count") + private Long count; + + /* + * Next page link if any. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of DeploymentCollection class. */ + public DeploymentCollection() { + } + + /** + * Get the value property: Page items. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the count property: Total record count number across all pages. + * + * @return the count value. + */ + public Long count() { + return this.count; + } + + /** + * Set the count property: Total record count number across all pages. + * + * @param count the count value to set. + * @return the DeploymentCollection object itself. + */ + public DeploymentCollection withCount(Long count) { + this.count = count; + return this; + } + + /** + * Get the nextLink property: Next page link if any. + * + * @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/DeploymentServer.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/DeploymentServer.java new file mode 100644 index 0000000000000..6dde9e2a66d90 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/DeploymentServer.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.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Server. */ +@Fluent +public final class DeploymentServer { + /* + * Server runtime base URI + * + * Base runtime URLs for this deployment. + */ + @JsonProperty(value = "runtimeUri") + private List runtimeUri; + + /** Creates an instance of DeploymentServer class. */ + public DeploymentServer() { + } + + /** + * Get the runtimeUri property: Server runtime base URI + * + *

Base runtime URLs for this deployment. + * + * @return the runtimeUri value. + */ + public List runtimeUri() { + return this.runtimeUri; + } + + /** + * Set the runtimeUri property: Server runtime base URI + * + *

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..439ee365e80bd --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/DeploymentState.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.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * State + * + *

State of API 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..595088ca71c5b --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/Deployments.java @@ -0,0 +1,237 @@ +// 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 { + /** + * List deployments + * + *

Returns a collection of API deployments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 deployment collection as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String serviceName, String workspaceName, String apiName); + + /** + * List deployments + * + *

Returns a collection of API deployments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 aPI deployment collection as paginated response with {@link PagedIterable}. + */ + PagedIterable list( + String resourceGroupName, + String serviceName, + String workspaceName, + String apiName, + String filter, + Context context); + + /** + * Delete API deployment + * + *

Deletes API deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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); + + /** + * Delete API deployment + * + *

Deletes API deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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); + + /** + * Get API deployment + * + *

Returns details of the API deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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. + */ + Response getWithResponse( + String resourceGroupName, + String serviceName, + String workspaceName, + String apiName, + String deploymentName, + Context context); + + /** + * Get API deployment + * + *

Returns details of the API deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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. + */ + Deployment get( + String resourceGroupName, String serviceName, String workspaceName, String apiName, String deploymentName); + + /** + * Check if API deployment exists + * + *

Checks if specified API deployment exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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); + + /** + * Check if API deployment exists + * + *

Checks if specified API deployment exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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); + + /** + * Get API deployment + * + *

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. + */ + Deployment getById(String id); + + /** + * Get API deployment + * + *

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. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete API deployment + * + *

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); + + /** + * Delete API deployment + * + *

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..0dd2c78bce72e --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/DeploymentsCreateOrUpdateHeaders.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.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..9bc9842b1ab24 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/DeploymentsCreateOrUpdateResponse.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.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..c376964fac549 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/DeploymentsGetHeaders.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.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..106988fdabdd7 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/DeploymentsGetResponse.java @@ -0,0 +1,41 @@ +// 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..7ad4c82cdbbb4 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/Environment.java @@ -0,0 +1,337 @@ +// 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 systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the title property: Title. + * + * @return the title value. + */ + String title(); + + /** + * Gets the description property: Description. + * + * @return the description value. + */ + String description(); + + /** + * Gets the typePropertiesType property: Environment type. + * + * @return the typePropertiesType value. + */ + EnvironmentType typePropertiesType(); + + /** + * Gets the server property: Server + * + *

Server information of the environment. + * + * @return the server value. + */ + EnvironmentServer server(); + + /** + * Gets the onboarding property: The onboarding property. + * + * @return the onboarding value. + */ + Onboarding onboarding(); + + /** + * Gets the customProperties property: The custom metadata defined for API catalog entities. + * + * @return the customProperties value. + */ + Object customProperties(); + + /** + * 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 Service name. + * @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.WithTitle, + DefinitionStages.WithDescription, + DefinitionStages.WithTypePropertiesType, + DefinitionStages.WithServer, + DefinitionStages.WithOnboarding, + DefinitionStages.WithCustomProperties { + /** + * 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 title. */ + interface WithTitle { + /** + * Specifies the title property: Title. + * + * @param title Title. + * @return the next definition stage. + */ + WithCreate withTitle(String title); + } + + /** The stage of the Environment definition allowing to specify description. */ + interface WithDescription { + /** + * Specifies the description property: Description.. + * + * @param description Description. + * @return the next definition stage. + */ + WithCreate withDescription(String description); + } + + /** The stage of the Environment definition allowing to specify typePropertiesType. */ + interface WithTypePropertiesType { + /** + * Specifies the typePropertiesType property: Environment type.. + * + * @param typePropertiesType Environment type. + * @return the next definition stage. + */ + WithCreate withTypePropertiesType(EnvironmentType typePropertiesType); + } + + /** The stage of the Environment definition allowing to specify server. */ + interface WithServer { + /** + * Specifies the server property: Server + * + *

Server information of the environment.. + * + * @param server Server + *

Server information of the environment. + * @return the next definition stage. + */ + WithCreate withServer(EnvironmentServer server); + } + + /** The stage of the Environment definition allowing to specify onboarding. */ + interface WithOnboarding { + /** + * Specifies the onboarding property: The onboarding property.. + * + * @param onboarding The onboarding property. + * @return the next definition stage. + */ + WithCreate withOnboarding(Onboarding onboarding); + } + + /** The stage of the Environment definition allowing to specify customProperties. */ + interface WithCustomProperties { + /** + * Specifies the customProperties property: The custom metadata defined for API catalog entities.. + * + * @param customProperties The custom metadata defined for API catalog entities. + * @return the next definition stage. + */ + WithCreate withCustomProperties(Object customProperties); + } + } + + /** + * Begins update for the Environment resource. + * + * @return the stage of resource update. + */ + Environment.Update update(); + + /** The template for Environment update. */ + interface Update + extends UpdateStages.WithTitle, + UpdateStages.WithDescription, + UpdateStages.WithTypePropertiesType, + UpdateStages.WithServer, + UpdateStages.WithOnboarding, + UpdateStages.WithCustomProperties { + /** + * 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 { + /** The stage of the Environment update allowing to specify title. */ + interface WithTitle { + /** + * Specifies the title property: Title. + * + * @param title Title. + * @return the next definition stage. + */ + Update withTitle(String title); + } + + /** The stage of the Environment update allowing to specify description. */ + interface WithDescription { + /** + * Specifies the description property: Description.. + * + * @param description Description. + * @return the next definition stage. + */ + Update withDescription(String description); + } + + /** The stage of the Environment update allowing to specify typePropertiesType. */ + interface WithTypePropertiesType { + /** + * Specifies the typePropertiesType property: Environment type.. + * + * @param typePropertiesType Environment type. + * @return the next definition stage. + */ + Update withTypePropertiesType(EnvironmentType typePropertiesType); + } + + /** The stage of the Environment update allowing to specify server. */ + interface WithServer { + /** + * Specifies the server property: Server + * + *

Server information of the environment.. + * + * @param server Server + *

Server information of the environment. + * @return the next definition stage. + */ + Update withServer(EnvironmentServer server); + } + + /** The stage of the Environment update allowing to specify onboarding. */ + interface WithOnboarding { + /** + * Specifies the onboarding property: The onboarding property.. + * + * @param onboarding The onboarding property. + * @return the next definition stage. + */ + Update withOnboarding(Onboarding onboarding); + } + + /** The stage of the Environment update allowing to specify customProperties. */ + interface WithCustomProperties { + /** + * Specifies the customProperties property: The custom metadata defined for API catalog entities.. + * + * @param customProperties The custom metadata defined for API catalog entities. + * @return the next definition stage. + */ + Update withCustomProperties(Object customProperties); + } + } + + /** + * 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/EnvironmentCollection.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/EnvironmentCollection.java new file mode 100644 index 0000000000000..2383bd33ac493 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/EnvironmentCollection.java @@ -0,0 +1,89 @@ +// 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.resourcemanager.apicenter.fluent.models.EnvironmentInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * Environments collection + * + *

Paginated collection of environments. + */ +@Fluent +public final class EnvironmentCollection { + /* + * Page items. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Total record count number across all pages. + */ + @JsonProperty(value = "count") + private Long count; + + /* + * Next page link if any. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of EnvironmentCollection class. */ + public EnvironmentCollection() { + } + + /** + * Get the value property: Page items. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the count property: Total record count number across all pages. + * + * @return the count value. + */ + public Long count() { + return this.count; + } + + /** + * Set the count property: Total record count number across all pages. + * + * @param count the count value to set. + * @return the EnvironmentCollection object itself. + */ + public EnvironmentCollection withCount(Long count) { + this.count = count; + return this; + } + + /** + * Get the nextLink property: Next page link if any. + * + * @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/EnvironmentServer.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/EnvironmentServer.java new file mode 100644 index 0000000000000..1ade4dc766176 --- /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 + * + *

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 managementPortalUri property. + */ + @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 managementPortalUri property. + * + * @return the managementPortalUri value. + */ + public List managementPortalUri() { + return this.managementPortalUri; + } + + /** + * Set the managementPortalUri property: The managementPortalUri property. + * + * @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..0a5a84258a2ff --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/EnvironmentServerType.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.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Type of the server that represents the environment. */ +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/EnvironmentType.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/EnvironmentType.java new file mode 100644 index 0000000000000..d7b4b58aaaf98 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/EnvironmentType.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; + +/** Environment type. */ +public final class EnvironmentType extends ExpandableStringEnum { + /** Static value development for EnvironmentType. */ + public static final EnvironmentType DEVELOPMENT = fromString("development"); + + /** Static value testing for EnvironmentType. */ + public static final EnvironmentType TESTING = fromString("testing"); + + /** Static value staging for EnvironmentType. */ + public static final EnvironmentType STAGING = fromString("staging"); + + /** Static value production for EnvironmentType. */ + public static final EnvironmentType PRODUCTION = fromString("production"); + + /** + * Creates a new instance of EnvironmentType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public EnvironmentType() { + } + + /** + * Creates or finds a EnvironmentType from its string representation. + * + * @param name a name to look for. + * @return the corresponding EnvironmentType. + */ + @JsonCreator + public static EnvironmentType fromString(String name) { + return fromString(name, EnvironmentType.class); + } + + /** + * Gets known EnvironmentType values. + * + * @return known EnvironmentType values. + */ + public static Collection values() { + return values(EnvironmentType.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..757ed606f2fc4 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/Environments.java @@ -0,0 +1,206 @@ +// 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 { + /** + * List environments + * + *

Returns a collection of environments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 environments collection as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String serviceName, String workspaceName); + + /** + * List environments + * + *

Returns a collection of environments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 environments collection as paginated response with {@link PagedIterable}. + */ + PagedIterable list( + String resourceGroupName, String serviceName, String workspaceName, String filter, Context context); + + /** + * Delete environment + * + *

Deletes the environment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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); + + /** + * Delete environment + * + *

Deletes the environment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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); + + /** + * Check if environment exists + * + *

Checks if specified environment exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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); + + /** + * Check if environment exists + * + *

Checks if specified environment exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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); + + /** + * Get environment + * + *

Returns details of the environment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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. + */ + Response getWithResponse( + String resourceGroupName, String serviceName, String workspaceName, String environmentName, Context context); + + /** + * Get environment + * + *

Returns details of the environment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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. + */ + Environment get(String resourceGroupName, String serviceName, String workspaceName, String environmentName); + + /** + * Get environment + * + *

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. + */ + Environment getById(String id); + + /** + * Get environment + * + *

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. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete environment + * + *

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); + + /** + * Delete environment + * + *

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..6e9178ae14f8a --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/EnvironmentsCreateOrUpdateHeaders.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.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..5a7cb36fea689 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/EnvironmentsCreateOrUpdateResponse.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.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..64668964680cc --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/EnvironmentsGetHeaders.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.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..29febbf9f0538 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/EnvironmentsGetResponse.java @@ -0,0 +1,41 @@ +// 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..db8ef0cbe1917 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/ExternalDocumentation.java @@ -0,0 +1,132 @@ +// 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; + +/** + * External documentation + * + *

Additional, external documentation for the API. + */ +@Fluent +public final class ExternalDocumentation { + /* + * Title + * + * Title of the documentation. + */ + @JsonProperty(value = "title") + private String title; + + /* + * Description + * + * Description of the documentation. + */ + @JsonProperty(value = "description") + private String description; + + /* + * URL + * + * 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 + * + *

Title of the documentation. + * + * @return the title value. + */ + public String title() { + return this.title; + } + + /** + * Set the title property: Title + * + *

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 + * + *

Description of the documentation. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Description + * + *

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 + * + *

URL pointing to the documentation. + * + * @return the url value. + */ + public String url() { + return this.url; + } + + /** + * Set the url property: URL + * + *

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..4b9603dd980ff --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/License.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.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * License + * + *

The license information for the API. + */ +@Fluent +public final class License { + /* + * Name + * + * Name of the license. + */ + @JsonProperty(value = "name") + private String name; + + /* + * URL + * + * URL pointing to the license details. The URL field is mutually exclusive of the identifier field. + */ + @JsonProperty(value = "url") + private String url; + + /* + * Identifier + * + * 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 + * + *

Name of the license. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name + * + *

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 + * + *

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 + * + *

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: Identifier + * + *

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: Identifier + * + *

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..29afc6842d1a6 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/LifecycleStage.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.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Current lifecycle stage of the API. */ +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/MetadataAssignment.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/MetadataAssignment.java new file mode 100644 index 0000000000000..ba65bd65d2d42 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/MetadataAssignment.java @@ -0,0 +1,102 @@ +// 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 MetadataAssignment model. */ +@Fluent +public final class MetadataAssignment { + /* + * The entities this metadata schema component gets applied to. + */ + @JsonProperty(value = "entity") + private MetadataAssignmentEntity entity; + + /* + * The required property. + */ + @JsonProperty(value = "required") + private Boolean required; + + /* + * The deprecated property. + */ + @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: The required property. + * + * @return the required value. + */ + public Boolean required() { + return this.required; + } + + /** + * Set the required property: The required property. + * + * @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: The deprecated property. + * + * @return the deprecated value. + */ + public Boolean deprecated() { + return this.deprecated; + } + + /** + * Set the deprecated property: The deprecated property. + * + * @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..639b2f7e2eb82 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/MetadataAssignmentEntity.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.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** An entity the metadata schema is requested for. */ +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..2c9ecc21fd24f --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/MetadataSchema.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.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.apicenter.fluent.models.MetadataSchemaInner; +import java.util.List; + +/** 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 systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the schema property: YAML schema defining the type. + * + * @return the schema value. + */ + String schema(); + + /** + * Gets the assignedTo property: The assignedTo property. + * + * @return the assignedTo value. + */ + List assignedTo(); + + /** + * 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 Service name. + * @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.WithSchema, DefinitionStages.WithAssignedTo { + /** + * 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 schema. */ + interface WithSchema { + /** + * Specifies the schema property: YAML schema defining the type.. + * + * @param schema YAML schema defining the type. + * @return the next definition stage. + */ + WithCreate withSchema(String schema); + } + + /** The stage of the MetadataSchema definition allowing to specify assignedTo. */ + interface WithAssignedTo { + /** + * Specifies the assignedTo property: The assignedTo property.. + * + * @param assignedTo The assignedTo property. + * @return the next definition stage. + */ + WithCreate withAssignedTo(List assignedTo); + } + } + + /** + * Begins update for the MetadataSchema resource. + * + * @return the stage of resource update. + */ + MetadataSchema.Update update(); + + /** The template for MetadataSchema update. */ + interface Update extends UpdateStages.WithSchema, UpdateStages.WithAssignedTo { + /** + * 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 { + /** The stage of the MetadataSchema update allowing to specify schema. */ + interface WithSchema { + /** + * Specifies the schema property: YAML schema defining the type.. + * + * @param schema YAML schema defining the type. + * @return the next definition stage. + */ + Update withSchema(String schema); + } + + /** The stage of the MetadataSchema update allowing to specify assignedTo. */ + interface WithAssignedTo { + /** + * Specifies the assignedTo property: The assignedTo property.. + * + * @param assignedTo The assignedTo property. + * @return the next definition stage. + */ + Update withAssignedTo(List assignedTo); + } + } + + /** + * 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/MetadataSchemaCollection.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/MetadataSchemaCollection.java new file mode 100644 index 0000000000000..624446fa8c940 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/MetadataSchemaCollection.java @@ -0,0 +1,89 @@ +// 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.resourcemanager.apicenter.fluent.models.MetadataSchemaInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * Metadata schema collection + * + *

Paginated collection of metadata schemas. + */ +@Fluent +public final class MetadataSchemaCollection { + /* + * Page items. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Total record count number across all pages. + */ + @JsonProperty(value = "count") + private Long count; + + /* + * Next page link if any. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of MetadataSchemaCollection class. */ + public MetadataSchemaCollection() { + } + + /** + * Get the value property: Page items. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the count property: Total record count number across all pages. + * + * @return the count value. + */ + public Long count() { + return this.count; + } + + /** + * Set the count property: Total record count number across all pages. + * + * @param count the count value to set. + * @return the MetadataSchemaCollection object itself. + */ + public MetadataSchemaCollection withCount(Long count) { + this.count = count; + return this; + } + + /** + * Get the nextLink property: Next page link if any. + * + * @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/MetadataSchemaExportFormat.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/MetadataSchemaExportFormat.java new file mode 100644 index 0000000000000..5f577bd6ee7b0 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/MetadataSchemaExportFormat.java @@ -0,0 +1,47 @@ +// 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; + +/** Defines values for MetadataSchemaExportFormat. */ +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..4056298ef58ce --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/MetadataSchemaExportRequest.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.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..9deb3f201c6ff --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/MetadataSchemaExportResult.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.models; + +import com.azure.resourcemanager.apicenter.fluent.models.MetadataSchemaExportResultInner; + +/** An immutable client-side representation of MetadataSchemaExportResult. */ +public interface MetadataSchemaExportResult { + /** + * Gets the format property: The format property. + * + * @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/MetadataSchemas.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/MetadataSchemas.java new file mode 100644 index 0000000000000..e8c201008d132 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/MetadataSchemas.java @@ -0,0 +1,197 @@ +// 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 { + /** + * List metadata schemas + * + *

Returns a collection of metadata schemas. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 collection as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String serviceName); + + /** + * List metadata schemas + * + *

Returns a collection of metadata schemas. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 metadata schema collection as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String serviceName, String filter, Context context); + + /** + * Get metadata schema + * + *

Returns details of the metadata schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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. + */ + Response getWithResponse( + String resourceGroupName, String serviceName, String metadataSchemaName, Context context); + + /** + * Get metadata schema + * + *

Returns details of the metadata schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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. + */ + MetadataSchema get(String resourceGroupName, String serviceName, String metadataSchemaName); + + /** + * Delete metadata schema + * + *

Deletes specified metadata schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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); + + /** + * Delete metadata schema + * + *

Deletes specified metadata schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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); + + /** + * Check metadata schema exists + * + *

Checks if specified metadata schema exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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); + + /** + * Check metadata schema exists + * + *

Checks if specified metadata schema exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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); + + /** + * Get metadata schema + * + *

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. + */ + MetadataSchema getById(String id); + + /** + * Get metadata schema + * + *

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. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete metadata schema + * + *

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); + + /** + * Delete metadata schema + * + *

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..d01c92fef829a --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/MetadataSchemasCreateOrUpdateHeaders.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.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..8c34e278097e4 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/MetadataSchemasCreateOrUpdateResponse.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.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..5ba1c49d6e596 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/MetadataSchemasGetHeaders.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.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..e43d8c2e3a5a0 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/MetadataSchemasGetResponse.java @@ -0,0 +1,41 @@ +// 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..e58b3d9ffadd5 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/Onboarding.java @@ -0,0 +1,77 @@ +// 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; + +/** The Onboarding model. */ +@Fluent +public final class Onboarding { + /* + * Onboarding guide. + */ + @JsonProperty(value = "instructions") + private String instructions; + + /* + * The developerPortalUri property. + */ + @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 developerPortalUri property. + * + * @return the developerPortalUri value. + */ + public List developerPortalUri() { + return this.developerPortalUri; + } + + /** + * Set the developerPortalUri property: The developerPortalUri property. + * + * @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/Operations.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/Operations.java index 049d2761d2226..3d852afbe2d3c 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 @@ -10,7 +10,9 @@ /** Resource collection API of Operations. */ public interface Operations { /** - * List the operations for the provider. + * List resource provider operations + * + *

Returns a collection of resource provider operations. * * @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. @@ -20,7 +22,9 @@ public interface Operations { PagedIterable list(); /** - * List the operations for the provider. + * List resource provider operations + * + *

Returns a collection of resource provider operations. * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. 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..0fc35cf2c84d3 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 @@ -4,6 +4,7 @@ package com.azure.resourcemanager.apicenter.models; +import com.azure.core.http.rest.Response; import com.azure.core.management.Region; import com.azure.core.management.SystemData; import com.azure.core.util.Context; @@ -48,7 +49,7 @@ public interface Service { Map tags(); /** - * Gets the identity property: The identity of the service. + * Gets the identity property: Managed service identity (system assigned and/or user assigned identities). * * @return the identity value. */ @@ -62,7 +63,7 @@ public interface Service { SystemData systemData(); /** - * Gets the provisioningState property: The status of the last operation. + * Gets the provisioningState property: Provisioning state of the service. * * @return the provisioningState value. */ @@ -175,9 +176,10 @@ interface WithTags { /** The stage of the Service definition allowing to specify identity. */ interface WithIdentity { /** - * Specifies the identity property: The identity of the service.. + * Specifies the identity property: Managed service identity (system assigned and/or user assigned + * identities). * - * @param identity The identity of the service. + * @param identity Managed service identity (system assigned and/or user assigned identities). * @return the next definition stage. */ WithCreate withIdentity(ManagedServiceIdentity identity); @@ -227,4 +229,32 @@ interface UpdateStages { * @return the refreshed resource. */ Service refresh(Context context); + + /** + * Export effective metadata schema + * + *

Exports the effective metadata schema. + * + * @param payload The metadata schema request details. + * @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 along with {@link Response}. + */ + Response exportMetadataSchemaWithResponse( + MetadataSchemaExportRequest payload, Context context); + + /** + * Export effective metadata schema + * + *

Exports the effective metadata schema. + * + * @param payload The metadata schema request details. + * @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 payload); } 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..718cffc6acb3f 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 @@ -31,7 +31,7 @@ private ServiceProperties innerProperties() { } /** - * Get the provisioningState property: The status of the last operation. + * Get the provisioningState property: Provisioning state of the service. * * @return the provisioningState value. */ 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..790a77c3cc763 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 @@ -31,7 +31,7 @@ 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. @@ -42,7 +42,7 @@ 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. @@ -54,7 +54,9 @@ public interface Services { PagedIterable listByResourceGroup(String resourceGroupName, Context context); /** - * Get service. + * Get service + * + *

Returns details of the service. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serviceName Service name. @@ -62,24 +64,28 @@ public interface Services { * @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. + * Get service + * + *

Returns details of the service. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serviceName Service name. * @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. + * Delete service + * + *

Deletes specified service. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serviceName Service name. @@ -92,7 +98,9 @@ public interface Services { Response deleteByResourceGroupWithResponse(String resourceGroupName, String serviceName, Context context); /** - * Delete service. + * Delete service + * + *

Deletes specified service. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serviceName Service name. @@ -103,30 +111,69 @@ public interface Services { void deleteByResourceGroup(String resourceGroupName, String serviceName); /** - * Get service. + * Export effective metadata schema + * + *

Exports the effective metadata schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @param payload The metadata schema request details. + * @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 along with {@link Response}. + */ + Response exportMetadataSchemaWithResponse( + String resourceGroupName, String serviceName, MetadataSchemaExportRequest payload, Context context); + + /** + * Export effective metadata schema + * + *

Exports the effective metadata schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @param payload The metadata schema request details. + * @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 payload); + + /** + * Get service + * + *

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. + * 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. + * Delete service + * + *

Deletes specified service. * * @param id the resource ID. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -136,7 +183,9 @@ public interface Services { void deleteById(String id); /** - * Delete service. + * Delete service + * + *

Deletes specified service. * * @param id the resource ID. * @param context The context to associate with this operation. 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..3176233dbb7eb --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/TermsOfService.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Terms of service + * + *

Terms of service for the API. + */ +@Fluent +public final class TermsOfService { + /* + * URL + * + * 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 + * + *

URL pointing to the terms of service. + * + * @return the url value. + */ + public String url() { + return this.url; + } + + /** + * Set the url property: URL + * + *

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/Workspace.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/Workspace.java new file mode 100644 index 0000000000000..9f5bda86201f7 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/Workspace.java @@ -0,0 +1,200 @@ +// 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 systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the title property: Workspace display name. + * + * @return the title value. + */ + String title(); + + /** + * Gets the description property: Workspace description. + * + * @return the description value. + */ + String description(); + + /** + * 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 Service name. + * @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.WithTitle, DefinitionStages.WithDescription { + /** + * 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 title. */ + interface WithTitle { + /** + * Specifies the title property: Workspace display name.. + * + * @param title Workspace display name. + * @return the next definition stage. + */ + WithCreate withTitle(String title); + } + + /** The stage of the Workspace definition allowing to specify description. */ + interface WithDescription { + /** + * Specifies the description property: Workspace description.. + * + * @param description Workspace description. + * @return the next definition stage. + */ + WithCreate withDescription(String description); + } + } + + /** + * Begins update for the Workspace resource. + * + * @return the stage of resource update. + */ + Workspace.Update update(); + + /** The template for Workspace update. */ + interface Update extends UpdateStages.WithTitle, UpdateStages.WithDescription { + /** + * 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 { + /** The stage of the Workspace update allowing to specify title. */ + interface WithTitle { + /** + * Specifies the title property: Workspace display name.. + * + * @param title Workspace display name. + * @return the next definition stage. + */ + Update withTitle(String title); + } + + /** The stage of the Workspace update allowing to specify description. */ + interface WithDescription { + /** + * Specifies the description property: Workspace description.. + * + * @param description Workspace description. + * @return the next definition stage. + */ + Update withDescription(String description); + } + } + + /** + * 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/WorkspaceCollection.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/WorkspaceCollection.java new file mode 100644 index 0000000000000..04ea4228ad507 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/WorkspaceCollection.java @@ -0,0 +1,89 @@ +// 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.resourcemanager.apicenter.fluent.models.WorkspaceInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * Workspace collection + * + *

Paginated collection of workspaces. + */ +@Fluent +public final class WorkspaceCollection { + /* + * Page items. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Total record count number across all pages. + */ + @JsonProperty(value = "count") + private Long count; + + /* + * Next page link if any. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of WorkspaceCollection class. */ + public WorkspaceCollection() { + } + + /** + * Get the value property: Page items. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the count property: Total record count number across all pages. + * + * @return the count value. + */ + public Long count() { + return this.count; + } + + /** + * Set the count property: Total record count number across all pages. + * + * @param count the count value to set. + * @return the WorkspaceCollection object itself. + */ + public WorkspaceCollection withCount(Long count) { + this.count = count; + return this; + } + + /** + * Get the nextLink property: Next page link if any. + * + * @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/Workspaces.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/Workspaces.java new file mode 100644 index 0000000000000..4667527c467f7 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/Workspaces.java @@ -0,0 +1,197 @@ +// 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 { + /** + * List workspaces + * + *

Returns a collection of workspaces. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 collection as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String serviceName); + + /** + * List workspaces + * + *

Returns a collection of workspaces. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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 workspace collection as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String serviceName, String filter, Context context); + + /** + * Get workspace + * + *

Returns details of the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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. + */ + Response getWithResponse( + String resourceGroupName, String serviceName, String workspaceName, Context context); + + /** + * Get workspace + * + *

Returns details of the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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. + */ + Workspace get(String resourceGroupName, String serviceName, String workspaceName); + + /** + * Delete workspace + * + *

Deletes specified workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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); + + /** + * Delete workspace + * + *

Deletes specified workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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); + + /** + * Check workspace exists + * + *

Checks if specified workspace exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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); + + /** + * Check workspace exists + * + *

Checks if specified workspace exists. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName Service name. + * @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); + + /** + * Get workspace + * + *

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. + */ + Workspace getById(String id); + + /** + * Get workspace + * + *

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. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete workspace + * + *

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); + + /** + * Delete workspace + * + *

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..4505e93533d6e --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/WorkspacesCreateOrUpdateHeaders.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.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..fa1dc602404df --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/WorkspacesCreateOrUpdateResponse.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.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..3042864bd8cda --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/WorkspacesGetHeaders.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.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..c2678e7a4eb88 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/main/java/com/azure/resourcemanager/apicenter/models/WorkspacesGetResponse.java @@ -0,0 +1,41 @@ +// 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/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..1117adfd3d959 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ApiDefinitionsCreateOrUpdateSamples.java @@ -0,0 +1,26 @@ +// 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") + .withTitle("OpenAPI") + .withDescription("Default spec") + .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..e03b6d867d062 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ApiDefinitionsDeleteSamples.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; + +/** 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..75617c76dcf4b --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ApiDefinitionsExportSpecificationSamples.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; + +/** 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() + .exportSpecificationWithResponse( + "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..910a265963680 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ApiDefinitionsGetSamples.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; + +/** 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..9c030f511c4c1 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ApiDefinitionsHeadSamples.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; + +/** 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..66ab9556601fe --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ApiDefinitionsImportSpecificationSamples.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.resourcemanager.apicenter.models.ApiSpecImportRequest; +import com.azure.resourcemanager.apicenter.models.ApiSpecImportRequestSpecification; +import com.azure.resourcemanager.apicenter.models.ApiSpecImportSourceFormat; + +/** 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() + .importSpecificationWithResponse( + "contoso-resources", + "contoso", + "default", + "echo-api", + "2023-01-01", + "openapi", + new ApiSpecImportRequest() + .withValue("https://...") + .withFormat(ApiSpecImportSourceFormat.LINK) + .withSpecification(new ApiSpecImportRequestSpecification().withName("openapi").withValue("3.0.1")), + 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..f994f16a85486 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ApiDefinitionsListSamples.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; + +/** 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_List. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void apiDefinitionsList(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..0d71043865ffc --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ApiVersionsCreateOrUpdateSamples.java @@ -0,0 +1,28 @@ +// 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.resourcemanager.apicenter.models.LifecycleStage; + +/** 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") + .withTitle("2023-01-01") + .withLifecycleStage(LifecycleStage.PRODUCTION) + .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..0afb0f169db32 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ApiVersionsDeleteSamples.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 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..b84afbae855b7 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ApiVersionsGetSamples.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 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..7b1b728c4dd70 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ApiVersionsHeadSamples.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 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..599966c1fc128 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ApiVersionsListSamples.java @@ -0,0 +1,22 @@ +// 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_List. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void apiVersionsList(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..c5ec06cdeaf52 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ApisCreateOrUpdateSamples.java @@ -0,0 +1,47 @@ +// 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.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.apicenter.models.ApiType; +import com.azure.resourcemanager.apicenter.models.ExternalDocumentation; +import com.azure.resourcemanager.apicenter.models.License; +import com.azure.resourcemanager.apicenter.models.TermsOfService; +import java.io.IOException; +import java.util.Arrays; + +/** 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) + throws IOException { + manager + .apis() + .define("echo-api") + .withExistingWorkspace("contoso-resources", "contoso", "default") + .withTitle("Echo API") + .withTypePropertiesType(ApiType.REST) + .withDescription("A simple HTTP request/response service.") + .withTermsOfService(new TermsOfService().withUrl("https://contoso.com/terms-of-service")) + .withExternalDocumentation( + Arrays + .asList( + new ExternalDocumentation().withTitle("Onboarding docs").withUrl("https://docs.contoso.com"))) + .withLicense(new License().withUrl("https://contoso.com/license")) + .withCustomProperties( + SerializerFactory + .createDefaultManagementSerializerAdapter() + .deserialize("{\"author\":\"John Doe\"}", Object.class, SerializerEncoding.JSON)) + .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..c4e3a304eb5ca --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ApisDeleteSamples.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 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..4e4d69e2f0835 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ApisGetSamples.java @@ -0,0 +1,22 @@ +// 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..6a0105903d9ff --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ApisHeadSamples.java @@ -0,0 +1,22 @@ +// 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..cd1756e644708 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ApisListSamples.java @@ -0,0 +1,20 @@ +// 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_List. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void apisList(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..b07394e347324 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/DeploymentsCreateOrUpdateSamples.java @@ -0,0 +1,34 @@ +// 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.resourcemanager.apicenter.models.DeploymentServer; +import com.azure.resourcemanager.apicenter.models.DeploymentState; +import java.util.Arrays; + +/** 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") + .withTitle("Production deployment") + .withDescription("Public cloud production deployment.") + .withEnvironmentId("/workspaces/default/environments/production") + .withDefinitionId("/workspaces/default/apis/echo-api/versions/2023-01-01/definitions/openapi") + .withState(DeploymentState.ACTIVE) + .withServer(new DeploymentServer().withRuntimeUri(Arrays.asList("https://api.contoso.com"))) + .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..987b83121adc6 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/DeploymentsDeleteSamples.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 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..617fa2e2452f7 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/DeploymentsGetSamples.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 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..2ad55430d77ce --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/DeploymentsHeadSamples.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 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..45dadae6eceb7 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/DeploymentsListSamples.java @@ -0,0 +1,22 @@ +// 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_List. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void deploymentsList(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..575f2710ccc99 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/EnvironmentsCreateOrUpdateSamples.java @@ -0,0 +1,46 @@ +// 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.resourcemanager.apicenter.models.EnvironmentServer; +import com.azure.resourcemanager.apicenter.models.EnvironmentServerType; +import com.azure.resourcemanager.apicenter.models.EnvironmentType; +import com.azure.resourcemanager.apicenter.models.Onboarding; +import java.util.Arrays; + +/** 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") + .withTitle("Contoso Europe Azure API Management") + .withDescription("The primary Azure API Management service for the European division of Contoso.") + .withTypePropertiesType(EnvironmentType.PRODUCTION) + .withServer( + new EnvironmentServer() + .withType(EnvironmentServerType.AZURE_API_MANAGEMENT) + .withManagementPortalUri( + Arrays + .asList( + "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso-resources/providers/Microsoft.ApiManagement/service/contoso"))) + .withOnboarding( + new Onboarding() + .withInstructions( + "Sign in or sign up in the specified developer portal to request API access. You must complete" + + " the internal privacy training for your account to be approved.") + .withDeveloperPortalUri(Arrays.asList("https://developer.contoso.com"))) + .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..8f4b3ca38a596 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/EnvironmentsDeleteSamples.java @@ -0,0 +1,22 @@ +// 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..b4b13b432d415 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/EnvironmentsGetSamples.java @@ -0,0 +1,22 @@ +// 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..7ba464b319d1e --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/EnvironmentsHeadSamples.java @@ -0,0 +1,22 @@ +// 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..39faba7f1bda7 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/EnvironmentsListSamples.java @@ -0,0 +1,20 @@ +// 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_List. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void environmentsList(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..4c942ecf97871 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/MetadataSchemasCreateOrUpdateSamples.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.resourcemanager.apicenter.models.MetadataAssignment; +import com.azure.resourcemanager.apicenter.models.MetadataAssignmentEntity; +import java.util.Arrays; + +/** 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") + .withSchema("{\"type\":\"string\", \"title\":\"Author\", pattern: \"^[a-zA-Z]+$\"}") + .withAssignedTo( + Arrays.asList(new MetadataAssignment().withEntity(MetadataAssignmentEntity.API).withDeprecated(true))) + .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..77758206cffb1 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/MetadataSchemasDeleteSamples.java @@ -0,0 +1,22 @@ +// 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..036bb7841166f --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/MetadataSchemasGetSamples.java @@ -0,0 +1,22 @@ +// 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..df3f579f72d5a --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/MetadataSchemasHeadSamples.java @@ -0,0 +1,22 @@ +// 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..e15f8808cec70 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/MetadataSchemasListSamples.java @@ -0,0 +1,20 @@ +// 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_List. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void metadataSchemasList(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..61b0a054ae80c 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 @@ -7,7 +7,7 @@ /** 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. 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..bacd992ea75aa 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 @@ -7,7 +7,7 @@ /** 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. 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..524af2d0c00f4 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 @@ -7,7 +7,7 @@ /** 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. 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..e5ca9582089fd --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/ServicesExportMetadataSchemaSamples.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.resourcemanager.apicenter.models.MetadataAssignmentEntity; +import com.azure.resourcemanager.apicenter.models.MetadataSchemaExportRequest; + +/** 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() + .exportMetadataSchemaWithResponse( + "contoso-resources", + "contoso", + new MetadataSchemaExportRequest().withAssignedTo(MetadataAssignmentEntity.API), + 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..e95593ac21415 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 @@ -7,7 +7,7 @@ /** 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. 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..44cebe8332714 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 @@ -7,7 +7,7 @@ /** 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. 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..842638507dabb 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 @@ -7,7 +7,7 @@ /** 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. 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..dac484e53331f 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 @@ -9,7 +9,7 @@ /** 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. 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..4a6c6c1c104da --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/WorkspacesCreateOrUpdateSamples.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 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: Workspace_CreateOrUpdate. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void workspaceCreateOrUpdate(com.azure.resourcemanager.apicenter.ApiCenterManager manager) { + manager + .workspaces() + .define("default") + .withExistingService("contoso-resources", "contoso") + .withTitle("default") + .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..6d95429adbc0e --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/WorkspacesDeleteSamples.java @@ -0,0 +1,22 @@ +// 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..a8cefaf95dbc5 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/WorkspacesGetSamples.java @@ -0,0 +1,22 @@ +// 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..82917aba160fc --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/WorkspacesHeadSamples.java @@ -0,0 +1,22 @@ +// 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..71ae71be1e125 --- /dev/null +++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/samples/java/com/azure/resourcemanager/apicenter/generated/WorkspacesListSamples.java @@ -0,0 +1,20 @@ +// 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_List. + * + * @param manager Entry point to ApiCenterManager. + */ + public static void workspacesList(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/ManagedServiceIdentityTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ManagedServiceIdentityTests.java deleted file mode 100644 index 7db7db8a648e8..0000000000000 --- a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ManagedServiceIdentityTests.java +++ /dev/null @@ -1,56 +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.models.ManagedServiceIdentity; -import com.azure.resourcemanager.apicenter.models.ManagedServiceIdentityType; -import com.azure.resourcemanager.apicenter.models.UserAssignedIdentity; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -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); - 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())); - model = BinaryData.fromObject(model).toObject(ManagedServiceIdentity.class); - Assertions.assertEquals(ManagedServiceIdentityType.USER_ASSIGNED, model.type()); - } - - // 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/OperationDisplayTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/OperationDisplayTests.java deleted file mode 100644 index 93b5c0bb47e38..0000000000000 --- a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/OperationDisplayTests.java +++ /dev/null @@ -1,25 +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.models.OperationDisplay; - -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); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - OperationDisplay model = new OperationDisplay(); - model = BinaryData.fromObject(model).toObject(OperationDisplay.class); - } -} 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 deleted file mode 100644 index 91c1cdb4c2153..0000000000000 --- a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/OperationInnerTests.java +++ /dev/null @@ -1,26 +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.OperationInner; -import com.azure.resourcemanager.apicenter.models.OperationDisplay; - -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); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - OperationInner model = new OperationInner().withDisplay(new OperationDisplay()); - model = BinaryData.fromObject(model).toObject(OperationInner.class); - } -} 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 deleted file mode 100644 index 6cc353e505fc4..0000000000000 --- a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/OperationListResultTests.java +++ /dev/null @@ -1,25 +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.models.OperationListResult; - -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); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - OperationListResult model = new OperationListResult(); - model = BinaryData.fromObject(model).toObject(OperationListResult.class); - } -} 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 deleted file mode 100644 index 8120f87c3a9ac..0000000000000 --- a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/OperationsListMockTests.java +++ /dev/null @@ -1,64 +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.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.Operation; -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 OperationsListMockTests { - @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\":[{\"name\":\"zrnf\",\"isDataAction\":true,\"display\":{\"provider\":\"spemvtzfk\",\"resource\":\"ubljofxqe\",\"operation\":\"jaeq\",\"description\":\"qjbasvms\"},\"origin\":\"user\",\"actionType\":\"Internal\"}]}"; - - 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.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 deleted file mode 100644 index 20cdb35d1f11e..0000000000000 --- a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ServiceInnerTests.java +++ /dev/null @@ -1,65 +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.UserAssignedIdentity; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -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); - Assertions.assertEquals("bpf", model.location()); - Assertions.assertEquals("inzgvfcj", model.tags().get("wzo")); - Assertions.assertEquals(ManagedServiceIdentityType.USER_ASSIGNED, model.identity().type()); - } - - @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()))); - model = BinaryData.fromObject(model).toObject(ServiceInner.class); - Assertions.assertEquals("bpf", model.location()); - Assertions.assertEquals("inzgvfcj", model.tags().get("wzo")); - Assertions.assertEquals(ManagedServiceIdentityType.USER_ASSIGNED, model.identity().type()); - } - - // 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/ServicePropertiesTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ServicePropertiesTests.java deleted file mode 100644 index 11fd38cc933d1..0000000000000 --- a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ServicePropertiesTests.java +++ /dev/null @@ -1,22 +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.ServiceProperties; - -public final class ServicePropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ServiceProperties model = - BinaryData.fromString("{\"provisioningState\":\"Canceled\"}").toObject(ServiceProperties.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ServiceProperties model = new ServiceProperties(); - model = BinaryData.fromObject(model).toObject(ServiceProperties.class); - } -} 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 deleted file mode 100644 index b026e07d6328d..0000000000000 --- a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ServiceUpdateTests.java +++ /dev/null @@ -1,22 +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.models.ServiceUpdate; - -public final class ServiceUpdateTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ServiceUpdate model = - BinaryData.fromString("{\"properties\":{\"provisioningState\":\"Failed\"}}").toObject(ServiceUpdate.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ServiceUpdate model = new ServiceUpdate(); - model = BinaryData.fromObject(model).toObject(ServiceUpdate.class); - } -} 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 deleted file mode 100644 index d256fdae20e3f..0000000000000 --- a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ServicesCreateOrUpdateWithResponseMockTests.java +++ /dev/null @@ -1,103 +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.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.ManagedServiceIdentity; -import com.azure.resourcemanager.apicenter.models.ManagedServiceIdentityType; -import com.azure.resourcemanager.apicenter.models.Service; -import com.azure.resourcemanager.apicenter.models.UserAssignedIdentity; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import java.util.HashMap; -import java.util.Map; -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 ServicesCreateOrUpdateWithResponseMockTests { - @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\":{\"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\"}"; - - 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)); - - 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(); - - Assertions.assertEquals("abnmocpcyshu", response.location()); - Assertions.assertEquals("fblj", response.tags().get("gpbtoqcjmklj")); - Assertions.assertEquals(ManagedServiceIdentityType.NONE, response.identity().type()); - } - - // 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/ServicesDeleteByResourceGroupWithResponseMockTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ServicesDeleteByResourceGroupWithResponseMockTests.java deleted file mode 100644 index 30c7bb2764e4e..0000000000000 --- a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ServicesDeleteByResourceGroupWithResponseMockTests.java +++ /dev/null @@ -1,61 +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.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 ServicesDeleteByResourceGroupWithResponseMockTests { - @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.services().deleteByResourceGroupWithResponse("ysszdnrujqguh", "uouq", com.azure.core.util.Context.NONE); - } -} 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 deleted file mode 100644 index 0efe7d20feeb9..0000000000000 --- a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ServicesGetByResourceGroupWithResponseMockTests.java +++ /dev/null @@ -1,73 +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.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.ManagedServiceIdentityType; -import com.azure.resourcemanager.apicenter.models.Service; -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 ServicesGetByResourceGroupWithResponseMockTests { - @Test - public void testGetByResourceGroupWithResponse() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - 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\"}"; - - 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)); - - Service response = - manager - .services() - .getByResourceGroupWithResponse("iqfouflmmnkz", "modmglougpb", 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()); - } -} 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 deleted file mode 100644 index 4bdde9c178829..0000000000000 --- a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ServicesListByResourceGroupMockTests.java +++ /dev/null @@ -1,71 +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.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.ManagedServiceIdentityType; -import com.azure.resourcemanager.apicenter.models.Service; -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 ServicesListByResourceGroupMockTests { - @Test - public void testListByResourceGroup() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - 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\"}]}"; - - 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.services().listByResourceGroup("aozwyiftyhxhu", 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()); - } -} 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 deleted file mode 100644 index 74f178759e31b..0000000000000 --- a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/ServicesListMockTests.java +++ /dev/null @@ -1,72 +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.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.ManagedServiceIdentityType; -import com.azure.resourcemanager.apicenter.models.Service; -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 ServicesListMockTests { - @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\":{\"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\"}]}"; - - 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.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()); - } -} 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 deleted file mode 100644 index 8b7c0bdb73e75..0000000000000 --- a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/generated/UserAssignedIdentityTests.java +++ /dev/null @@ -1,25 +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.models.UserAssignedIdentity; - -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); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - UserAssignedIdentity model = new UserAssignedIdentity(); - model = BinaryData.fromObject(model).toObject(UserAssignedIdentity.class); - } -}