diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index fba5fccdaccb8..0aa18d4a0289d 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -350,6 +350,7 @@ com.azure.resourcemanager:azure-resourcemanager-dynatrace;1.0.0-beta.1;1.0.0-bet com.azure.resourcemanager:azure-resourcemanager-deviceupdate;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-machinelearning;1.0.0-beta.2;1.0.0-beta.3 com.azure.resourcemanager:azure-resourcemanager-education;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-servicefabricmesh;1.0.0-beta.1;1.0.0-beta.1 com.azure.tools:azure-sdk-archetype;1.0.0;1.2.0-beta.1 com.azure.tools:azure-sdk-build-tool;1.0.0-beta.1;1.0.0-beta.2 diff --git a/pom.xml b/pom.xml index 28f19ed8c5cab..bdb323a594d10 100644 --- a/pom.xml +++ b/pom.xml @@ -968,6 +968,7 @@ sdk/securityinsights sdk/servicebus sdk/servicefabric + sdk/servicefabricmesh sdk/servicelinker sdk/signalr sdk/spring diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/CHANGELOG.md b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/CHANGELOG.md new file mode 100644 index 0000000000000..a193265e3d467 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2022-06-14) + +- Azure Resource Manager ServiceFabricMesh client library for Java. This package contains Microsoft Azure SDK for ServiceFabricMesh Management SDK. Service Fabric Mesh Management Client. Package tag package-2018-09-01-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/README.md b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/README.md new file mode 100644 index 0000000000000..af6f7a413dcbd --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/README.md @@ -0,0 +1,102 @@ +# Azure Resource Manager ServiceFabricMesh client library for Java + +Azure Resource Manager ServiceFabricMesh client library for Java. + +This package contains Microsoft Azure SDK for ServiceFabricMesh Management SDK. Service Fabric Mesh Management Client. Package tag package-2018-09-01-preview. 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 + +We're always working on improving our products and the way we communicate with our users. So we'd love to learn what's working and how we can do better. + +If you haven't already, please take a few minutes to [complete this short survey][survey] we have put together. + +Thank you in advance for your collaboration. We really appreciate your time! + +## Documentation + +Various documentation is available to help you get started + +- [API reference documentation][docs] + +## Getting started + +### Prerequisites + +- [Java Development Kit (JDK)][jdk] with version 8 or above +- [Azure Subscription][azure_subscription] + +### Adding the package to your product + +[//]: # ({x-version-update-start;com.azure.resourcemanager:azure-resourcemanager-servicefabricmesh;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-servicefabricmesh + 1.0.0-beta.1 + +``` +[//]: # ({x-version-update-end}) + +### Include the recommended packages + +Azure Management Libraries require a `TokenCredential` implementation for authentication and an `HttpClient` implementation for HTTP client. + +[Azure Identity][azure_identity] package and [Azure Core Netty HTTP][azure_core_http_netty] package provide the default implementation. + +### Authentication + +By default, Azure Active Directory token authentication depends on correct configure of following environment variables. + +- `AZURE_CLIENT_ID` for Azure client ID. +- `AZURE_TENANT_ID` for Azure tenant ID. +- `AZURE_CLIENT_SECRET` or `AZURE_CLIENT_CERTIFICATE_PATH` for client secret or client certificate. + +In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`. + +With above configuration, `azure` client can be authenticated by following code: + +```java +AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +ServiceFabricMeshManager manager = ServiceFabricMeshManager + .authenticate(credential, profile); +``` + +The sample code assumes global Azure. Please change `AzureEnvironment.AZURE` variable if otherwise. + +See [Authentication][authenticate] for more options. + +## Key concepts + +See [API design][design] for general introduction on design and key concepts on Azure Management Libraries. + +## Examples + +[Code snippets and samples](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/SAMPLE.md) + + +## Troubleshooting + +## Next steps + +## Contributing + +For details on contributing to this repository, see the [contributing guide](https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md). + +1. Fork it +1. Create your feature branch (`git checkout -b my-new-feature`) +1. Commit your changes (`git commit -am 'Add some feature'`) +1. Push to the branch (`git push origin my-new-feature`) +1. Create new Pull Request + + +[survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS +[docs]: https://azure.github.io/azure-sdk-for-java/ +[jdk]: https://docs.microsoft.com/java/azure/jdk/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity +[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/core/azure-core-http-netty +[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/AUTH.md +[design]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/DESIGN.md diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/SAMPLE.md b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/SAMPLE.md new file mode 100644 index 0000000000000..fc081c1af1792 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/SAMPLE.md @@ -0,0 +1,1034 @@ +# Code snippets and samples + + +## Application + +- [Create](#application_create) +- [Delete](#application_delete) +- [GetByResourceGroup](#application_getbyresourcegroup) +- [List](#application_list) +- [ListByResourceGroup](#application_listbyresourcegroup) + +## CodePackage + +- [GetContainerLogs](#codepackage_getcontainerlogs) + +## Gateway + +- [Create](#gateway_create) +- [Delete](#gateway_delete) +- [GetByResourceGroup](#gateway_getbyresourcegroup) +- [List](#gateway_list) +- [ListByResourceGroup](#gateway_listbyresourcegroup) + +## Network + +- [Create](#network_create) +- [Delete](#network_delete) +- [GetByResourceGroup](#network_getbyresourcegroup) +- [List](#network_list) +- [ListByResourceGroup](#network_listbyresourcegroup) + +## Secret + +- [Create](#secret_create) +- [Delete](#secret_delete) +- [GetByResourceGroup](#secret_getbyresourcegroup) +- [List](#secret_list) +- [ListByResourceGroup](#secret_listbyresourcegroup) + +## SecretValue + +- [Create](#secretvalue_create) +- [Delete](#secretvalue_delete) +- [Get](#secretvalue_get) +- [List](#secretvalue_list) +- [ListValue](#secretvalue_listvalue) + +## Service + +- [Get](#service_get) +- [List](#service_list) + +## ServiceReplica + +- [Get](#servicereplica_get) +- [List](#servicereplica_list) + +## Volume + +- [Create](#volume_create) +- [Delete](#volume_delete) +- [GetByResourceGroup](#volume_getbyresourcegroup) +- [List](#volume_list) +- [ListByResourceGroup](#volume_listbyresourcegroup) +### Application_Create + +```java +import com.azure.resourcemanager.servicefabricmesh.fluent.models.ServiceResourceDescriptionInner; +import com.azure.resourcemanager.servicefabricmesh.models.ContainerCodePackageProperties; +import com.azure.resourcemanager.servicefabricmesh.models.EndpointProperties; +import com.azure.resourcemanager.servicefabricmesh.models.EndpointRef; +import com.azure.resourcemanager.servicefabricmesh.models.NetworkRef; +import com.azure.resourcemanager.servicefabricmesh.models.OperatingSystemType; +import com.azure.resourcemanager.servicefabricmesh.models.ResourceRequests; +import com.azure.resourcemanager.servicefabricmesh.models.ResourceRequirements; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Application Create. */ +public final class ApplicationCreateSamples { + /* + * x-ms-original-file: specification/servicefabricmesh/resource-manager/Microsoft.ServiceFabricMesh/preview/2018-09-01-preview/examples/applications/create_update.json + */ + /** + * Sample code: CreateOrUpdateApplication. + * + * @param manager Entry point to ServiceFabricMeshManager. + */ + public static void createOrUpdateApplication( + com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager) { + manager + .applications() + .define("sampleApplication") + .withRegion("EastUS") + .withExistingResourceGroup("sbz_demo") + .withTags(mapOf()) + .withDescription("Service Fabric Mesh sample application.") + .withServices( + Arrays + .asList( + new ServiceResourceDescriptionInner() + .withName("helloWorldService") + .withOsType(OperatingSystemType.LINUX) + .withCodePackages( + Arrays + .asList( + new ContainerCodePackageProperties() + .withName("helloWorldCode") + .withImage("seabreeze/sbz-helloworld:1.0-alpine") + .withEndpoints( + Arrays + .asList( + new EndpointProperties() + .withName("helloWorldListener") + .withPort(80))) + .withResources( + new ResourceRequirements() + .withRequests( + new ResourceRequests().withMemoryInGB(1.0).withCpu(1.0))))) + .withNetworkRefs( + Arrays + .asList( + new NetworkRef() + .withName( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/sbz_demo/providers/Microsoft.ServiceFabricMesh/networks/sampleNetwork") + .withEndpointRefs( + Arrays.asList(new EndpointRef().withName("helloWorldListener"))))) + .withDescription("SeaBreeze Hello World Service.") + .withReplicaCount(1))) + .create(); + } + + @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; + } +} +``` + +### Application_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for Application Delete. */ +public final class ApplicationDeleteSamples { + /* + * x-ms-original-file: specification/servicefabricmesh/resource-manager/Microsoft.ServiceFabricMesh/preview/2018-09-01-preview/examples/applications/delete.json + */ + /** + * Sample code: DeleteApplication. + * + * @param manager Entry point to ServiceFabricMeshManager. + */ + public static void deleteApplication(com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager) { + manager.applications().deleteWithResponse("sbz_demo", "sampleApplication", Context.NONE); + } +} +``` + +### Application_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for Application GetByResourceGroup. */ +public final class ApplicationGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/servicefabricmesh/resource-manager/Microsoft.ServiceFabricMesh/preview/2018-09-01-preview/examples/applications/get.json + */ + /** + * Sample code: GetApplication. + * + * @param manager Entry point to ServiceFabricMeshManager. + */ + public static void getApplication(com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager) { + manager.applications().getByResourceGroupWithResponse("sbz_demo", "sampleApplication", Context.NONE); + } +} +``` + +### Application_List + +```java +import com.azure.core.util.Context; + +/** Samples for Application List. */ +public final class ApplicationListSamples { + /* + * x-ms-original-file: specification/servicefabricmesh/resource-manager/Microsoft.ServiceFabricMesh/preview/2018-09-01-preview/examples/applications/list_bySubscriptionId.json + */ + /** + * Sample code: ListApplicationsBySubscriptionId. + * + * @param manager Entry point to ServiceFabricMeshManager. + */ + public static void listApplicationsBySubscriptionId( + com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager) { + manager.applications().list(Context.NONE); + } +} +``` + +### Application_ListByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for Application ListByResourceGroup. */ +public final class ApplicationListByResourceGroupSamples { + /* + * x-ms-original-file: specification/servicefabricmesh/resource-manager/Microsoft.ServiceFabricMesh/preview/2018-09-01-preview/examples/applications/list_byResourceGroup.json + */ + /** + * Sample code: ListApplicationsByResourceGroup. + * + * @param manager Entry point to ServiceFabricMeshManager. + */ + public static void listApplicationsByResourceGroup( + com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager) { + manager.applications().listByResourceGroup("sbz_demo", Context.NONE); + } +} +``` + +### CodePackage_GetContainerLogs + +```java +import com.azure.core.util.Context; + +/** Samples for CodePackage GetContainerLogs. */ +public final class CodePackageGetContainerLogsSamples { + /* + * x-ms-original-file: specification/servicefabricmesh/resource-manager/Microsoft.ServiceFabricMesh/preview/2018-09-01-preview/examples/applications/services/replicas/codepackages/get_logs.json + */ + /** + * Sample code: GetContainerLogs. + * + * @param manager Entry point to ServiceFabricMeshManager. + */ + public static void getContainerLogs(com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager) { + manager + .codePackages() + .getContainerLogsWithResponse( + "sbz_demo", "sbzDocApp", "sbzDocService", "0", "sbzDocCode", null, Context.NONE); + } +} +``` + +### Gateway_Create + +```java +import com.azure.resourcemanager.servicefabricmesh.models.GatewayDestination; +import com.azure.resourcemanager.servicefabricmesh.models.HeaderMatchType; +import com.azure.resourcemanager.servicefabricmesh.models.HttpConfig; +import com.azure.resourcemanager.servicefabricmesh.models.HttpHostConfig; +import com.azure.resourcemanager.servicefabricmesh.models.HttpRouteConfig; +import com.azure.resourcemanager.servicefabricmesh.models.HttpRouteMatchHeader; +import com.azure.resourcemanager.servicefabricmesh.models.HttpRouteMatchPath; +import com.azure.resourcemanager.servicefabricmesh.models.HttpRouteMatchRule; +import com.azure.resourcemanager.servicefabricmesh.models.NetworkRef; +import com.azure.resourcemanager.servicefabricmesh.models.PathMatchType; +import com.azure.resourcemanager.servicefabricmesh.models.TcpConfig; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Gateway Create. */ +public final class GatewayCreateSamples { + /* + * x-ms-original-file: specification/servicefabricmesh/resource-manager/Microsoft.ServiceFabricMesh/preview/2018-09-01-preview/examples/gateways/create_update.json + */ + /** + * Sample code: CreateOrUpdateGateway. + * + * @param manager Entry point to ServiceFabricMeshManager. + */ + public static void createOrUpdateGateway( + com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager) { + manager + .gateways() + .define("sampleGateway") + .withRegion("EastUS") + .withExistingResourceGroup("sbz_demo") + .withSourceNetwork(new NetworkRef().withName("Open")) + .withDestinationNetwork(new NetworkRef().withName("helloWorldNetwork")) + .withTags(mapOf()) + .withDescription("Service Fabric Mesh sample gateway.") + .withTcp( + Arrays + .asList( + new TcpConfig() + .withName("web") + .withPort(80) + .withDestination( + new GatewayDestination() + .withApplicationName("helloWorldApp") + .withServiceName("helloWorldService") + .withEndpointName("helloWorldListener")))) + .withHttp( + Arrays + .asList( + new HttpConfig() + .withName("contosoWebsite") + .withPort(8081) + .withHosts( + Arrays + .asList( + new HttpHostConfig() + .withName("contoso.com") + .withRoutes( + Arrays + .asList( + new HttpRouteConfig() + .withName("index") + .withMatch( + new HttpRouteMatchRule() + .withPath( + new HttpRouteMatchPath() + .withValue("/index") + .withRewrite("/") + .withType(PathMatchType.PREFIX)) + .withHeaders( + Arrays + .asList( + new HttpRouteMatchHeader() + .withName("accept") + .withValue("application/json") + .withType(HeaderMatchType.EXACT)))) + .withDestination( + new GatewayDestination() + .withApplicationName("httpHelloWorldApp") + .withServiceName("indexService") + .withEndpointName("indexHttpEndpoint")))))))) + .create(); + } + + @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; + } +} +``` + +### Gateway_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for Gateway Delete. */ +public final class GatewayDeleteSamples { + /* + * x-ms-original-file: specification/servicefabricmesh/resource-manager/Microsoft.ServiceFabricMesh/preview/2018-09-01-preview/examples/gateways/delete.json + */ + /** + * Sample code: DeleteGateway. + * + * @param manager Entry point to ServiceFabricMeshManager. + */ + public static void deleteGateway(com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager) { + manager.gateways().deleteWithResponse("sbz_demo", "sampleGateway", Context.NONE); + } +} +``` + +### Gateway_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for Gateway GetByResourceGroup. */ +public final class GatewayGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/servicefabricmesh/resource-manager/Microsoft.ServiceFabricMesh/preview/2018-09-01-preview/examples/gateways/get.json + */ + /** + * Sample code: GetGateway. + * + * @param manager Entry point to ServiceFabricMeshManager. + */ + public static void getGateway(com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager) { + manager.gateways().getByResourceGroupWithResponse("sbz_demo", "sampleGateway", Context.NONE); + } +} +``` + +### Gateway_List + +```java +import com.azure.core.util.Context; + +/** Samples for Gateway List. */ +public final class GatewayListSamples { + /* + * x-ms-original-file: specification/servicefabricmesh/resource-manager/Microsoft.ServiceFabricMesh/preview/2018-09-01-preview/examples/gateways/list_bySubscriptionId.json + */ + /** + * Sample code: ListGatewaysBySubscriptionId. + * + * @param manager Entry point to ServiceFabricMeshManager. + */ + public static void listGatewaysBySubscriptionId( + com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager) { + manager.gateways().list(Context.NONE); + } +} +``` + +### Gateway_ListByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for Gateway ListByResourceGroup. */ +public final class GatewayListByResourceGroupSamples { + /* + * x-ms-original-file: specification/servicefabricmesh/resource-manager/Microsoft.ServiceFabricMesh/preview/2018-09-01-preview/examples/gateways/list_byResourceGroup.json + */ + /** + * Sample code: ListGatewaysByResourceGroup. + * + * @param manager Entry point to ServiceFabricMeshManager. + */ + public static void listGatewaysByResourceGroup( + com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager) { + manager.gateways().listByResourceGroup("sbz_demo", Context.NONE); + } +} +``` + +### Network_Create + +```java +import com.azure.resourcemanager.servicefabricmesh.models.LocalNetworkResourceProperties; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Network Create. */ +public final class NetworkCreateSamples { + /* + * x-ms-original-file: specification/servicefabricmesh/resource-manager/Microsoft.ServiceFabricMesh/preview/2018-09-01-preview/examples/networks/create_update.json + */ + /** + * Sample code: CreateOrUpdateNetwork. + * + * @param manager Entry point to ServiceFabricMeshManager. + */ + public static void createOrUpdateNetwork( + com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager) { + manager + .networks() + .define("sampleNetwork") + .withRegion("EastUS") + .withExistingResourceGroup("sbz_demo") + .withProperties( + new LocalNetworkResourceProperties() + .withDescription("Service Fabric Mesh sample network.") + .withNetworkAddressPrefix("2.0.0.0/16")) + .withTags(mapOf()) + .create(); + } + + @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; + } +} +``` + +### Network_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for Network Delete. */ +public final class NetworkDeleteSamples { + /* + * x-ms-original-file: specification/servicefabricmesh/resource-manager/Microsoft.ServiceFabricMesh/preview/2018-09-01-preview/examples/networks/delete.json + */ + /** + * Sample code: DeleteNetwork. + * + * @param manager Entry point to ServiceFabricMeshManager. + */ + public static void deleteNetwork(com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager) { + manager.networks().deleteWithResponse("sbz_demo", "sampleNetwork", Context.NONE); + } +} +``` + +### Network_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for Network GetByResourceGroup. */ +public final class NetworkGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/servicefabricmesh/resource-manager/Microsoft.ServiceFabricMesh/preview/2018-09-01-preview/examples/networks/get.json + */ + /** + * Sample code: GetNetwork. + * + * @param manager Entry point to ServiceFabricMeshManager. + */ + public static void getNetwork(com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager) { + manager.networks().getByResourceGroupWithResponse("sbz_demo", "sampleNetwork", Context.NONE); + } +} +``` + +### Network_List + +```java +import com.azure.core.util.Context; + +/** Samples for Network List. */ +public final class NetworkListSamples { + /* + * x-ms-original-file: specification/servicefabricmesh/resource-manager/Microsoft.ServiceFabricMesh/preview/2018-09-01-preview/examples/networks/list_bySubscriptionId.json + */ + /** + * Sample code: ListNetworksBySubscriptionId. + * + * @param manager Entry point to ServiceFabricMeshManager. + */ + public static void listNetworksBySubscriptionId( + com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager) { + manager.networks().list(Context.NONE); + } +} +``` + +### Network_ListByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for Network ListByResourceGroup. */ +public final class NetworkListByResourceGroupSamples { + /* + * x-ms-original-file: specification/servicefabricmesh/resource-manager/Microsoft.ServiceFabricMesh/preview/2018-09-01-preview/examples/networks/list_byResourceGroup.json + */ + /** + * Sample code: ListNetworksByResourceGroup. + * + * @param manager Entry point to ServiceFabricMeshManager. + */ + public static void listNetworksByResourceGroup( + com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager) { + manager.networks().listByResourceGroup("sbz_demo", Context.NONE); + } +} +``` + +### Secret_Create + +```java +import com.azure.resourcemanager.servicefabricmesh.models.InlinedValueSecretResourceProperties; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Secret Create. */ +public final class SecretCreateSamples { + /* + * x-ms-original-file: specification/servicefabricmesh/resource-manager/Microsoft.ServiceFabricMesh/preview/2018-09-01-preview/examples/secrets/create_update.json + */ + /** + * Sample code: CreateOrUpdateSecret. + * + * @param manager Entry point to ServiceFabricMeshManager. + */ + public static void createOrUpdateSecret( + com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager) { + manager + .secrets() + .define("dbConnectionString") + .withRegion("EastUS") + .withExistingResourceGroup("sbz_demo") + .withProperties( + new InlinedValueSecretResourceProperties() + .withDescription("Mongo DB connection string for backend database!") + .withContentType("text/plain")) + .withTags(mapOf()) + .create(); + } + + @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; + } +} +``` + +### Secret_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for Secret Delete. */ +public final class SecretDeleteSamples { + /* + * x-ms-original-file: specification/servicefabricmesh/resource-manager/Microsoft.ServiceFabricMesh/preview/2018-09-01-preview/examples/secrets/delete.json + */ + /** + * Sample code: DeleteSecret. + * + * @param manager Entry point to ServiceFabricMeshManager. + */ + public static void deleteSecret(com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager) { + manager.secrets().deleteWithResponse("sbz_demo", "dbConnectionString", Context.NONE); + } +} +``` + +### Secret_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for Secret GetByResourceGroup. */ +public final class SecretGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/servicefabricmesh/resource-manager/Microsoft.ServiceFabricMesh/preview/2018-09-01-preview/examples/secrets/get.json + */ + /** + * Sample code: GetSecret. + * + * @param manager Entry point to ServiceFabricMeshManager. + */ + public static void getSecret(com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager) { + manager.secrets().getByResourceGroupWithResponse("sbz_demo", "dbConnectionString", Context.NONE); + } +} +``` + +### Secret_List + +```java +import com.azure.core.util.Context; + +/** Samples for Secret List. */ +public final class SecretListSamples { + /* + * x-ms-original-file: specification/servicefabricmesh/resource-manager/Microsoft.ServiceFabricMesh/preview/2018-09-01-preview/examples/secrets/list_bySubscriptionId.json + */ + /** + * Sample code: ListSecretsBySubscriptionId. + * + * @param manager Entry point to ServiceFabricMeshManager. + */ + public static void listSecretsBySubscriptionId( + com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager) { + manager.secrets().list(Context.NONE); + } +} +``` + +### Secret_ListByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for Secret ListByResourceGroup. */ +public final class SecretListByResourceGroupSamples { + /* + * x-ms-original-file: specification/servicefabricmesh/resource-manager/Microsoft.ServiceFabricMesh/preview/2018-09-01-preview/examples/secrets/list_byResourceGroup.json + */ + /** + * Sample code: ListSecretsByResourceGroup. + * + * @param manager Entry point to ServiceFabricMeshManager. + */ + public static void listSecretsByResourceGroup( + com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager) { + manager.secrets().listByResourceGroup("sbz_demo", Context.NONE); + } +} +``` + +### SecretValue_Create + +```java +/** Samples for SecretValue Create. */ +public final class SecretValueCreateSamples { + /* + * x-ms-original-file: specification/servicefabricmesh/resource-manager/Microsoft.ServiceFabricMesh/preview/2018-09-01-preview/examples/secrets/values/create.json + */ + /** + * Sample code: CreateSecretValue. + * + * @param manager Entry point to ServiceFabricMeshManager. + */ + public static void createSecretValue(com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager) { + manager + .secretValues() + .define("v1") + .withRegion("West US") + .withExistingSecret("sbz_demo", "dbConnectionString") + .withValue( + "mongodb://contoso123:0Fc3IolnL12312asdfawejunASDF@asdfYXX2t8a97kghVcUzcDv98hawelufhawefafnoQRGwNj2nMPL1Y9qsIr9Srdw==@contoso123.documents.azure.com:10255/mydatabase?ssl=true") + .create(); + } +} +``` + +### SecretValue_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for SecretValue Delete. */ +public final class SecretValueDeleteSamples { + /* + * x-ms-original-file: specification/servicefabricmesh/resource-manager/Microsoft.ServiceFabricMesh/preview/2018-09-01-preview/examples/secrets/values/delete.json + */ + /** + * Sample code: DeleteSecretValue. + * + * @param manager Entry point to ServiceFabricMeshManager. + */ + public static void deleteSecretValue(com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager) { + manager.secretValues().deleteWithResponse("sbz_demo", "dbConnectionString", "v1", Context.NONE); + } +} +``` + +### SecretValue_Get + +```java +import com.azure.core.util.Context; + +/** Samples for SecretValue Get. */ +public final class SecretValueGetSamples { + /* + * x-ms-original-file: specification/servicefabricmesh/resource-manager/Microsoft.ServiceFabricMesh/preview/2018-09-01-preview/examples/secrets/values/get.json + */ + /** + * Sample code: GetSecretValue. + * + * @param manager Entry point to ServiceFabricMeshManager. + */ + public static void getSecretValue(com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager) { + manager.secretValues().getWithResponse("sbz_demo", "dbConnectionString", "v1", Context.NONE); + } +} +``` + +### SecretValue_List + +```java +import com.azure.core.util.Context; + +/** Samples for SecretValue List. */ +public final class SecretValueListSamples { + /* + * x-ms-original-file: specification/servicefabricmesh/resource-manager/Microsoft.ServiceFabricMesh/preview/2018-09-01-preview/examples/secrets/values/list.json + */ + /** + * Sample code: ListSecretValues. + * + * @param manager Entry point to ServiceFabricMeshManager. + */ + public static void listSecretValues(com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager) { + manager.secretValues().list("sbz_demo", "dbConnectionString", Context.NONE); + } +} +``` + +### SecretValue_ListValue + +```java +import com.azure.core.util.Context; + +/** Samples for SecretValue ListValue. */ +public final class SecretValueListValueSamples { + /* + * x-ms-original-file: specification/servicefabricmesh/resource-manager/Microsoft.ServiceFabricMesh/preview/2018-09-01-preview/examples/secrets/values/list_value.json + */ + /** + * Sample code: ListSecretValue. + * + * @param manager Entry point to ServiceFabricMeshManager. + */ + public static void listSecretValue(com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager) { + manager.secretValues().listValueWithResponse("sbz_demo", "dbConnectionString", "v1", Context.NONE); + } +} +``` + +### Service_Get + +```java +import com.azure.core.util.Context; + +/** Samples for Service Get. */ +public final class ServiceGetSamples { + /* + * x-ms-original-file: specification/servicefabricmesh/resource-manager/Microsoft.ServiceFabricMesh/preview/2018-09-01-preview/examples/applications/services/get.json + */ + /** + * Sample code: GetService. + * + * @param manager Entry point to ServiceFabricMeshManager. + */ + public static void getService(com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager) { + manager.services().getWithResponse("sbz_demo", "sampleApplication", "helloWorldService", Context.NONE); + } +} +``` + +### Service_List + +```java +import com.azure.core.util.Context; + +/** Samples for Service List. */ +public final class ServiceListSamples { + /* + * x-ms-original-file: specification/servicefabricmesh/resource-manager/Microsoft.ServiceFabricMesh/preview/2018-09-01-preview/examples/applications/services/list.json + */ + /** + * Sample code: ListServices. + * + * @param manager Entry point to ServiceFabricMeshManager. + */ + public static void listServices(com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager) { + manager.services().list("sbz_demo", "sampleApplication", Context.NONE); + } +} +``` + +### ServiceReplica_Get + +```java +import com.azure.core.util.Context; + +/** Samples for ServiceReplica Get. */ +public final class ServiceReplicaGetSamples { + /* + * x-ms-original-file: specification/servicefabricmesh/resource-manager/Microsoft.ServiceFabricMesh/preview/2018-09-01-preview/examples/applications/services/replicas/get.json + */ + /** + * Sample code: ReplicaGet. + * + * @param manager Entry point to ServiceFabricMeshManager. + */ + public static void replicaGet(com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager) { + manager.serviceReplicas().getWithResponse("sbz_demo", "helloWorldApp", "helloWorldService", "0", Context.NONE); + } +} +``` + +### ServiceReplica_List + +```java +import com.azure.core.util.Context; + +/** Samples for ServiceReplica List. */ +public final class ServiceReplicaListSamples { + /* + * x-ms-original-file: specification/servicefabricmesh/resource-manager/Microsoft.ServiceFabricMesh/preview/2018-09-01-preview/examples/applications/services/replicas/list.json + */ + /** + * Sample code: ReplicasGetAll. + * + * @param manager Entry point to ServiceFabricMeshManager. + */ + public static void replicasGetAll(com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager) { + manager.serviceReplicas().list("sbz_demo", "sampleApplication", "helloWorldService", Context.NONE); + } +} +``` + +### Volume_Create + +```java +import com.azure.resourcemanager.servicefabricmesh.models.VolumeProvider; +import com.azure.resourcemanager.servicefabricmesh.models.VolumeProviderParametersAzureFile; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Volume Create. */ +public final class VolumeCreateSamples { + /* + * x-ms-original-file: specification/servicefabricmesh/resource-manager/Microsoft.ServiceFabricMesh/preview/2018-09-01-preview/examples/volumes/create_update.json + */ + /** + * Sample code: CreateOrUpdateVolume. + * + * @param manager Entry point to ServiceFabricMeshManager. + */ + public static void createOrUpdateVolume( + com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager) { + manager + .volumes() + .define("sampleVolume") + .withRegion("EastUS") + .withExistingResourceGroup("sbz_demo") + .withProvider(VolumeProvider.SFAZURE_FILE) + .withTags(mapOf()) + .withDescription("Service Fabric Mesh sample volume.") + .withAzureFileParameters( + new VolumeProviderParametersAzureFile() + .withAccountName("sbzdemoaccount") + .withAccountKey("provide-account-key-here") + .withShareName("sharel")) + .create(); + } + + @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; + } +} +``` + +### Volume_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for Volume Delete. */ +public final class VolumeDeleteSamples { + /* + * x-ms-original-file: specification/servicefabricmesh/resource-manager/Microsoft.ServiceFabricMesh/preview/2018-09-01-preview/examples/volumes/delete.json + */ + /** + * Sample code: DeleteVolume. + * + * @param manager Entry point to ServiceFabricMeshManager. + */ + public static void deleteVolume(com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager) { + manager.volumes().deleteWithResponse("sbz_demo", "sampleVolume", Context.NONE); + } +} +``` + +### Volume_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for Volume GetByResourceGroup. */ +public final class VolumeGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/servicefabricmesh/resource-manager/Microsoft.ServiceFabricMesh/preview/2018-09-01-preview/examples/volumes/get.json + */ + /** + * Sample code: GetVolume. + * + * @param manager Entry point to ServiceFabricMeshManager. + */ + public static void getVolume(com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager) { + manager.volumes().getByResourceGroupWithResponse("sbz_demo", "sampleVolume", Context.NONE); + } +} +``` + +### Volume_List + +```java +import com.azure.core.util.Context; + +/** Samples for Volume List. */ +public final class VolumeListSamples { + /* + * x-ms-original-file: specification/servicefabricmesh/resource-manager/Microsoft.ServiceFabricMesh/preview/2018-09-01-preview/examples/volumes/list_bySubscriptionId.json + */ + /** + * Sample code: ListVolumesBySubscriptionId. + * + * @param manager Entry point to ServiceFabricMeshManager. + */ + public static void listVolumesBySubscriptionId( + com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager) { + manager.volumes().list(Context.NONE); + } +} +``` + +### Volume_ListByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for Volume ListByResourceGroup. */ +public final class VolumeListByResourceGroupSamples { + /* + * x-ms-original-file: specification/servicefabricmesh/resource-manager/Microsoft.ServiceFabricMesh/preview/2018-09-01-preview/examples/volumes/list_byResourceGroup.json + */ + /** + * Sample code: ListVolumesByResourceGroup. + * + * @param manager Entry point to ServiceFabricMeshManager. + */ + public static void listVolumesByResourceGroup( + com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager) { + manager.volumes().listByResourceGroup("sbz_demo", Context.NONE); + } +} +``` + diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/pom.xml b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/pom.xml new file mode 100644 index 0000000000000..8fd7976c25a41 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/pom.xml @@ -0,0 +1,55 @@ + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-servicefabricmesh + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for ServiceFabricMesh Management + This package contains Microsoft Azure SDK for ServiceFabricMesh Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Service Fabric Mesh Management Client. Package tag package-2018-09-01-preview. + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + true + + + + com.azure + azure-core + 1.29.1 + + + com.azure + azure-core-management + 1.6.2 + + + diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/ServiceFabricMeshManager.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/ServiceFabricMeshManager.java new file mode 100644 index 0000000000000..21655d637f54d --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/ServiceFabricMeshManager.java @@ -0,0 +1,426 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh; + +import com.azure.core.credential.TokenCredential; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.http.policy.ArmChallengeAuthenticationPolicy; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.servicefabricmesh.fluent.ServiceFabricMeshManagementClient; +import com.azure.resourcemanager.servicefabricmesh.implementation.ApplicationsImpl; +import com.azure.resourcemanager.servicefabricmesh.implementation.CodePackagesImpl; +import com.azure.resourcemanager.servicefabricmesh.implementation.GatewaysImpl; +import com.azure.resourcemanager.servicefabricmesh.implementation.NetworksImpl; +import com.azure.resourcemanager.servicefabricmesh.implementation.OperationsImpl; +import com.azure.resourcemanager.servicefabricmesh.implementation.SecretValuesImpl; +import com.azure.resourcemanager.servicefabricmesh.implementation.SecretsImpl; +import com.azure.resourcemanager.servicefabricmesh.implementation.ServiceFabricMeshManagementClientBuilder; +import com.azure.resourcemanager.servicefabricmesh.implementation.ServiceReplicasImpl; +import com.azure.resourcemanager.servicefabricmesh.implementation.ServicesImpl; +import com.azure.resourcemanager.servicefabricmesh.implementation.VolumesImpl; +import com.azure.resourcemanager.servicefabricmesh.models.Applications; +import com.azure.resourcemanager.servicefabricmesh.models.CodePackages; +import com.azure.resourcemanager.servicefabricmesh.models.Gateways; +import com.azure.resourcemanager.servicefabricmesh.models.Networks; +import com.azure.resourcemanager.servicefabricmesh.models.Operations; +import com.azure.resourcemanager.servicefabricmesh.models.SecretValues; +import com.azure.resourcemanager.servicefabricmesh.models.Secrets; +import com.azure.resourcemanager.servicefabricmesh.models.ServiceReplicas; +import com.azure.resourcemanager.servicefabricmesh.models.Services; +import com.azure.resourcemanager.servicefabricmesh.models.Volumes; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +/** Entry point to ServiceFabricMeshManager. Service Fabric Mesh Management Client. */ +public final class ServiceFabricMeshManager { + private Operations operations; + + private Secrets secrets; + + private SecretValues secretValues; + + private Volumes volumes; + + private Networks networks; + + private Gateways gateways; + + private Applications applications; + + private Services services; + + private ServiceReplicas serviceReplicas; + + private CodePackages codePackages; + + private final ServiceFabricMeshManagementClient clientObject; + + private ServiceFabricMeshManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = + new ServiceFabricMeshManagementClientBuilder() + .pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of ServiceFabricMesh service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the ServiceFabricMesh service API instance. + */ + public static ServiceFabricMeshManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return configure().authenticate(credential, profile); + } + + /** + * Creates an instance of ServiceFabricMesh service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the ServiceFabricMesh service API instance. + */ + public static ServiceFabricMeshManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new ServiceFabricMeshManager(httpPipeline, profile, null); + } + + /** + * Gets a Configurable instance that can be used to create ServiceFabricMeshManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new ServiceFabricMeshManager.Configurable(); + } + + /** The Configurable allowing configurations to be set. */ + public static final class Configurable { + private static final ClientLogger LOGGER = new ClientLogger(Configurable.class); + + private HttpClient httpClient; + private HttpLogOptions httpLogOptions; + private final List policies = new ArrayList<>(); + private final List scopes = new ArrayList<>(); + private RetryPolicy retryPolicy; + private RetryOptions retryOptions; + private Duration defaultPollInterval; + + private Configurable() { + } + + /** + * Sets the http client. + * + * @param httpClient the HTTP client. + * @return the configurable object itself. + */ + public Configurable withHttpClient(HttpClient httpClient) { + this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); + return this; + } + + /** + * Sets the logging options to the HTTP pipeline. + * + * @param httpLogOptions the HTTP log options. + * @return the configurable object itself. + */ + public Configurable withLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); + return this; + } + + /** + * Adds the pipeline policy to the HTTP pipeline. + * + * @param policy the HTTP pipeline policy. + * @return the configurable object itself. + */ + public Configurable withPolicy(HttpPipelinePolicy policy) { + this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); + return this; + } + + /** + * Adds the scope to permission sets. + * + * @param scope the scope. + * @return the configurable object itself. + */ + public Configurable withScope(String scope) { + this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null.")); + return this; + } + + /** + * Sets the retry policy to the HTTP pipeline. + * + * @param retryPolicy the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); + return this; + } + + /** + * Sets the retry options for the HTTP pipeline retry policy. + * + *

This setting has no effect, if retry policy is set via {@link #withRetryPolicy(RetryPolicy)}. + * + * @param retryOptions the retry options for the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryOptions(RetryOptions retryOptions) { + this.retryOptions = Objects.requireNonNull(retryOptions, "'retryOptions' cannot be null."); + return this; + } + + /** + * Sets the default poll interval, used when service does not provide "Retry-After" header. + * + * @param defaultPollInterval the default poll interval. + * @return the configurable object itself. + */ + public Configurable withDefaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = + Objects.requireNonNull(defaultPollInterval, "'defaultPollInterval' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw LOGGER + .logExceptionAsError(new IllegalArgumentException("'defaultPollInterval' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of ServiceFabricMesh service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the ServiceFabricMesh service API instance. + */ + public ServiceFabricMeshManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + + StringBuilder userAgentBuilder = new StringBuilder(); + userAgentBuilder + .append("azsdk-java") + .append("-") + .append("com.azure.resourcemanager.servicefabricmesh") + .append("/") + .append("1.0.0-beta.1"); + if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { + userAgentBuilder + .append(" (") + .append(Configuration.getGlobalConfiguration().get("java.version")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.name")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.version")) + .append("; auto-generated)"); + } else { + userAgentBuilder.append(" (auto-generated)"); + } + + if (scopes.isEmpty()) { + scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); + } + if (retryPolicy == null) { + if (retryOptions != null) { + retryPolicy = new RetryPolicy(retryOptions); + } else { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new AddHeadersFromContextPolicy()); + policies.add(new RequestIdPolicy()); + policies + .addAll( + this + .policies + .stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .collect(Collectors.toList())); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies.add(new ArmChallengeAuthenticationPolicy(credential, scopes.toArray(new String[0]))); + policies + .addAll( + this + .policies + .stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .collect(Collectors.toList())); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = + new HttpPipelineBuilder() + .httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new ServiceFabricMeshManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** + * Gets the resource collection API of Operations. + * + * @return Resource collection API of Operations. + */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(clientObject.getOperations(), this); + } + return operations; + } + + /** + * Gets the resource collection API of Secrets. It manages SecretResourceDescription. + * + * @return Resource collection API of Secrets. + */ + public Secrets secrets() { + if (this.secrets == null) { + this.secrets = new SecretsImpl(clientObject.getSecrets(), this); + } + return secrets; + } + + /** + * Gets the resource collection API of SecretValues. It manages SecretValueResourceDescription. + * + * @return Resource collection API of SecretValues. + */ + public SecretValues secretValues() { + if (this.secretValues == null) { + this.secretValues = new SecretValuesImpl(clientObject.getSecretValues(), this); + } + return secretValues; + } + + /** + * Gets the resource collection API of Volumes. It manages VolumeResourceDescription. + * + * @return Resource collection API of Volumes. + */ + public Volumes volumes() { + if (this.volumes == null) { + this.volumes = new VolumesImpl(clientObject.getVolumes(), this); + } + return volumes; + } + + /** + * Gets the resource collection API of Networks. It manages NetworkResourceDescription. + * + * @return Resource collection API of Networks. + */ + public Networks networks() { + if (this.networks == null) { + this.networks = new NetworksImpl(clientObject.getNetworks(), this); + } + return networks; + } + + /** + * Gets the resource collection API of Gateways. It manages GatewayResourceDescription. + * + * @return Resource collection API of Gateways. + */ + public Gateways gateways() { + if (this.gateways == null) { + this.gateways = new GatewaysImpl(clientObject.getGateways(), this); + } + return gateways; + } + + /** + * Gets the resource collection API of Applications. It manages ApplicationResourceDescription. + * + * @return Resource collection API of Applications. + */ + public Applications applications() { + if (this.applications == null) { + this.applications = new ApplicationsImpl(clientObject.getApplications(), this); + } + return applications; + } + + /** + * Gets the resource collection API of Services. + * + * @return Resource collection API of Services. + */ + public Services services() { + if (this.services == null) { + this.services = new ServicesImpl(clientObject.getServices(), this); + } + return services; + } + + /** + * Gets the resource collection API of ServiceReplicas. + * + * @return Resource collection API of ServiceReplicas. + */ + public ServiceReplicas serviceReplicas() { + if (this.serviceReplicas == null) { + this.serviceReplicas = new ServiceReplicasImpl(clientObject.getServiceReplicas(), this); + } + return serviceReplicas; + } + + /** + * Gets the resource collection API of CodePackages. + * + * @return Resource collection API of CodePackages. + */ + public CodePackages codePackages() { + if (this.codePackages == null) { + this.codePackages = new CodePackagesImpl(clientObject.getCodePackages(), this); + } + return codePackages; + } + + /** + * @return Wrapped service client ServiceFabricMeshManagementClient providing direct access to the underlying + * auto-generated API implementation, based on Azure REST API. + */ + public ServiceFabricMeshManagementClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/ApplicationsClient.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/ApplicationsClient.java new file mode 100644 index 0000000000000..295cb566f803c --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/ApplicationsClient.java @@ -0,0 +1,174 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.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.servicefabricmesh.fluent.models.ApplicationResourceDescriptionInner; + +/** An instance of this class provides access to all the operations defined in ApplicationsClient. */ +public interface ApplicationsClient { + /** + * Creates an application resource with the specified name, description and properties. If an application resource + * with the same name exists, then it is updated with the specified description and properties. + * + * @param resourceGroupName Azure resource group name. + * @param applicationResourceName The identity of the application. + * @param applicationResourceDescription Description for creating a Application resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this type describes an application resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApplicationResourceDescriptionInner create( + String resourceGroupName, + String applicationResourceName, + ApplicationResourceDescriptionInner applicationResourceDescription); + + /** + * Creates an application resource with the specified name, description and properties. If an application resource + * with the same name exists, then it is updated with the specified description and properties. + * + * @param resourceGroupName Azure resource group name. + * @param applicationResourceName The identity of the application. + * @param applicationResourceDescription Description for creating a Application resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this type describes an application resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createWithResponse( + String resourceGroupName, + String applicationResourceName, + ApplicationResourceDescriptionInner applicationResourceDescription, + Context context); + + /** + * Gets the information about the application resource with the given name. The information include the description + * and other properties of the application. + * + * @param resourceGroupName Azure resource group name. + * @param applicationResourceName The identity of the application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about the application resource with the given name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApplicationResourceDescriptionInner getByResourceGroup(String resourceGroupName, String applicationResourceName); + + /** + * Gets the information about the application resource with the given name. The information include the description + * and other properties of the application. + * + * @param resourceGroupName Azure resource group name. + * @param applicationResourceName The identity of the application. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about the application resource with the given name along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String applicationResourceName, Context context); + + /** + * Deletes the application resource identified by the name. + * + * @param resourceGroupName Azure resource group name. + * @param applicationResourceName The identity of the application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException 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 applicationResourceName); + + /** + * Deletes the application resource identified by the name. + * + * @param resourceGroupName Azure resource group name. + * @param applicationResourceName The identity of the application. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException 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 applicationResourceName, Context context); + + /** + * Gets the information about all application resources in a given resource group. The information include the + * description and other properties of the Application. + * + * @param resourceGroupName Azure resource group name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all application resources in a given resource group as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Gets the information about all application resources in a given resource group. The information include the + * description and other properties of the Application. + * + * @param resourceGroupName Azure resource group name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all application resources in a given resource group as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Gets the information about all application resources in a given resource group. The information include the + * description and other properties of the application. + * + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all application resources in a given resource group as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Gets the information about all application resources in a given resource group. The information include the + * description and other properties of the application. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all application resources in a given resource group as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/CodePackagesClient.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/CodePackagesClient.java new file mode 100644 index 0000000000000..309f3deb4afbf --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/CodePackagesClient.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.servicefabricmesh.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.servicefabricmesh.fluent.models.ContainerLogsInner; + +/** An instance of this class provides access to all the operations defined in CodePackagesClient. */ +public interface CodePackagesClient { + /** + * Gets the logs for the container of the specified code package of the service replica. + * + * @param resourceGroupName Azure resource group name. + * @param applicationResourceName The identity of the application. + * @param serviceResourceName The identity of the service. + * @param replicaName Service Fabric replica name. + * @param codePackageName The name of code package of the service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the logs for the container of the specified code package of the service replica. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ContainerLogsInner getContainerLogs( + String resourceGroupName, + String applicationResourceName, + String serviceResourceName, + String replicaName, + String codePackageName); + + /** + * Gets the logs for the container of the specified code package of the service replica. + * + * @param resourceGroupName Azure resource group name. + * @param applicationResourceName The identity of the application. + * @param serviceResourceName The identity of the service. + * @param replicaName Service Fabric replica name. + * @param codePackageName The name of code package of the service. + * @param tail Number of lines to show from the end of the logs. Default is 100. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the logs for the container of the specified code package of the service replica along with {@link + * Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getContainerLogsWithResponse( + String resourceGroupName, + String applicationResourceName, + String serviceResourceName, + String replicaName, + String codePackageName, + Integer tail, + Context context); +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/GatewaysClient.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/GatewaysClient.java new file mode 100644 index 0000000000000..bc5a6b7d10ac8 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/GatewaysClient.java @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.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.servicefabricmesh.fluent.models.GatewayResourceDescriptionInner; + +/** An instance of this class provides access to all the operations defined in GatewaysClient. */ +public interface GatewaysClient { + /** + * Creates a gateway resource with the specified name, description and properties. If a gateway resource with the + * same name exists, then it is updated with the specified description and properties. Use gateway resources to + * create a gateway for public connectivity for services within your application. + * + * @param resourceGroupName Azure resource group name. + * @param gatewayResourceName The identity of the gateway. + * @param gatewayResourceDescription Description for creating a Gateway resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this type describes a gateway resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GatewayResourceDescriptionInner create( + String resourceGroupName, + String gatewayResourceName, + GatewayResourceDescriptionInner gatewayResourceDescription); + + /** + * Creates a gateway resource with the specified name, description and properties. If a gateway resource with the + * same name exists, then it is updated with the specified description and properties. Use gateway resources to + * create a gateway for public connectivity for services within your application. + * + * @param resourceGroupName Azure resource group name. + * @param gatewayResourceName The identity of the gateway. + * @param gatewayResourceDescription Description for creating a Gateway resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this type describes a gateway resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createWithResponse( + String resourceGroupName, + String gatewayResourceName, + GatewayResourceDescriptionInner gatewayResourceDescription, + Context context); + + /** + * Gets the information about the gateway resource with the given name. The information include the description and + * other properties of the gateway. + * + * @param resourceGroupName Azure resource group name. + * @param gatewayResourceName The identity of the gateway. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about the gateway resource with the given name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GatewayResourceDescriptionInner getByResourceGroup(String resourceGroupName, String gatewayResourceName); + + /** + * Gets the information about the gateway resource with the given name. The information include the description and + * other properties of the gateway. + * + * @param resourceGroupName Azure resource group name. + * @param gatewayResourceName The identity of the gateway. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about the gateway resource with the given name along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String gatewayResourceName, Context context); + + /** + * Deletes the gateway resource identified by the name. + * + * @param resourceGroupName Azure resource group name. + * @param gatewayResourceName The identity of the gateway. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException 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 gatewayResourceName); + + /** + * Deletes the gateway resource identified by the name. + * + * @param resourceGroupName Azure resource group name. + * @param gatewayResourceName The identity of the gateway. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException 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 gatewayResourceName, Context context); + + /** + * Gets the information about all gateway resources in a given resource group. The information include the + * description and other properties of the Gateway. + * + * @param resourceGroupName Azure resource group name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all gateway resources in a given resource group as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Gets the information about all gateway resources in a given resource group. The information include the + * description and other properties of the Gateway. + * + * @param resourceGroupName Azure resource group name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all gateway resources in a given resource group as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Gets the information about all gateway resources in a given resource group. The information include the + * description and other properties of the gateway. + * + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all gateway resources in a given resource group as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Gets the information about all gateway resources in a given resource group. The information include the + * description and other properties of the gateway. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all gateway resources in a given resource group as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/NetworksClient.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/NetworksClient.java new file mode 100644 index 0000000000000..21a3547f7095a --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/NetworksClient.java @@ -0,0 +1,174 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.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.servicefabricmesh.fluent.models.NetworkResourceDescriptionInner; + +/** An instance of this class provides access to all the operations defined in NetworksClient. */ +public interface NetworksClient { + /** + * Creates a network resource with the specified name, description and properties. If a network resource with the + * same name exists, then it is updated with the specified description and properties. + * + * @param resourceGroupName Azure resource group name. + * @param networkResourceName The identity of the network. + * @param networkResourceDescription Description for creating a Network resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this type describes a network resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + NetworkResourceDescriptionInner create( + String resourceGroupName, + String networkResourceName, + NetworkResourceDescriptionInner networkResourceDescription); + + /** + * Creates a network resource with the specified name, description and properties. If a network resource with the + * same name exists, then it is updated with the specified description and properties. + * + * @param resourceGroupName Azure resource group name. + * @param networkResourceName The identity of the network. + * @param networkResourceDescription Description for creating a Network resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this type describes a network resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createWithResponse( + String resourceGroupName, + String networkResourceName, + NetworkResourceDescriptionInner networkResourceDescription, + Context context); + + /** + * Gets the information about the network resource with the given name. The information include the description and + * other properties of the network. + * + * @param resourceGroupName Azure resource group name. + * @param networkResourceName The identity of the network. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about the network resource with the given name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + NetworkResourceDescriptionInner getByResourceGroup(String resourceGroupName, String networkResourceName); + + /** + * Gets the information about the network resource with the given name. The information include the description and + * other properties of the network. + * + * @param resourceGroupName Azure resource group name. + * @param networkResourceName The identity of the network. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about the network resource with the given name along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String networkResourceName, Context context); + + /** + * Deletes the network resource identified by the name. + * + * @param resourceGroupName Azure resource group name. + * @param networkResourceName The identity of the network. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException 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 networkResourceName); + + /** + * Deletes the network resource identified by the name. + * + * @param resourceGroupName Azure resource group name. + * @param networkResourceName The identity of the network. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException 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 networkResourceName, Context context); + + /** + * Gets the information about all network resources in a given resource group. The information include the + * description and other properties of the Network. + * + * @param resourceGroupName Azure resource group name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all network resources in a given resource group as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Gets the information about all network resources in a given resource group. The information include the + * description and other properties of the Network. + * + * @param resourceGroupName Azure resource group name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all network resources in a given resource group as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Gets the information about all network resources in a given resource group. The information include the + * description and other properties of the network. + * + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all network resources in a given resource group as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Gets the information about all network resources in a given resource group. The information include the + * description and other properties of the network. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all network resources in a given resource group as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/OperationsClient.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/OperationsClient.java new file mode 100644 index 0000000000000..597e44b63dd51 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/OperationsClient.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.servicefabricmesh.fluent.models.OperationResultInner; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public interface OperationsClient { + /** + * Lists all the available operations provided by Service Fabric SeaBreeze resource provider. + * + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to list Service Fabric operations as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists all the available operations provided by Service Fabric SeaBreeze resource provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to list Service Fabric operations as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/SecretValuesClient.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/SecretValuesClient.java new file mode 100644 index 0000000000000..927745c55a27f --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/SecretValuesClient.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.servicefabricmesh.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.servicefabricmesh.fluent.models.SecretValueInner; +import com.azure.resourcemanager.servicefabricmesh.fluent.models.SecretValueResourceDescriptionInner; + +/** An instance of this class provides access to all the operations defined in SecretValuesClient. */ +public interface SecretValuesClient { + /** + * Creates a new value of the specified secret resource. The name of the value is typically the version identifier. + * Once created the value cannot be changed. + * + * @param resourceGroupName Azure resource group name. + * @param secretResourceName The name of the secret resource. + * @param secretValueResourceName The name of the secret resource value which is typically the version identifier + * for the value. + * @param secretValueResourceDescription Description for creating a value of a secret resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this type describes a value of a secret resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SecretValueResourceDescriptionInner create( + String resourceGroupName, + String secretResourceName, + String secretValueResourceName, + SecretValueResourceDescriptionInner secretValueResourceDescription); + + /** + * Creates a new value of the specified secret resource. The name of the value is typically the version identifier. + * Once created the value cannot be changed. + * + * @param resourceGroupName Azure resource group name. + * @param secretResourceName The name of the secret resource. + * @param secretValueResourceName The name of the secret resource value which is typically the version identifier + * for the value. + * @param secretValueResourceDescription Description for creating a value of a secret resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this type describes a value of a secret resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createWithResponse( + String resourceGroupName, + String secretResourceName, + String secretValueResourceName, + SecretValueResourceDescriptionInner secretValueResourceDescription, + Context context); + + /** + * Get the information about the specified named secret value resources. The information does not include the actual + * value of the secret. + * + * @param resourceGroupName Azure resource group name. + * @param secretResourceName The name of the secret resource. + * @param secretValueResourceName The name of the secret resource value which is typically the version identifier + * for the value. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about the specified named secret value resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SecretValueResourceDescriptionInner get( + String resourceGroupName, String secretResourceName, String secretValueResourceName); + + /** + * Get the information about the specified named secret value resources. The information does not include the actual + * value of the secret. + * + * @param resourceGroupName Azure resource group name. + * @param secretResourceName The name of the secret resource. + * @param secretValueResourceName The name of the secret resource value which is typically the version identifier + * for the value. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about the specified named secret value resources along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String secretResourceName, String secretValueResourceName, Context context); + + /** + * Deletes the secret value resource identified by the name. The name of the resource is typically the version + * associated with that value. Deletion will fail if the specified value is in use. + * + * @param resourceGroupName Azure resource group name. + * @param secretResourceName The name of the secret resource. + * @param secretValueResourceName The name of the secret resource value which is typically the version identifier + * for the value. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException 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 secretResourceName, String secretValueResourceName); + + /** + * Deletes the secret value resource identified by the name. The name of the resource is typically the version + * associated with that value. Deletion will fail if the specified value is in use. + * + * @param resourceGroupName Azure resource group name. + * @param secretResourceName The name of the secret resource. + * @param secretValueResourceName The name of the secret resource value which is typically the version identifier + * for the value. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException 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 secretResourceName, String secretValueResourceName, Context context); + + /** + * Gets information about all secret value resources of the specified secret resource. The information includes the + * names of the secret value resources, but not the actual values. + * + * @param resourceGroupName Azure resource group name. + * @param secretResourceName The name of the secret resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about all secret value resources of the specified secret resource as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String secretResourceName); + + /** + * Gets information about all secret value resources of the specified secret resource. The information includes the + * names of the secret value resources, but not the actual values. + * + * @param resourceGroupName Azure resource group name. + * @param secretResourceName The name of the secret resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about all secret value resources of the specified secret resource as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String resourceGroupName, String secretResourceName, Context context); + + /** + * Lists the decrypted value of the specified named value of the secret resource. This is a privileged operation. + * + * @param resourceGroupName Azure resource group name. + * @param secretResourceName The name of the secret resource. + * @param secretValueResourceName The name of the secret resource value which is typically the version identifier + * for the value. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this type represents the unencrypted value of the secret. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SecretValueInner listValue(String resourceGroupName, String secretResourceName, String secretValueResourceName); + + /** + * Lists the decrypted value of the specified named value of the secret resource. This is a privileged operation. + * + * @param resourceGroupName Azure resource group name. + * @param secretResourceName The name of the secret resource. + * @param secretValueResourceName The name of the secret resource value which is typically the version identifier + * for the value. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this type represents the unencrypted value of the secret along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listValueWithResponse( + String resourceGroupName, String secretResourceName, String secretValueResourceName, Context context); +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/SecretsClient.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/SecretsClient.java new file mode 100644 index 0000000000000..31c5cfd3b4038 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/SecretsClient.java @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.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.servicefabricmesh.fluent.models.SecretResourceDescriptionInner; + +/** An instance of this class provides access to all the operations defined in SecretsClient. */ +public interface SecretsClient { + /** + * Creates a secret resource with the specified name, description and properties. If a secret resource with the same + * name exists, then it is updated with the specified description and properties. + * + * @param resourceGroupName Azure resource group name. + * @param secretResourceName The name of the secret resource. + * @param secretResourceDescription Description for creating a secret resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this type describes a secret resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SecretResourceDescriptionInner create( + String resourceGroupName, String secretResourceName, SecretResourceDescriptionInner secretResourceDescription); + + /** + * Creates a secret resource with the specified name, description and properties. If a secret resource with the same + * name exists, then it is updated with the specified description and properties. + * + * @param resourceGroupName Azure resource group name. + * @param secretResourceName The name of the secret resource. + * @param secretResourceDescription Description for creating a secret resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this type describes a secret resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createWithResponse( + String resourceGroupName, + String secretResourceName, + SecretResourceDescriptionInner secretResourceDescription, + Context context); + + /** + * Gets the information about the secret resource with the given name. The information include the description and + * other properties of the secret. + * + * @param resourceGroupName Azure resource group name. + * @param secretResourceName The name of the secret resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about the secret resource with the given name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SecretResourceDescriptionInner getByResourceGroup(String resourceGroupName, String secretResourceName); + + /** + * Gets the information about the secret resource with the given name. The information include the description and + * other properties of the secret. + * + * @param resourceGroupName Azure resource group name. + * @param secretResourceName The name of the secret resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about the secret resource with the given name along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String secretResourceName, Context context); + + /** + * Deletes the secret resource identified by the name. + * + * @param resourceGroupName Azure resource group name. + * @param secretResourceName The name of the secret resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException 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 secretResourceName); + + /** + * Deletes the secret resource identified by the name. + * + * @param resourceGroupName Azure resource group name. + * @param secretResourceName The name of the secret resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException 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 secretResourceName, Context context); + + /** + * Gets the information about all secret resources in a given resource group. The information include the + * description and other properties of the Secret. + * + * @param resourceGroupName Azure resource group name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all secret resources in a given resource group as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Gets the information about all secret resources in a given resource group. The information include the + * description and other properties of the Secret. + * + * @param resourceGroupName Azure resource group name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all secret resources in a given resource group as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Gets the information about all secret resources in a given resource group. The information include the + * description and other properties of the secret. + * + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all secret resources in a given resource group as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Gets the information about all secret resources in a given resource group. The information include the + * description and other properties of the secret. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all secret resources in a given resource group as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/ServiceFabricMeshManagementClient.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/ServiceFabricMeshManagementClient.java new file mode 100644 index 0000000000000..9936bf4518c50 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/ServiceFabricMeshManagementClient.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** The interface for ServiceFabricMeshManagementClient class. */ +public interface ServiceFabricMeshManagementClient { + /** + * Gets The customer subscription identifier. + * + * @return the subscriptionId value. + */ + String getSubscriptionId(); + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + String getApiVersion(); + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + HttpPipeline getHttpPipeline(); + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + Duration getDefaultPollInterval(); + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); + + /** + * Gets the SecretsClient object to access its operations. + * + * @return the SecretsClient object. + */ + SecretsClient getSecrets(); + + /** + * Gets the SecretValuesClient object to access its operations. + * + * @return the SecretValuesClient object. + */ + SecretValuesClient getSecretValues(); + + /** + * Gets the VolumesClient object to access its operations. + * + * @return the VolumesClient object. + */ + VolumesClient getVolumes(); + + /** + * Gets the NetworksClient object to access its operations. + * + * @return the NetworksClient object. + */ + NetworksClient getNetworks(); + + /** + * Gets the GatewaysClient object to access its operations. + * + * @return the GatewaysClient object. + */ + GatewaysClient getGateways(); + + /** + * Gets the ApplicationsClient object to access its operations. + * + * @return the ApplicationsClient object. + */ + ApplicationsClient getApplications(); + + /** + * Gets the ServicesClient object to access its operations. + * + * @return the ServicesClient object. + */ + ServicesClient getServices(); + + /** + * Gets the ServiceReplicasClient object to access its operations. + * + * @return the ServiceReplicasClient object. + */ + ServiceReplicasClient getServiceReplicas(); + + /** + * Gets the CodePackagesClient object to access its operations. + * + * @return the CodePackagesClient object. + */ + CodePackagesClient getCodePackages(); +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/ServiceReplicasClient.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/ServiceReplicasClient.java new file mode 100644 index 0000000000000..e4dbe4ee2a9d5 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/ServiceReplicasClient.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.servicefabricmesh.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.servicefabricmesh.fluent.models.ServiceReplicaDescriptionInner; + +/** An instance of this class provides access to all the operations defined in ServiceReplicasClient. */ +public interface ServiceReplicasClient { + /** + * Gets the information about the service replica with the given name. The information include the description and + * other properties of the service replica. + * + * @param resourceGroupName Azure resource group name. + * @param applicationResourceName The identity of the application. + * @param serviceResourceName The identity of the service. + * @param replicaName Service Fabric replica name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about the service replica with the given name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServiceReplicaDescriptionInner get( + String resourceGroupName, String applicationResourceName, String serviceResourceName, String replicaName); + + /** + * Gets the information about the service replica with the given name. The information include the description and + * other properties of the service replica. + * + * @param resourceGroupName Azure resource group name. + * @param applicationResourceName The identity of the application. + * @param serviceResourceName The identity of the service. + * @param replicaName Service Fabric replica name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about the service replica with the given name along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String applicationResourceName, + String serviceResourceName, + String replicaName, + Context context); + + /** + * Gets the information about all replicas of a given service of an application. The information includes the + * runtime properties of the replica instance. + * + * @param resourceGroupName Azure resource group name. + * @param applicationResourceName The identity of the application. + * @param serviceResourceName The identity of the service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all replicas of a given service of an application as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String resourceGroupName, String applicationResourceName, String serviceResourceName); + + /** + * Gets the information about all replicas of a given service of an application. The information includes the + * runtime properties of the replica instance. + * + * @param resourceGroupName Azure resource group name. + * @param applicationResourceName The identity of the application. + * @param serviceResourceName The identity of the service. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all replicas of a given service of an application as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String resourceGroupName, String applicationResourceName, String serviceResourceName, Context context); +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/ServicesClient.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/ServicesClient.java new file mode 100644 index 0000000000000..3c30f6265622b --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/ServicesClient.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.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.servicefabricmesh.fluent.models.ServiceResourceDescriptionInner; + +/** An instance of this class provides access to all the operations defined in ServicesClient. */ +public interface ServicesClient { + /** + * Gets the information about the service resource with the given name. The information include the description and + * other properties of the service. + * + * @param resourceGroupName Azure resource group name. + * @param applicationResourceName The identity of the application. + * @param serviceResourceName The identity of the service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about the service resource with the given name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServiceResourceDescriptionInner get( + String resourceGroupName, String applicationResourceName, String serviceResourceName); + + /** + * Gets the information about the service resource with the given name. The information include the description and + * other properties of the service. + * + * @param resourceGroupName Azure resource group name. + * @param applicationResourceName The identity of the application. + * @param serviceResourceName The identity of the service. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about the service resource with the given name along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String applicationResourceName, String serviceResourceName, Context context); + + /** + * Gets the information about all services of an application resource. The information include the description and + * other properties of the Service. + * + * @param resourceGroupName Azure resource group name. + * @param applicationResourceName The identity of the application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all services of an application resource as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String applicationResourceName); + + /** + * Gets the information about all services of an application resource. The information include the description and + * other properties of the Service. + * + * @param resourceGroupName Azure resource group name. + * @param applicationResourceName The identity of the application. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all services of an application resource as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String resourceGroupName, String applicationResourceName, Context context); +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/VolumesClient.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/VolumesClient.java new file mode 100644 index 0000000000000..6b271e95c5ff5 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/VolumesClient.java @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.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.servicefabricmesh.fluent.models.VolumeResourceDescriptionInner; + +/** An instance of this class provides access to all the operations defined in VolumesClient. */ +public interface VolumesClient { + /** + * Creates a volume resource with the specified name, description and properties. If a volume resource with the same + * name exists, then it is updated with the specified description and properties. + * + * @param resourceGroupName Azure resource group name. + * @param volumeResourceName The identity of the volume. + * @param volumeResourceDescription Description for creating a Volume resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this type describes a volume resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VolumeResourceDescriptionInner create( + String resourceGroupName, String volumeResourceName, VolumeResourceDescriptionInner volumeResourceDescription); + + /** + * Creates a volume resource with the specified name, description and properties. If a volume resource with the same + * name exists, then it is updated with the specified description and properties. + * + * @param resourceGroupName Azure resource group name. + * @param volumeResourceName The identity of the volume. + * @param volumeResourceDescription Description for creating a Volume resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this type describes a volume resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createWithResponse( + String resourceGroupName, + String volumeResourceName, + VolumeResourceDescriptionInner volumeResourceDescription, + Context context); + + /** + * Gets the information about the volume resource with the given name. The information include the description and + * other properties of the volume. + * + * @param resourceGroupName Azure resource group name. + * @param volumeResourceName The identity of the volume. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about the volume resource with the given name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VolumeResourceDescriptionInner getByResourceGroup(String resourceGroupName, String volumeResourceName); + + /** + * Gets the information about the volume resource with the given name. The information include the description and + * other properties of the volume. + * + * @param resourceGroupName Azure resource group name. + * @param volumeResourceName The identity of the volume. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about the volume resource with the given name along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String volumeResourceName, Context context); + + /** + * Deletes the volume resource identified by the name. + * + * @param resourceGroupName Azure resource group name. + * @param volumeResourceName The identity of the volume. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException 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 volumeResourceName); + + /** + * Deletes the volume resource identified by the name. + * + * @param resourceGroupName Azure resource group name. + * @param volumeResourceName The identity of the volume. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException 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 volumeResourceName, Context context); + + /** + * Gets the information about all volume resources in a given resource group. The information include the + * description and other properties of the Volume. + * + * @param resourceGroupName Azure resource group name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all volume resources in a given resource group as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Gets the information about all volume resources in a given resource group. The information include the + * description and other properties of the Volume. + * + * @param resourceGroupName Azure resource group name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all volume resources in a given resource group as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Gets the information about all volume resources in a given resource group. The information include the + * description and other properties of the volume. + * + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all volume resources in a given resource group as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Gets the information about all volume resources in a given resource group. The information include the + * description and other properties of the volume. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all volume resources in a given resource group as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/models/ApplicationResourceDescriptionInner.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/models/ApplicationResourceDescriptionInner.java new file mode 100644 index 0000000000000..4a740675cb0c0 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/models/ApplicationResourceDescriptionInner.java @@ -0,0 +1,219 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.servicefabricmesh.models.DiagnosticsDescription; +import com.azure.resourcemanager.servicefabricmesh.models.HealthState; +import com.azure.resourcemanager.servicefabricmesh.models.ResourceStatus; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** This type describes an application resource. */ +@Fluent +public final class ApplicationResourceDescriptionInner extends Resource { + /* + * This type describes properties of an application resource. + */ + @JsonProperty(value = "properties", required = true) + private ApplicationResourceProperties innerProperties = new ApplicationResourceProperties(); + + /** + * Get the innerProperties property: This type describes properties of an application resource. + * + * @return the innerProperties value. + */ + private ApplicationResourceProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public ApplicationResourceDescriptionInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public ApplicationResourceDescriptionInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the description property: User readable description of the application. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Set the description property: User readable description of the application. + * + * @param description the description value to set. + * @return the ApplicationResourceDescriptionInner object itself. + */ + public ApplicationResourceDescriptionInner withDescription(String description) { + if (this.innerProperties() == null) { + this.innerProperties = new ApplicationResourceProperties(); + } + this.innerProperties().withDescription(description); + return this; + } + + /** + * Get the services property: Describes the services in the application. This property is used to create or modify + * services of the application. On get only the name of the service is returned. The service description can be + * obtained by querying for the service resource. + * + * @return the services value. + */ + public List services() { + return this.innerProperties() == null ? null : this.innerProperties().services(); + } + + /** + * Set the services property: Describes the services in the application. This property is used to create or modify + * services of the application. On get only the name of the service is returned. The service description can be + * obtained by querying for the service resource. + * + * @param services the services value to set. + * @return the ApplicationResourceDescriptionInner object itself. + */ + public ApplicationResourceDescriptionInner withServices(List services) { + if (this.innerProperties() == null) { + this.innerProperties = new ApplicationResourceProperties(); + } + this.innerProperties().withServices(services); + return this; + } + + /** + * Get the diagnostics property: Describes the diagnostics definition and usage for an application resource. + * + * @return the diagnostics value. + */ + public DiagnosticsDescription diagnostics() { + return this.innerProperties() == null ? null : this.innerProperties().diagnostics(); + } + + /** + * Set the diagnostics property: Describes the diagnostics definition and usage for an application resource. + * + * @param diagnostics the diagnostics value to set. + * @return the ApplicationResourceDescriptionInner object itself. + */ + public ApplicationResourceDescriptionInner withDiagnostics(DiagnosticsDescription diagnostics) { + if (this.innerProperties() == null) { + this.innerProperties = new ApplicationResourceProperties(); + } + this.innerProperties().withDiagnostics(diagnostics); + return this; + } + + /** + * Get the debugParams property: Internal - used by Visual Studio to setup the debugging session on the local + * development environment. + * + * @return the debugParams value. + */ + public String debugParams() { + return this.innerProperties() == null ? null : this.innerProperties().debugParams(); + } + + /** + * Set the debugParams property: Internal - used by Visual Studio to setup the debugging session on the local + * development environment. + * + * @param debugParams the debugParams value to set. + * @return the ApplicationResourceDescriptionInner object itself. + */ + public ApplicationResourceDescriptionInner withDebugParams(String debugParams) { + if (this.innerProperties() == null) { + this.innerProperties = new ApplicationResourceProperties(); + } + this.innerProperties().withDebugParams(debugParams); + return this; + } + + /** + * Get the serviceNames property: Names of the services in the application. + * + * @return the serviceNames value. + */ + public List serviceNames() { + return this.innerProperties() == null ? null : this.innerProperties().serviceNames(); + } + + /** + * Get the status property: Status of the application. + * + * @return the status value. + */ + public ResourceStatus status() { + return this.innerProperties() == null ? null : this.innerProperties().status(); + } + + /** + * Get the statusDetails property: Gives additional information about the current status of the application. + * + * @return the statusDetails value. + */ + public String statusDetails() { + return this.innerProperties() == null ? null : this.innerProperties().statusDetails(); + } + + /** + * Get the healthState property: Describes the health state of an application resource. + * + * @return the healthState value. + */ + public HealthState healthState() { + return this.innerProperties() == null ? null : this.innerProperties().healthState(); + } + + /** + * Get the unhealthyEvaluation property: When the application's health state is not 'Ok', this additional details + * from service fabric Health Manager for the user to know why the application is marked unhealthy. + * + * @return the unhealthyEvaluation value. + */ + public String unhealthyEvaluation() { + return this.innerProperties() == null ? null : this.innerProperties().unhealthyEvaluation(); + } + + /** + * Get the provisioningState property: State of the resource. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property innerProperties in model ApplicationResourceDescriptionInner")); + } else { + innerProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ApplicationResourceDescriptionInner.class); +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/models/ApplicationResourceProperties.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/models/ApplicationResourceProperties.java new file mode 100644 index 0000000000000..246b519d7ecd5 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/models/ApplicationResourceProperties.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.servicefabricmesh.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.servicefabricmesh.models.DiagnosticsDescription; +import com.azure.resourcemanager.servicefabricmesh.models.HealthState; +import com.azure.resourcemanager.servicefabricmesh.models.ProvisionedResourceProperties; +import com.azure.resourcemanager.servicefabricmesh.models.ResourceStatus; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** This type describes properties of an application resource. */ +@Fluent +public final class ApplicationResourceProperties extends ProvisionedResourceProperties { + /* + * User readable description of the application. + */ + @JsonProperty(value = "description") + private String description; + + /* + * Describes the services in the application. This property is used to + * create or modify services of the application. On get only the name of + * the service is returned. The service description can be obtained by + * querying for the service resource. + */ + @JsonProperty(value = "services") + private List services; + + /* + * Describes the diagnostics definition and usage for an application + * resource. + */ + @JsonProperty(value = "diagnostics") + private DiagnosticsDescription diagnostics; + + /* + * Internal - used by Visual Studio to setup the debugging session on the + * local development environment. + */ + @JsonProperty(value = "debugParams") + private String debugParams; + + /* + * Names of the services in the application. + */ + @JsonProperty(value = "serviceNames", access = JsonProperty.Access.WRITE_ONLY) + private List serviceNames; + + /* + * Status of the application. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private ResourceStatus status; + + /* + * Gives additional information about the current status of the + * application. + */ + @JsonProperty(value = "statusDetails", access = JsonProperty.Access.WRITE_ONLY) + private String statusDetails; + + /* + * Describes the health state of an application resource. + */ + @JsonProperty(value = "healthState", access = JsonProperty.Access.WRITE_ONLY) + private HealthState healthState; + + /* + * When the application's health state is not 'Ok', this additional details + * from service fabric Health Manager for the user to know why the + * application is marked unhealthy. + */ + @JsonProperty(value = "unhealthyEvaluation", access = JsonProperty.Access.WRITE_ONLY) + private String unhealthyEvaluation; + + /** + * Get the description property: User readable description of the application. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: User readable description of the application. + * + * @param description the description value to set. + * @return the ApplicationResourceProperties object itself. + */ + public ApplicationResourceProperties withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the services property: Describes the services in the application. This property is used to create or modify + * services of the application. On get only the name of the service is returned. The service description can be + * obtained by querying for the service resource. + * + * @return the services value. + */ + public List services() { + return this.services; + } + + /** + * Set the services property: Describes the services in the application. This property is used to create or modify + * services of the application. On get only the name of the service is returned. The service description can be + * obtained by querying for the service resource. + * + * @param services the services value to set. + * @return the ApplicationResourceProperties object itself. + */ + public ApplicationResourceProperties withServices(List services) { + this.services = services; + return this; + } + + /** + * Get the diagnostics property: Describes the diagnostics definition and usage for an application resource. + * + * @return the diagnostics value. + */ + public DiagnosticsDescription diagnostics() { + return this.diagnostics; + } + + /** + * Set the diagnostics property: Describes the diagnostics definition and usage for an application resource. + * + * @param diagnostics the diagnostics value to set. + * @return the ApplicationResourceProperties object itself. + */ + public ApplicationResourceProperties withDiagnostics(DiagnosticsDescription diagnostics) { + this.diagnostics = diagnostics; + return this; + } + + /** + * Get the debugParams property: Internal - used by Visual Studio to setup the debugging session on the local + * development environment. + * + * @return the debugParams value. + */ + public String debugParams() { + return this.debugParams; + } + + /** + * Set the debugParams property: Internal - used by Visual Studio to setup the debugging session on the local + * development environment. + * + * @param debugParams the debugParams value to set. + * @return the ApplicationResourceProperties object itself. + */ + public ApplicationResourceProperties withDebugParams(String debugParams) { + this.debugParams = debugParams; + return this; + } + + /** + * Get the serviceNames property: Names of the services in the application. + * + * @return the serviceNames value. + */ + public List serviceNames() { + return this.serviceNames; + } + + /** + * Get the status property: Status of the application. + * + * @return the status value. + */ + public ResourceStatus status() { + return this.status; + } + + /** + * Get the statusDetails property: Gives additional information about the current status of the application. + * + * @return the statusDetails value. + */ + public String statusDetails() { + return this.statusDetails; + } + + /** + * Get the healthState property: Describes the health state of an application resource. + * + * @return the healthState value. + */ + public HealthState healthState() { + return this.healthState; + } + + /** + * Get the unhealthyEvaluation property: When the application's health state is not 'Ok', this additional details + * from service fabric Health Manager for the user to know why the application is marked unhealthy. + * + * @return the unhealthyEvaluation value. + */ + public String unhealthyEvaluation() { + return this.unhealthyEvaluation; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (services() != null) { + services().forEach(e -> e.validate()); + } + if (diagnostics() != null) { + diagnostics().validate(); + } + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/models/ContainerLogsInner.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/models/ContainerLogsInner.java new file mode 100644 index 0000000000000..2bc525b3b83fb --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/models/ContainerLogsInner.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.servicefabricmesh.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Container logs. */ +@Fluent +public final class ContainerLogsInner { + /* + * Container logs. + */ + @JsonProperty(value = "content") + private String content; + + /** + * Get the content property: Container logs. + * + * @return the content value. + */ + public String content() { + return this.content; + } + + /** + * Set the content property: Container logs. + * + * @param content the content value to set. + * @return the ContainerLogsInner object itself. + */ + public ContainerLogsInner withContent(String content) { + this.content = content; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/models/GatewayResourceDescriptionInner.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/models/GatewayResourceDescriptionInner.java new file mode 100644 index 0000000000000..73dca00c302f7 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/models/GatewayResourceDescriptionInner.java @@ -0,0 +1,219 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.servicefabricmesh.models.HttpConfig; +import com.azure.resourcemanager.servicefabricmesh.models.NetworkRef; +import com.azure.resourcemanager.servicefabricmesh.models.ResourceStatus; +import com.azure.resourcemanager.servicefabricmesh.models.TcpConfig; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** This type describes a gateway resource. */ +@Fluent +public final class GatewayResourceDescriptionInner extends Resource { + /* + * This type describes properties of a gateway resource. + */ + @JsonProperty(value = "properties", required = true) + private GatewayResourceProperties innerProperties = new GatewayResourceProperties(); + + /** + * Get the innerProperties property: This type describes properties of a gateway resource. + * + * @return the innerProperties value. + */ + private GatewayResourceProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public GatewayResourceDescriptionInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public GatewayResourceDescriptionInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the description property: User readable description of the gateway. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Set the description property: User readable description of the gateway. + * + * @param description the description value to set. + * @return the GatewayResourceDescriptionInner object itself. + */ + public GatewayResourceDescriptionInner withDescription(String description) { + if (this.innerProperties() == null) { + this.innerProperties = new GatewayResourceProperties(); + } + this.innerProperties().withDescription(description); + return this; + } + + /** + * Get the sourceNetwork property: Network the gateway should listen on for requests. + * + * @return the sourceNetwork value. + */ + public NetworkRef sourceNetwork() { + return this.innerProperties() == null ? null : this.innerProperties().sourceNetwork(); + } + + /** + * Set the sourceNetwork property: Network the gateway should listen on for requests. + * + * @param sourceNetwork the sourceNetwork value to set. + * @return the GatewayResourceDescriptionInner object itself. + */ + public GatewayResourceDescriptionInner withSourceNetwork(NetworkRef sourceNetwork) { + if (this.innerProperties() == null) { + this.innerProperties = new GatewayResourceProperties(); + } + this.innerProperties().withSourceNetwork(sourceNetwork); + return this; + } + + /** + * Get the destinationNetwork property: Network that the Application is using. + * + * @return the destinationNetwork value. + */ + public NetworkRef destinationNetwork() { + return this.innerProperties() == null ? null : this.innerProperties().destinationNetwork(); + } + + /** + * Set the destinationNetwork property: Network that the Application is using. + * + * @param destinationNetwork the destinationNetwork value to set. + * @return the GatewayResourceDescriptionInner object itself. + */ + public GatewayResourceDescriptionInner withDestinationNetwork(NetworkRef destinationNetwork) { + if (this.innerProperties() == null) { + this.innerProperties = new GatewayResourceProperties(); + } + this.innerProperties().withDestinationNetwork(destinationNetwork); + return this; + } + + /** + * Get the tcp property: Configuration for tcp connectivity for this gateway. + * + * @return the tcp value. + */ + public List tcp() { + return this.innerProperties() == null ? null : this.innerProperties().tcp(); + } + + /** + * Set the tcp property: Configuration for tcp connectivity for this gateway. + * + * @param tcp the tcp value to set. + * @return the GatewayResourceDescriptionInner object itself. + */ + public GatewayResourceDescriptionInner withTcp(List tcp) { + if (this.innerProperties() == null) { + this.innerProperties = new GatewayResourceProperties(); + } + this.innerProperties().withTcp(tcp); + return this; + } + + /** + * Get the http property: Configuration for http connectivity for this gateway. + * + * @return the http value. + */ + public List http() { + return this.innerProperties() == null ? null : this.innerProperties().http(); + } + + /** + * Set the http property: Configuration for http connectivity for this gateway. + * + * @param http the http value to set. + * @return the GatewayResourceDescriptionInner object itself. + */ + public GatewayResourceDescriptionInner withHttp(List http) { + if (this.innerProperties() == null) { + this.innerProperties = new GatewayResourceProperties(); + } + this.innerProperties().withHttp(http); + return this; + } + + /** + * Get the status property: Status of the resource. + * + * @return the status value. + */ + public ResourceStatus status() { + return this.innerProperties() == null ? null : this.innerProperties().status(); + } + + /** + * Get the statusDetails property: Gives additional information about the current status of the gateway. + * + * @return the statusDetails value. + */ + public String statusDetails() { + return this.innerProperties() == null ? null : this.innerProperties().statusDetails(); + } + + /** + * Get the ipAddress property: IP address of the gateway. This is populated in the response and is ignored for + * incoming requests. + * + * @return the ipAddress value. + */ + public String ipAddress() { + return this.innerProperties() == null ? null : this.innerProperties().ipAddress(); + } + + /** + * Get the provisioningState property: State of the resource. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property innerProperties in model GatewayResourceDescriptionInner")); + } else { + innerProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(GatewayResourceDescriptionInner.class); +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/models/GatewayResourceProperties.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/models/GatewayResourceProperties.java new file mode 100644 index 0000000000000..1dee55efb55c0 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/models/GatewayResourceProperties.java @@ -0,0 +1,230 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.servicefabricmesh.models.HttpConfig; +import com.azure.resourcemanager.servicefabricmesh.models.NetworkRef; +import com.azure.resourcemanager.servicefabricmesh.models.ProvisionedResourceProperties; +import com.azure.resourcemanager.servicefabricmesh.models.ResourceStatus; +import com.azure.resourcemanager.servicefabricmesh.models.TcpConfig; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** This type describes properties of a gateway resource. */ +@Fluent +public final class GatewayResourceProperties extends ProvisionedResourceProperties { + /* + * User readable description of the gateway. + */ + @JsonProperty(value = "description") + private String description; + + /* + * Network the gateway should listen on for requests. + */ + @JsonProperty(value = "sourceNetwork", required = true) + private NetworkRef sourceNetwork; + + /* + * Network that the Application is using. + */ + @JsonProperty(value = "destinationNetwork", required = true) + private NetworkRef destinationNetwork; + + /* + * Configuration for tcp connectivity for this gateway. + */ + @JsonProperty(value = "tcp") + private List tcp; + + /* + * Configuration for http connectivity for this gateway. + */ + @JsonProperty(value = "http") + private List http; + + /* + * Status of the resource. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private ResourceStatus status; + + /* + * Gives additional information about the current status of the gateway. + */ + @JsonProperty(value = "statusDetails", access = JsonProperty.Access.WRITE_ONLY) + private String statusDetails; + + /* + * IP address of the gateway. This is populated in the response and is + * ignored for incoming requests. + */ + @JsonProperty(value = "ipAddress", access = JsonProperty.Access.WRITE_ONLY) + private String ipAddress; + + /** + * Get the description property: User readable description of the gateway. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: User readable description of the gateway. + * + * @param description the description value to set. + * @return the GatewayResourceProperties object itself. + */ + public GatewayResourceProperties withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the sourceNetwork property: Network the gateway should listen on for requests. + * + * @return the sourceNetwork value. + */ + public NetworkRef sourceNetwork() { + return this.sourceNetwork; + } + + /** + * Set the sourceNetwork property: Network the gateway should listen on for requests. + * + * @param sourceNetwork the sourceNetwork value to set. + * @return the GatewayResourceProperties object itself. + */ + public GatewayResourceProperties withSourceNetwork(NetworkRef sourceNetwork) { + this.sourceNetwork = sourceNetwork; + return this; + } + + /** + * Get the destinationNetwork property: Network that the Application is using. + * + * @return the destinationNetwork value. + */ + public NetworkRef destinationNetwork() { + return this.destinationNetwork; + } + + /** + * Set the destinationNetwork property: Network that the Application is using. + * + * @param destinationNetwork the destinationNetwork value to set. + * @return the GatewayResourceProperties object itself. + */ + public GatewayResourceProperties withDestinationNetwork(NetworkRef destinationNetwork) { + this.destinationNetwork = destinationNetwork; + return this; + } + + /** + * Get the tcp property: Configuration for tcp connectivity for this gateway. + * + * @return the tcp value. + */ + public List tcp() { + return this.tcp; + } + + /** + * Set the tcp property: Configuration for tcp connectivity for this gateway. + * + * @param tcp the tcp value to set. + * @return the GatewayResourceProperties object itself. + */ + public GatewayResourceProperties withTcp(List tcp) { + this.tcp = tcp; + return this; + } + + /** + * Get the http property: Configuration for http connectivity for this gateway. + * + * @return the http value. + */ + public List http() { + return this.http; + } + + /** + * Set the http property: Configuration for http connectivity for this gateway. + * + * @param http the http value to set. + * @return the GatewayResourceProperties object itself. + */ + public GatewayResourceProperties withHttp(List http) { + this.http = http; + return this; + } + + /** + * Get the status property: Status of the resource. + * + * @return the status value. + */ + public ResourceStatus status() { + return this.status; + } + + /** + * Get the statusDetails property: Gives additional information about the current status of the gateway. + * + * @return the statusDetails value. + */ + public String statusDetails() { + return this.statusDetails; + } + + /** + * Get the ipAddress property: IP address of the gateway. This is populated in the response and is ignored for + * incoming requests. + * + * @return the ipAddress value. + */ + public String ipAddress() { + return this.ipAddress; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (sourceNetwork() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property sourceNetwork in model GatewayResourceProperties")); + } else { + sourceNetwork().validate(); + } + if (destinationNetwork() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property destinationNetwork in model GatewayResourceProperties")); + } else { + destinationNetwork().validate(); + } + if (tcp() != null) { + tcp().forEach(e -> e.validate()); + } + if (http() != null) { + http().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(GatewayResourceProperties.class); +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/models/NetworkResourceDescriptionInner.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/models/NetworkResourceDescriptionInner.java new file mode 100644 index 0000000000000..b52a136f65316 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/models/NetworkResourceDescriptionInner.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.servicefabricmesh.models.NetworkResourceProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** This type describes a network resource. */ +@Fluent +public final class NetworkResourceDescriptionInner extends Resource { + /* + * Describes properties of a network resource. + */ + @JsonProperty(value = "properties", required = true) + private NetworkResourceProperties properties; + + /** + * Get the properties property: Describes properties of a network resource. + * + * @return the properties value. + */ + public NetworkResourceProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Describes properties of a network resource. + * + * @param properties the properties value to set. + * @return the NetworkResourceDescriptionInner object itself. + */ + public NetworkResourceDescriptionInner withProperties(NetworkResourceProperties properties) { + this.properties = properties; + return this; + } + + /** {@inheritDoc} */ + @Override + public NetworkResourceDescriptionInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public NetworkResourceDescriptionInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property properties in model NetworkResourceDescriptionInner")); + } else { + properties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(NetworkResourceDescriptionInner.class); +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/models/OperationResultInner.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/models/OperationResultInner.java new file mode 100644 index 0000000000000..8f360e09657c8 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/models/OperationResultInner.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.servicefabricmesh.models.AvailableOperationDisplay; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** List of operations available at the listed Azure resource provider. */ +@Fluent +public final class OperationResultInner { + /* + * The name of the operation. + */ + @JsonProperty(value = "name") + private String name; + + /* + * The object that represents the operation. + */ + @JsonProperty(value = "display") + private AvailableOperationDisplay display; + + /* + * Origin result + */ + @JsonProperty(value = "origin") + private String origin; + + /* + * The URL to use for getting the next set of results. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the name property: The name of the operation. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the operation. + * + * @param name the name value to set. + * @return the OperationResultInner object itself. + */ + public OperationResultInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the display property: The object that represents the operation. + * + * @return the display value. + */ + public AvailableOperationDisplay display() { + return this.display; + } + + /** + * Set the display property: The object that represents the operation. + * + * @param display the display value to set. + * @return the OperationResultInner object itself. + */ + public OperationResultInner withDisplay(AvailableOperationDisplay display) { + this.display = display; + return this; + } + + /** + * Get the origin property: Origin result. + * + * @return the origin value. + */ + public String origin() { + return this.origin; + } + + /** + * Set the origin property: Origin result. + * + * @param origin the origin value to set. + * @return the OperationResultInner object itself. + */ + public OperationResultInner withOrigin(String origin) { + this.origin = origin; + return this; + } + + /** + * Get the nextLink property: The URL to use for getting the next set of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The URL to use for getting the next set of results. + * + * @param nextLink the nextLink value to set. + * @return the OperationResultInner object itself. + */ + public OperationResultInner withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (display() != null) { + display().validate(); + } + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/models/SecretResourceDescriptionInner.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/models/SecretResourceDescriptionInner.java new file mode 100644 index 0000000000000..bcd3462927788 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/models/SecretResourceDescriptionInner.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.servicefabricmesh.models.SecretResourceProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** This type describes a secret resource. */ +@Fluent +public final class SecretResourceDescriptionInner extends Resource { + /* + * Describes the properties of a secret resource. + */ + @JsonProperty(value = "properties", required = true) + private SecretResourceProperties properties; + + /** + * Get the properties property: Describes the properties of a secret resource. + * + * @return the properties value. + */ + public SecretResourceProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Describes the properties of a secret resource. + * + * @param properties the properties value to set. + * @return the SecretResourceDescriptionInner object itself. + */ + public SecretResourceDescriptionInner withProperties(SecretResourceProperties properties) { + this.properties = properties; + return this; + } + + /** {@inheritDoc} */ + @Override + public SecretResourceDescriptionInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public SecretResourceDescriptionInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property properties in model SecretResourceDescriptionInner")); + } else { + properties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SecretResourceDescriptionInner.class); +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/models/SecretValueInner.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/models/SecretValueInner.java new file mode 100644 index 0000000000000..b5b39806543a5 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/models/SecretValueInner.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.servicefabricmesh.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** This type represents the unencrypted value of the secret. */ +@Fluent +public final class SecretValueInner { + /* + * The actual value of the secret. + */ + @JsonProperty(value = "value") + private String value; + + /** + * Get the value property: The actual value of the secret. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Set the value property: The actual value of the secret. + * + * @param value the value value to set. + * @return the SecretValueInner object itself. + */ + public SecretValueInner 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/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/models/SecretValueResourceDescriptionInner.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/models/SecretValueResourceDescriptionInner.java new file mode 100644 index 0000000000000..23810eb44e4bb --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/models/SecretValueResourceDescriptionInner.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** + * This type describes a value of a secret resource. The name of this resource is the version identifier corresponding + * to this secret value. + */ +@Fluent +public final class SecretValueResourceDescriptionInner extends Resource { + /* + * This type describes properties of a secret value resource. + */ + @JsonProperty(value = "properties", required = true) + private SecretValueResourceProperties innerProperties = new SecretValueResourceProperties(); + + /** + * Get the innerProperties property: This type describes properties of a secret value resource. + * + * @return the innerProperties value. + */ + private SecretValueResourceProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public SecretValueResourceDescriptionInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public SecretValueResourceDescriptionInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the value property: The actual value of the secret. + * + * @return the value value. + */ + public String value() { + return this.innerProperties() == null ? null : this.innerProperties().value(); + } + + /** + * Set the value property: The actual value of the secret. + * + * @param value the value value to set. + * @return the SecretValueResourceDescriptionInner object itself. + */ + public SecretValueResourceDescriptionInner withValue(String value) { + if (this.innerProperties() == null) { + this.innerProperties = new SecretValueResourceProperties(); + } + this.innerProperties().withValue(value); + return this; + } + + /** + * Get the provisioningState property: State of the resource. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property innerProperties in model SecretValueResourceDescriptionInner")); + } else { + innerProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SecretValueResourceDescriptionInner.class); +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/models/SecretValueResourceProperties.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/models/SecretValueResourceProperties.java new file mode 100644 index 0000000000000..e161c93ead15c --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/models/SecretValueResourceProperties.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.servicefabricmesh.models.ProvisionedResourceProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** This type describes properties of a secret value resource. */ +@Fluent +public final class SecretValueResourceProperties extends ProvisionedResourceProperties { + /* + * The actual value of the secret. + */ + @JsonProperty(value = "value") + private String value; + + /** + * Get the value property: The actual value of the secret. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Set the value property: The actual value of the secret. + * + * @param value the value value to set. + * @return the SecretValueResourceProperties object itself. + */ + public SecretValueResourceProperties withValue(String value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/models/ServiceReplicaDescriptionInner.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/models/ServiceReplicaDescriptionInner.java new file mode 100644 index 0000000000000..331092575b7f4 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/models/ServiceReplicaDescriptionInner.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.servicefabricmesh.models.ContainerCodePackageProperties; +import com.azure.resourcemanager.servicefabricmesh.models.DiagnosticsRef; +import com.azure.resourcemanager.servicefabricmesh.models.NetworkRef; +import com.azure.resourcemanager.servicefabricmesh.models.OperatingSystemType; +import com.azure.resourcemanager.servicefabricmesh.models.ServiceReplicaProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Describes a replica of a service resource. */ +@Fluent +public final class ServiceReplicaDescriptionInner extends ServiceReplicaProperties { + /* + * Name of the replica. + */ + @JsonProperty(value = "replicaName", required = true) + private String replicaName; + + /** + * Get the replicaName property: Name of the replica. + * + * @return the replicaName value. + */ + public String replicaName() { + return this.replicaName; + } + + /** + * Set the replicaName property: Name of the replica. + * + * @param replicaName the replicaName value to set. + * @return the ServiceReplicaDescriptionInner object itself. + */ + public ServiceReplicaDescriptionInner withReplicaName(String replicaName) { + this.replicaName = replicaName; + return this; + } + + /** {@inheritDoc} */ + @Override + public ServiceReplicaDescriptionInner withOsType(OperatingSystemType osType) { + super.withOsType(osType); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServiceReplicaDescriptionInner withCodePackages(List codePackages) { + super.withCodePackages(codePackages); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServiceReplicaDescriptionInner withNetworkRefs(List networkRefs) { + super.withNetworkRefs(networkRefs); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServiceReplicaDescriptionInner withDiagnostics(DiagnosticsRef diagnostics) { + super.withDiagnostics(diagnostics); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (replicaName() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property replicaName in model ServiceReplicaDescriptionInner")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ServiceReplicaDescriptionInner.class); +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/models/ServiceResourceDescriptionInner.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/models/ServiceResourceDescriptionInner.java new file mode 100644 index 0000000000000..dd28156accace --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/models/ServiceResourceDescriptionInner.java @@ -0,0 +1,275 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.servicefabricmesh.models.AutoScalingPolicy; +import com.azure.resourcemanager.servicefabricmesh.models.ContainerCodePackageProperties; +import com.azure.resourcemanager.servicefabricmesh.models.DiagnosticsRef; +import com.azure.resourcemanager.servicefabricmesh.models.HealthState; +import com.azure.resourcemanager.servicefabricmesh.models.ManagedProxyResource; +import com.azure.resourcemanager.servicefabricmesh.models.NetworkRef; +import com.azure.resourcemanager.servicefabricmesh.models.OperatingSystemType; +import com.azure.resourcemanager.servicefabricmesh.models.ResourceStatus; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** This type describes a service resource. */ +@Fluent +public final class ServiceResourceDescriptionInner extends ManagedProxyResource { + /* + * This type describes properties of a service resource. + */ + @JsonProperty(value = "properties", required = true) + private ServiceResourceProperties innerProperties = new ServiceResourceProperties(); + + /** + * Get the innerProperties property: This type describes properties of a service resource. + * + * @return the innerProperties value. + */ + private ServiceResourceProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public ServiceResourceDescriptionInner withName(String name) { + super.withName(name); + return this; + } + + /** + * Get the osType property: The operation system required by the code in service. + * + * @return the osType value. + */ + public OperatingSystemType osType() { + return this.innerProperties() == null ? null : this.innerProperties().osType(); + } + + /** + * Set the osType property: The operation system required by the code in service. + * + * @param osType the osType value to set. + * @return the ServiceResourceDescriptionInner object itself. + */ + public ServiceResourceDescriptionInner withOsType(OperatingSystemType osType) { + if (this.innerProperties() == null) { + this.innerProperties = new ServiceResourceProperties(); + } + this.innerProperties().withOsType(osType); + return this; + } + + /** + * Get the codePackages property: Describes the set of code packages that forms the service. A code package + * describes the container and the properties for running it. All the code packages are started together on the same + * host and share the same context (network, process etc.). + * + * @return the codePackages value. + */ + public List codePackages() { + return this.innerProperties() == null ? null : this.innerProperties().codePackages(); + } + + /** + * Set the codePackages property: Describes the set of code packages that forms the service. A code package + * describes the container and the properties for running it. All the code packages are started together on the same + * host and share the same context (network, process etc.). + * + * @param codePackages the codePackages value to set. + * @return the ServiceResourceDescriptionInner object itself. + */ + public ServiceResourceDescriptionInner withCodePackages(List codePackages) { + if (this.innerProperties() == null) { + this.innerProperties = new ServiceResourceProperties(); + } + this.innerProperties().withCodePackages(codePackages); + return this; + } + + /** + * Get the networkRefs property: The names of the private networks that this service needs to be part of. + * + * @return the networkRefs value. + */ + public List networkRefs() { + return this.innerProperties() == null ? null : this.innerProperties().networkRefs(); + } + + /** + * Set the networkRefs property: The names of the private networks that this service needs to be part of. + * + * @param networkRefs the networkRefs value to set. + * @return the ServiceResourceDescriptionInner object itself. + */ + public ServiceResourceDescriptionInner withNetworkRefs(List networkRefs) { + if (this.innerProperties() == null) { + this.innerProperties = new ServiceResourceProperties(); + } + this.innerProperties().withNetworkRefs(networkRefs); + return this; + } + + /** + * Get the diagnostics property: Reference to sinks in DiagnosticsDescription. + * + * @return the diagnostics value. + */ + public DiagnosticsRef diagnostics() { + return this.innerProperties() == null ? null : this.innerProperties().diagnostics(); + } + + /** + * Set the diagnostics property: Reference to sinks in DiagnosticsDescription. + * + * @param diagnostics the diagnostics value to set. + * @return the ServiceResourceDescriptionInner object itself. + */ + public ServiceResourceDescriptionInner withDiagnostics(DiagnosticsRef diagnostics) { + if (this.innerProperties() == null) { + this.innerProperties = new ServiceResourceProperties(); + } + this.innerProperties().withDiagnostics(diagnostics); + return this; + } + + /** + * Get the description property: User readable description of the service. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Set the description property: User readable description of the service. + * + * @param description the description value to set. + * @return the ServiceResourceDescriptionInner object itself. + */ + public ServiceResourceDescriptionInner withDescription(String description) { + if (this.innerProperties() == null) { + this.innerProperties = new ServiceResourceProperties(); + } + this.innerProperties().withDescription(description); + return this; + } + + /** + * Get the replicaCount property: The number of replicas of the service to create. Defaults to 1 if not specified. + * + * @return the replicaCount value. + */ + public Integer replicaCount() { + return this.innerProperties() == null ? null : this.innerProperties().replicaCount(); + } + + /** + * Set the replicaCount property: The number of replicas of the service to create. Defaults to 1 if not specified. + * + * @param replicaCount the replicaCount value to set. + * @return the ServiceResourceDescriptionInner object itself. + */ + public ServiceResourceDescriptionInner withReplicaCount(Integer replicaCount) { + if (this.innerProperties() == null) { + this.innerProperties = new ServiceResourceProperties(); + } + this.innerProperties().withReplicaCount(replicaCount); + return this; + } + + /** + * Get the autoScalingPolicies property: Auto scaling policies. + * + * @return the autoScalingPolicies value. + */ + public List autoScalingPolicies() { + return this.innerProperties() == null ? null : this.innerProperties().autoScalingPolicies(); + } + + /** + * Set the autoScalingPolicies property: Auto scaling policies. + * + * @param autoScalingPolicies the autoScalingPolicies value to set. + * @return the ServiceResourceDescriptionInner object itself. + */ + public ServiceResourceDescriptionInner withAutoScalingPolicies(List autoScalingPolicies) { + if (this.innerProperties() == null) { + this.innerProperties = new ServiceResourceProperties(); + } + this.innerProperties().withAutoScalingPolicies(autoScalingPolicies); + return this; + } + + /** + * Get the status property: Status of the service. + * + * @return the status value. + */ + public ResourceStatus status() { + return this.innerProperties() == null ? null : this.innerProperties().status(); + } + + /** + * Get the statusDetails property: Gives additional information about the current status of the service. + * + * @return the statusDetails value. + */ + public String statusDetails() { + return this.innerProperties() == null ? null : this.innerProperties().statusDetails(); + } + + /** + * Get the healthState property: Describes the health state of an application resource. + * + * @return the healthState value. + */ + public HealthState healthState() { + return this.innerProperties() == null ? null : this.innerProperties().healthState(); + } + + /** + * Get the unhealthyEvaluation property: When the service's health state is not 'Ok', this additional details from + * service fabric Health Manager for the user to know why the service is marked unhealthy. + * + * @return the unhealthyEvaluation value. + */ + public String unhealthyEvaluation() { + return this.innerProperties() == null ? null : this.innerProperties().unhealthyEvaluation(); + } + + /** + * Get the provisioningState property: State of the resource. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property innerProperties in model ServiceResourceDescriptionInner")); + } else { + innerProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ServiceResourceDescriptionInner.class); +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/models/ServiceResourceProperties.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/models/ServiceResourceProperties.java new file mode 100644 index 0000000000000..09b5b93c8dde5 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/models/ServiceResourceProperties.java @@ -0,0 +1,310 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.servicefabricmesh.models.AutoScalingPolicy; +import com.azure.resourcemanager.servicefabricmesh.models.ContainerCodePackageProperties; +import com.azure.resourcemanager.servicefabricmesh.models.DiagnosticsRef; +import com.azure.resourcemanager.servicefabricmesh.models.HealthState; +import com.azure.resourcemanager.servicefabricmesh.models.NetworkRef; +import com.azure.resourcemanager.servicefabricmesh.models.OperatingSystemType; +import com.azure.resourcemanager.servicefabricmesh.models.ProvisionedResourceProperties; +import com.azure.resourcemanager.servicefabricmesh.models.ResourceStatus; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** This type describes properties of a service resource. */ +@Fluent +public final class ServiceResourceProperties extends ProvisionedResourceProperties { + /* + * The operation system required by the code in service. + */ + @JsonProperty(value = "osType", required = true) + private OperatingSystemType osType; + + /* + * Describes the set of code packages that forms the service. A code + * package describes the container and the properties for running it. All + * the code packages are started together on the same host and share the + * same context (network, process etc.). + */ + @JsonProperty(value = "codePackages", required = true) + private List codePackages; + + /* + * The names of the private networks that this service needs to be part of. + */ + @JsonProperty(value = "networkRefs") + private List networkRefs; + + /* + * Reference to sinks in DiagnosticsDescription. + */ + @JsonProperty(value = "diagnostics") + private DiagnosticsRef diagnostics; + + /* + * User readable description of the service. + */ + @JsonProperty(value = "description") + private String description; + + /* + * The number of replicas of the service to create. Defaults to 1 if not + * specified. + */ + @JsonProperty(value = "replicaCount") + private Integer replicaCount; + + /* + * Auto scaling policies + */ + @JsonProperty(value = "autoScalingPolicies") + private List autoScalingPolicies; + + /* + * Status of the service. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private ResourceStatus status; + + /* + * Gives additional information about the current status of the service. + */ + @JsonProperty(value = "statusDetails", access = JsonProperty.Access.WRITE_ONLY) + private String statusDetails; + + /* + * Describes the health state of an application resource. + */ + @JsonProperty(value = "healthState", access = JsonProperty.Access.WRITE_ONLY) + private HealthState healthState; + + /* + * When the service's health state is not 'Ok', this additional details + * from service fabric Health Manager for the user to know why the service + * is marked unhealthy. + */ + @JsonProperty(value = "unhealthyEvaluation", access = JsonProperty.Access.WRITE_ONLY) + private String unhealthyEvaluation; + + /** + * Get the osType property: The operation system required by the code in service. + * + * @return the osType value. + */ + public OperatingSystemType osType() { + return this.osType; + } + + /** + * Set the osType property: The operation system required by the code in service. + * + * @param osType the osType value to set. + * @return the ServiceResourceProperties object itself. + */ + public ServiceResourceProperties withOsType(OperatingSystemType osType) { + this.osType = osType; + return this; + } + + /** + * Get the codePackages property: Describes the set of code packages that forms the service. A code package + * describes the container and the properties for running it. All the code packages are started together on the same + * host and share the same context (network, process etc.). + * + * @return the codePackages value. + */ + public List codePackages() { + return this.codePackages; + } + + /** + * Set the codePackages property: Describes the set of code packages that forms the service. A code package + * describes the container and the properties for running it. All the code packages are started together on the same + * host and share the same context (network, process etc.). + * + * @param codePackages the codePackages value to set. + * @return the ServiceResourceProperties object itself. + */ + public ServiceResourceProperties withCodePackages(List codePackages) { + this.codePackages = codePackages; + return this; + } + + /** + * Get the networkRefs property: The names of the private networks that this service needs to be part of. + * + * @return the networkRefs value. + */ + public List networkRefs() { + return this.networkRefs; + } + + /** + * Set the networkRefs property: The names of the private networks that this service needs to be part of. + * + * @param networkRefs the networkRefs value to set. + * @return the ServiceResourceProperties object itself. + */ + public ServiceResourceProperties withNetworkRefs(List networkRefs) { + this.networkRefs = networkRefs; + return this; + } + + /** + * Get the diagnostics property: Reference to sinks in DiagnosticsDescription. + * + * @return the diagnostics value. + */ + public DiagnosticsRef diagnostics() { + return this.diagnostics; + } + + /** + * Set the diagnostics property: Reference to sinks in DiagnosticsDescription. + * + * @param diagnostics the diagnostics value to set. + * @return the ServiceResourceProperties object itself. + */ + public ServiceResourceProperties withDiagnostics(DiagnosticsRef diagnostics) { + this.diagnostics = diagnostics; + return this; + } + + /** + * Get the description property: User readable description of the service. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: User readable description of the service. + * + * @param description the description value to set. + * @return the ServiceResourceProperties object itself. + */ + public ServiceResourceProperties withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the replicaCount property: The number of replicas of the service to create. Defaults to 1 if not specified. + * + * @return the replicaCount value. + */ + public Integer replicaCount() { + return this.replicaCount; + } + + /** + * Set the replicaCount property: The number of replicas of the service to create. Defaults to 1 if not specified. + * + * @param replicaCount the replicaCount value to set. + * @return the ServiceResourceProperties object itself. + */ + public ServiceResourceProperties withReplicaCount(Integer replicaCount) { + this.replicaCount = replicaCount; + return this; + } + + /** + * Get the autoScalingPolicies property: Auto scaling policies. + * + * @return the autoScalingPolicies value. + */ + public List autoScalingPolicies() { + return this.autoScalingPolicies; + } + + /** + * Set the autoScalingPolicies property: Auto scaling policies. + * + * @param autoScalingPolicies the autoScalingPolicies value to set. + * @return the ServiceResourceProperties object itself. + */ + public ServiceResourceProperties withAutoScalingPolicies(List autoScalingPolicies) { + this.autoScalingPolicies = autoScalingPolicies; + return this; + } + + /** + * Get the status property: Status of the service. + * + * @return the status value. + */ + public ResourceStatus status() { + return this.status; + } + + /** + * Get the statusDetails property: Gives additional information about the current status of the service. + * + * @return the statusDetails value. + */ + public String statusDetails() { + return this.statusDetails; + } + + /** + * Get the healthState property: Describes the health state of an application resource. + * + * @return the healthState value. + */ + public HealthState healthState() { + return this.healthState; + } + + /** + * Get the unhealthyEvaluation property: When the service's health state is not 'Ok', this additional details from + * service fabric Health Manager for the user to know why the service is marked unhealthy. + * + * @return the unhealthyEvaluation value. + */ + public String unhealthyEvaluation() { + return this.unhealthyEvaluation; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (osType() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property osType in model ServiceResourceProperties")); + } + if (codePackages() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property codePackages in model ServiceResourceProperties")); + } else { + codePackages().forEach(e -> e.validate()); + } + if (networkRefs() != null) { + networkRefs().forEach(e -> e.validate()); + } + if (diagnostics() != null) { + diagnostics().validate(); + } + if (autoScalingPolicies() != null) { + autoScalingPolicies().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ServiceResourceProperties.class); +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/models/VolumeResourceDescriptionInner.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/models/VolumeResourceDescriptionInner.java new file mode 100644 index 0000000000000..44f211ce015e6 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/models/VolumeResourceDescriptionInner.java @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.servicefabricmesh.models.ResourceStatus; +import com.azure.resourcemanager.servicefabricmesh.models.VolumeProvider; +import com.azure.resourcemanager.servicefabricmesh.models.VolumeProviderParametersAzureFile; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** This type describes a volume resource. */ +@Fluent +public final class VolumeResourceDescriptionInner extends Resource { + /* + * This type describes properties of a volume resource. + */ + @JsonProperty(value = "properties", required = true) + private VolumeResourceProperties innerProperties = new VolumeResourceProperties(); + + /** + * Get the innerProperties property: This type describes properties of a volume resource. + * + * @return the innerProperties value. + */ + private VolumeResourceProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public VolumeResourceDescriptionInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public VolumeResourceDescriptionInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the description property: User readable description of the volume. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Set the description property: User readable description of the volume. + * + * @param description the description value to set. + * @return the VolumeResourceDescriptionInner object itself. + */ + public VolumeResourceDescriptionInner withDescription(String description) { + if (this.innerProperties() == null) { + this.innerProperties = new VolumeResourceProperties(); + } + this.innerProperties().withDescription(description); + return this; + } + + /** + * Get the status property: Status of the volume. + * + * @return the status value. + */ + public ResourceStatus status() { + return this.innerProperties() == null ? null : this.innerProperties().status(); + } + + /** + * Get the statusDetails property: Gives additional information about the current status of the volume. + * + * @return the statusDetails value. + */ + public String statusDetails() { + return this.innerProperties() == null ? null : this.innerProperties().statusDetails(); + } + + /** + * Get the provider property: Provider of the volume. + * + * @return the provider value. + */ + public VolumeProvider provider() { + return this.innerProperties() == null ? null : this.innerProperties().provider(); + } + + /** + * Set the provider property: Provider of the volume. + * + * @param provider the provider value to set. + * @return the VolumeResourceDescriptionInner object itself. + */ + public VolumeResourceDescriptionInner withProvider(VolumeProvider provider) { + if (this.innerProperties() == null) { + this.innerProperties = new VolumeResourceProperties(); + } + this.innerProperties().withProvider(provider); + return this; + } + + /** + * Get the azureFileParameters property: This type describes a volume provided by an Azure Files file share. + * + * @return the azureFileParameters value. + */ + public VolumeProviderParametersAzureFile azureFileParameters() { + return this.innerProperties() == null ? null : this.innerProperties().azureFileParameters(); + } + + /** + * Set the azureFileParameters property: This type describes a volume provided by an Azure Files file share. + * + * @param azureFileParameters the azureFileParameters value to set. + * @return the VolumeResourceDescriptionInner object itself. + */ + public VolumeResourceDescriptionInner withAzureFileParameters( + VolumeProviderParametersAzureFile azureFileParameters) { + if (this.innerProperties() == null) { + this.innerProperties = new VolumeResourceProperties(); + } + this.innerProperties().withAzureFileParameters(azureFileParameters); + return this; + } + + /** + * Get the provisioningState property: State of the resource. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property innerProperties in model VolumeResourceDescriptionInner")); + } else { + innerProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(VolumeResourceDescriptionInner.class); +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/models/VolumeResourceProperties.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/models/VolumeResourceProperties.java new file mode 100644 index 0000000000000..137bcc073b08b --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/models/VolumeResourceProperties.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.servicefabricmesh.models.ProvisionedResourceProperties; +import com.azure.resourcemanager.servicefabricmesh.models.ResourceStatus; +import com.azure.resourcemanager.servicefabricmesh.models.VolumeProvider; +import com.azure.resourcemanager.servicefabricmesh.models.VolumeProviderParametersAzureFile; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** This type describes properties of a volume resource. */ +@Fluent +public final class VolumeResourceProperties extends ProvisionedResourceProperties { + /* + * User readable description of the volume. + */ + @JsonProperty(value = "description") + private String description; + + /* + * Status of the volume. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private ResourceStatus status; + + /* + * Gives additional information about the current status of the volume. + */ + @JsonProperty(value = "statusDetails", access = JsonProperty.Access.WRITE_ONLY) + private String statusDetails; + + /* + * Provider of the volume. + */ + @JsonProperty(value = "provider", required = true) + private VolumeProvider provider; + + /* + * This type describes a volume provided by an Azure Files file share. + */ + @JsonProperty(value = "azureFileParameters") + private VolumeProviderParametersAzureFile azureFileParameters; + + /** + * Get the description property: User readable description of the volume. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: User readable description of the volume. + * + * @param description the description value to set. + * @return the VolumeResourceProperties object itself. + */ + public VolumeResourceProperties withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the status property: Status of the volume. + * + * @return the status value. + */ + public ResourceStatus status() { + return this.status; + } + + /** + * Get the statusDetails property: Gives additional information about the current status of the volume. + * + * @return the statusDetails value. + */ + public String statusDetails() { + return this.statusDetails; + } + + /** + * Get the provider property: Provider of the volume. + * + * @return the provider value. + */ + public VolumeProvider provider() { + return this.provider; + } + + /** + * Set the provider property: Provider of the volume. + * + * @param provider the provider value to set. + * @return the VolumeResourceProperties object itself. + */ + public VolumeResourceProperties withProvider(VolumeProvider provider) { + this.provider = provider; + return this; + } + + /** + * Get the azureFileParameters property: This type describes a volume provided by an Azure Files file share. + * + * @return the azureFileParameters value. + */ + public VolumeProviderParametersAzureFile azureFileParameters() { + return this.azureFileParameters; + } + + /** + * Set the azureFileParameters property: This type describes a volume provided by an Azure Files file share. + * + * @param azureFileParameters the azureFileParameters value to set. + * @return the VolumeResourceProperties object itself. + */ + public VolumeResourceProperties withAzureFileParameters(VolumeProviderParametersAzureFile azureFileParameters) { + this.azureFileParameters = azureFileParameters; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (provider() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property provider in model VolumeResourceProperties")); + } + if (azureFileParameters() != null) { + azureFileParameters().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(VolumeResourceProperties.class); +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/models/package-info.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/models/package-info.java new file mode 100644 index 0000000000000..0e3fae3b20cf6 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the inner data models for ServiceFabricMeshManagementClient. Service Fabric Mesh Management + * Client. + */ +package com.azure.resourcemanager.servicefabricmesh.fluent.models; diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/package-info.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/package-info.java new file mode 100644 index 0000000000000..dc6379016561f --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/fluent/package-info.java @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the service clients for ServiceFabricMeshManagementClient. Service Fabric Mesh Management Client. + */ +package com.azure.resourcemanager.servicefabricmesh.fluent; diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/ApplicationResourceDescriptionImpl.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/ApplicationResourceDescriptionImpl.java new file mode 100644 index 0000000000000..f85912cf9b5a2 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/ApplicationResourceDescriptionImpl.java @@ -0,0 +1,220 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.servicefabricmesh.fluent.models.ApplicationResourceDescriptionInner; +import com.azure.resourcemanager.servicefabricmesh.fluent.models.ServiceResourceDescriptionInner; +import com.azure.resourcemanager.servicefabricmesh.models.ApplicationResourceDescription; +import com.azure.resourcemanager.servicefabricmesh.models.DiagnosticsDescription; +import com.azure.resourcemanager.servicefabricmesh.models.HealthState; +import com.azure.resourcemanager.servicefabricmesh.models.ResourceStatus; +import com.azure.resourcemanager.servicefabricmesh.models.ServiceResourceDescription; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +public final class ApplicationResourceDescriptionImpl + implements ApplicationResourceDescription, ApplicationResourceDescription.Definition { + private ApplicationResourceDescriptionInner innerObject; + + private final com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager serviceManager; + + ApplicationResourceDescriptionImpl( + ApplicationResourceDescriptionInner innerObject, + com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public String description() { + return this.innerModel().description(); + } + + public List services() { + List inner = this.innerModel().services(); + if (inner != null) { + return Collections + .unmodifiableList( + inner + .stream() + .map(inner1 -> new ServiceResourceDescriptionImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public DiagnosticsDescription diagnostics() { + return this.innerModel().diagnostics(); + } + + public String debugParams() { + return this.innerModel().debugParams(); + } + + public List serviceNames() { + List inner = this.innerModel().serviceNames(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public ResourceStatus status() { + return this.innerModel().status(); + } + + public String statusDetails() { + return this.innerModel().statusDetails(); + } + + public HealthState healthState() { + return this.innerModel().healthState(); + } + + public String unhealthyEvaluation() { + return this.innerModel().unhealthyEvaluation(); + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public ApplicationResourceDescriptionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String applicationResourceName; + + public ApplicationResourceDescriptionImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public ApplicationResourceDescription create() { + this.innerObject = + serviceManager + .serviceClient() + .getApplications() + .createWithResponse(resourceGroupName, applicationResourceName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public ApplicationResourceDescription create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getApplications() + .createWithResponse(resourceGroupName, applicationResourceName, this.innerModel(), context) + .getValue(); + return this; + } + + ApplicationResourceDescriptionImpl( + String name, com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager serviceManager) { + this.innerObject = new ApplicationResourceDescriptionInner(); + this.serviceManager = serviceManager; + this.applicationResourceName = name; + } + + public ApplicationResourceDescription refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getApplications() + .getByResourceGroupWithResponse(resourceGroupName, applicationResourceName, Context.NONE) + .getValue(); + return this; + } + + public ApplicationResourceDescription refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getApplications() + .getByResourceGroupWithResponse(resourceGroupName, applicationResourceName, context) + .getValue(); + return this; + } + + public ApplicationResourceDescriptionImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public ApplicationResourceDescriptionImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public ApplicationResourceDescriptionImpl withTags(Map tags) { + this.innerModel().withTags(tags); + return this; + } + + public ApplicationResourceDescriptionImpl withDescription(String description) { + this.innerModel().withDescription(description); + return this; + } + + public ApplicationResourceDescriptionImpl withServices(List services) { + this.innerModel().withServices(services); + return this; + } + + public ApplicationResourceDescriptionImpl withDiagnostics(DiagnosticsDescription diagnostics) { + this.innerModel().withDiagnostics(diagnostics); + return this; + } + + public ApplicationResourceDescriptionImpl withDebugParams(String debugParams) { + this.innerModel().withDebugParams(debugParams); + return this; + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/ApplicationsClientImpl.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/ApplicationsClientImpl.java new file mode 100644 index 0000000000000..4b66ffab9bfd6 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/ApplicationsClientImpl.java @@ -0,0 +1,1127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.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.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.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.servicefabricmesh.fluent.ApplicationsClient; +import com.azure.resourcemanager.servicefabricmesh.fluent.models.ApplicationResourceDescriptionInner; +import com.azure.resourcemanager.servicefabricmesh.models.ApplicationResourceDescriptionList; +import com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ApplicationsClient. */ +public final class ApplicationsClientImpl implements ApplicationsClient { + /** The proxy service used to perform REST calls. */ + private final ApplicationsService service; + + /** The service client containing this operation class. */ + private final ServiceFabricMeshManagementClientImpl client; + + /** + * Initializes an instance of ApplicationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ApplicationsClientImpl(ServiceFabricMeshManagementClientImpl client) { + this.service = + RestProxy.create(ApplicationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ServiceFabricMeshManagementClientApplications to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ServiceFabricMeshMan") + private interface ApplicationsService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh" + + "/applications/{applicationResourceName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ErrorErrorModelException.class) + Mono> create( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam(value = "applicationResourceName", encoded = true) String applicationResourceName, + @BodyParam("application/json") ApplicationResourceDescriptionInner applicationResourceDescription, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh" + + "/applications/{applicationResourceName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorErrorModelException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam(value = "applicationResourceName", encoded = true) String applicationResourceName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh" + + "/applications/{applicationResourceName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ErrorErrorModelException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam(value = "applicationResourceName", encoded = true) String applicationResourceName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh" + + "/applications") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorErrorModelException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @PathParam("resourceGroupName") String resourceGroupName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabricMesh/applications") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorErrorModelException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorErrorModelException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorErrorModelException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Creates an application resource with the specified name, description and properties. If an application resource + * with the same name exists, then it is updated with the specified description and properties. + * + * @param resourceGroupName Azure resource group name. + * @param applicationResourceName The identity of the application. + * @param applicationResourceDescription Description for creating a Application resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this type describes an application resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync( + String resourceGroupName, + String applicationResourceName, + ApplicationResourceDescriptionInner applicationResourceDescription) { + 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 (applicationResourceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter applicationResourceName is required and cannot be null.")); + } + if (applicationResourceDescription == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter applicationResourceDescription is required and cannot be null.")); + } else { + applicationResourceDescription.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .create( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + resourceGroupName, + applicationResourceName, + applicationResourceDescription, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates an application resource with the specified name, description and properties. If an application resource + * with the same name exists, then it is updated with the specified description and properties. + * + * @param resourceGroupName Azure resource group name. + * @param applicationResourceName The identity of the application. + * @param applicationResourceDescription Description for creating a Application resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this type describes an application resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync( + String resourceGroupName, + String applicationResourceName, + ApplicationResourceDescriptionInner applicationResourceDescription, + 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 (applicationResourceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter applicationResourceName is required and cannot be null.")); + } + if (applicationResourceDescription == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter applicationResourceDescription is required and cannot be null.")); + } else { + applicationResourceDescription.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .create( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + resourceGroupName, + applicationResourceName, + applicationResourceDescription, + accept, + context); + } + + /** + * Creates an application resource with the specified name, description and properties. If an application resource + * with the same name exists, then it is updated with the specified description and properties. + * + * @param resourceGroupName Azure resource group name. + * @param applicationResourceName The identity of the application. + * @param applicationResourceDescription Description for creating a Application resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this type describes an application resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, + String applicationResourceName, + ApplicationResourceDescriptionInner applicationResourceDescription) { + return createWithResponseAsync(resourceGroupName, applicationResourceName, applicationResourceDescription) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates an application resource with the specified name, description and properties. If an application resource + * with the same name exists, then it is updated with the specified description and properties. + * + * @param resourceGroupName Azure resource group name. + * @param applicationResourceName The identity of the application. + * @param applicationResourceDescription Description for creating a Application resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this type describes an application resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApplicationResourceDescriptionInner create( + String resourceGroupName, + String applicationResourceName, + ApplicationResourceDescriptionInner applicationResourceDescription) { + return createAsync(resourceGroupName, applicationResourceName, applicationResourceDescription).block(); + } + + /** + * Creates an application resource with the specified name, description and properties. If an application resource + * with the same name exists, then it is updated with the specified description and properties. + * + * @param resourceGroupName Azure resource group name. + * @param applicationResourceName The identity of the application. + * @param applicationResourceDescription Description for creating a Application resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this type describes an application resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse( + String resourceGroupName, + String applicationResourceName, + ApplicationResourceDescriptionInner applicationResourceDescription, + Context context) { + return createWithResponseAsync( + resourceGroupName, applicationResourceName, applicationResourceDescription, context) + .block(); + } + + /** + * Gets the information about the application resource with the given name. The information include the description + * and other properties of the application. + * + * @param resourceGroupName Azure resource group name. + * @param applicationResourceName The identity of the application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about the application resource with the given name along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String applicationResourceName) { + 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 (applicationResourceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter applicationResourceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + resourceGroupName, + applicationResourceName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the information about the application resource with the given name. The information include the description + * and other properties of the application. + * + * @param resourceGroupName Azure resource group name. + * @param applicationResourceName The identity of the application. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about the application resource with the given name along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String applicationResourceName, 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 (applicationResourceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter applicationResourceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + resourceGroupName, + applicationResourceName, + accept, + context); + } + + /** + * Gets the information about the application resource with the given name. The information include the description + * and other properties of the application. + * + * @param resourceGroupName Azure resource group name. + * @param applicationResourceName The identity of the application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about the application resource with the given name on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync( + String resourceGroupName, String applicationResourceName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, applicationResourceName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the information about the application resource with the given name. The information include the description + * and other properties of the application. + * + * @param resourceGroupName Azure resource group name. + * @param applicationResourceName The identity of the application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about the application resource with the given name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApplicationResourceDescriptionInner getByResourceGroup( + String resourceGroupName, String applicationResourceName) { + return getByResourceGroupAsync(resourceGroupName, applicationResourceName).block(); + } + + /** + * Gets the information about the application resource with the given name. The information include the description + * and other properties of the application. + * + * @param resourceGroupName Azure resource group name. + * @param applicationResourceName The identity of the application. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about the application resource with the given name along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String applicationResourceName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, applicationResourceName, context).block(); + } + + /** + * Deletes the application resource identified by the name. + * + * @param resourceGroupName Azure resource group name. + * @param applicationResourceName The identity of the application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException 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 applicationResourceName) { + 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 (applicationResourceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter applicationResourceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + resourceGroupName, + applicationResourceName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes the application resource identified by the name. + * + * @param resourceGroupName Azure resource group name. + * @param applicationResourceName The identity of the application. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException 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 applicationResourceName, 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 (applicationResourceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter applicationResourceName 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(), + this.client.getApiVersion(), + resourceGroupName, + applicationResourceName, + accept, + context); + } + + /** + * Deletes the application resource identified by the name. + * + * @param resourceGroupName Azure resource group name. + * @param applicationResourceName The identity of the application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException 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 applicationResourceName) { + return deleteWithResponseAsync(resourceGroupName, applicationResourceName).flatMap(ignored -> Mono.empty()); + } + + /** + * Deletes the application resource identified by the name. + * + * @param resourceGroupName Azure resource group name. + * @param applicationResourceName The identity of the application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException 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 applicationResourceName) { + deleteAsync(resourceGroupName, applicationResourceName).block(); + } + + /** + * Deletes the application resource identified by the name. + * + * @param resourceGroupName Azure resource group name. + * @param applicationResourceName The identity of the application. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException 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 applicationResourceName, Context context) { + return deleteWithResponseAsync(resourceGroupName, applicationResourceName, context).block(); + } + + /** + * Gets the information about all application resources in a given resource group. The information include the + * description and other properties of the Application. + * + * @param resourceGroupName Azure resource group name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all application resources in a given resource group along with {@link + * PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + 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.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + resourceGroupName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the information about all application resources in a given resource group. The information include the + * description and other properties of the Application. + * + * @param resourceGroupName Azure resource group name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all application resources in a given resource group along with {@link + * PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + 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.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + resourceGroupName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets the information about all application resources in a given resource group. The information include the + * description and other properties of the Application. + * + * @param resourceGroupName Azure resource group name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all application resources in a given resource group as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Gets the information about all application resources in a given resource group. The information include the + * description and other properties of the Application. + * + * @param resourceGroupName Azure resource group name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all application resources in a given resource group as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync( + String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets the information about all application resources in a given resource group. The information include the + * description and other properties of the Application. + * + * @param resourceGroupName Azure resource group name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all application resources in a given resource group as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Gets the information about all application resources in a given resource group. The information include the + * description and other properties of the Application. + * + * @param resourceGroupName Azure resource group name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all application resources in a given resource group as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup( + String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Gets the information about all application resources in a given resource group. The information include the + * description and other properties of the application. + * + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all application resources in a given resource group along with {@link + * PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + 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())); + } + + /** + * Gets the information about all application resources in a given resource group. The information include the + * description and other properties of the application. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all application resources in a given resource group along with {@link + * PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets the information about all application resources in a given resource group. The information include the + * description and other properties of the application. + * + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all application resources in a given resource group as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>( + () -> listSinglePageAsync(), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Gets the information about all application resources in a given resource group. The information include the + * description and other properties of the application. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all application resources in a given resource group as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets the information about all application resources in a given resource group. The information include the + * description and other properties of the application. + * + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all application resources in a given resource group as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Gets the information about all application resources in a given resource group. The information include the + * description and other properties of the application. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all application resources in a given resource group as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of application resources along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync( + 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.listByResourceGroupNext(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 nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of application resources along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync( + 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 + .listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of application resources along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync( + 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.listBySubscriptionNext(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 nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of application resources along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync( + 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 + .listBySubscriptionNext(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/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/ApplicationsImpl.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/ApplicationsImpl.java new file mode 100644 index 0000000000000..c08d207999b08 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/ApplicationsImpl.java @@ -0,0 +1,175 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.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.servicefabricmesh.fluent.ApplicationsClient; +import com.azure.resourcemanager.servicefabricmesh.fluent.models.ApplicationResourceDescriptionInner; +import com.azure.resourcemanager.servicefabricmesh.models.ApplicationResourceDescription; +import com.azure.resourcemanager.servicefabricmesh.models.Applications; + +public final class ApplicationsImpl implements Applications { + private static final ClientLogger LOGGER = new ClientLogger(ApplicationsImpl.class); + + private final ApplicationsClient innerClient; + + private final com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager serviceManager; + + public ApplicationsImpl( + ApplicationsClient innerClient, + com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public ApplicationResourceDescription getByResourceGroup(String resourceGroupName, String applicationResourceName) { + ApplicationResourceDescriptionInner inner = + this.serviceClient().getByResourceGroup(resourceGroupName, applicationResourceName); + if (inner != null) { + return new ApplicationResourceDescriptionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String applicationResourceName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, applicationResourceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ApplicationResourceDescriptionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String applicationResourceName) { + this.serviceClient().delete(resourceGroupName, applicationResourceName); + } + + public Response deleteWithResponse( + String resourceGroupName, String applicationResourceName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, applicationResourceName, context); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new ApplicationResourceDescriptionImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup( + String resourceGroupName, Context context) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new ApplicationResourceDescriptionImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new ApplicationResourceDescriptionImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new ApplicationResourceDescriptionImpl(inner1, this.manager())); + } + + public ApplicationResourceDescription 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 applicationResourceName = Utils.getValueFromIdByName(id, "applications"); + if (applicationResourceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'applications'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, applicationResourceName, 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 applicationResourceName = Utils.getValueFromIdByName(id, "applications"); + if (applicationResourceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'applications'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, applicationResourceName, 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 applicationResourceName = Utils.getValueFromIdByName(id, "applications"); + if (applicationResourceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'applications'.", id))); + } + this.deleteWithResponse(resourceGroupName, applicationResourceName, 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 applicationResourceName = Utils.getValueFromIdByName(id, "applications"); + if (applicationResourceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'applications'.", id))); + } + return this.deleteWithResponse(resourceGroupName, applicationResourceName, context); + } + + private ApplicationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager() { + return this.serviceManager; + } + + public ApplicationResourceDescriptionImpl define(String name) { + return new ApplicationResourceDescriptionImpl(name, this.manager()); + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/CodePackagesClientImpl.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/CodePackagesClientImpl.java new file mode 100644 index 0000000000000..75ca1036702ce --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/CodePackagesClientImpl.java @@ -0,0 +1,340 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +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.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.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.servicefabricmesh.fluent.CodePackagesClient; +import com.azure.resourcemanager.servicefabricmesh.fluent.models.ContainerLogsInner; +import com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in CodePackagesClient. */ +public final class CodePackagesClientImpl implements CodePackagesClient { + /** The proxy service used to perform REST calls. */ + private final CodePackagesService service; + + /** The service client containing this operation class. */ + private final ServiceFabricMeshManagementClientImpl client; + + /** + * Initializes an instance of CodePackagesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + CodePackagesClientImpl(ServiceFabricMeshManagementClientImpl client) { + this.service = + RestProxy.create(CodePackagesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ServiceFabricMeshManagementClientCodePackages to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ServiceFabricMeshMan") + private interface CodePackagesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh" + + "/applications/{applicationResourceName}/services/{serviceResourceName}/replicas/{replicaName}" + + "/codePackages/{codePackageName}/logs") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorErrorModelException.class) + Mono> getContainerLogs( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "applicationResourceName", encoded = true) String applicationResourceName, + @PathParam(value = "serviceResourceName", encoded = true) String serviceResourceName, + @PathParam(value = "replicaName", encoded = true) String replicaName, + @PathParam("codePackageName") String codePackageName, + @QueryParam("tail") Integer tail, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets the logs for the container of the specified code package of the service replica. + * + * @param resourceGroupName Azure resource group name. + * @param applicationResourceName The identity of the application. + * @param serviceResourceName The identity of the service. + * @param replicaName Service Fabric replica name. + * @param codePackageName The name of code package of the service. + * @param tail Number of lines to show from the end of the logs. Default is 100. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the logs for the container of the specified code package of the service replica along with {@link + * Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getContainerLogsWithResponseAsync( + String resourceGroupName, + String applicationResourceName, + String serviceResourceName, + String replicaName, + String codePackageName, + Integer tail) { + 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 (applicationResourceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter applicationResourceName is required and cannot be null.")); + } + if (serviceResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serviceResourceName is required and cannot be null.")); + } + if (replicaName == null) { + return Mono.error(new IllegalArgumentException("Parameter replicaName is required and cannot be null.")); + } + if (codePackageName == null) { + return Mono + .error(new IllegalArgumentException("Parameter codePackageName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getContainerLogs( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + applicationResourceName, + serviceResourceName, + replicaName, + codePackageName, + tail, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the logs for the container of the specified code package of the service replica. + * + * @param resourceGroupName Azure resource group name. + * @param applicationResourceName The identity of the application. + * @param serviceResourceName The identity of the service. + * @param replicaName Service Fabric replica name. + * @param codePackageName The name of code package of the service. + * @param tail Number of lines to show from the end of the logs. Default is 100. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the logs for the container of the specified code package of the service replica along with {@link + * Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getContainerLogsWithResponseAsync( + String resourceGroupName, + String applicationResourceName, + String serviceResourceName, + String replicaName, + String codePackageName, + Integer tail, + 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 (applicationResourceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter applicationResourceName is required and cannot be null.")); + } + if (serviceResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serviceResourceName is required and cannot be null.")); + } + if (replicaName == null) { + return Mono.error(new IllegalArgumentException("Parameter replicaName is required and cannot be null.")); + } + if (codePackageName == null) { + return Mono + .error(new IllegalArgumentException("Parameter codePackageName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getContainerLogs( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + applicationResourceName, + serviceResourceName, + replicaName, + codePackageName, + tail, + accept, + context); + } + + /** + * Gets the logs for the container of the specified code package of the service replica. + * + * @param resourceGroupName Azure resource group name. + * @param applicationResourceName The identity of the application. + * @param serviceResourceName The identity of the service. + * @param replicaName Service Fabric replica name. + * @param codePackageName The name of code package of the service. + * @param tail Number of lines to show from the end of the logs. Default is 100. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the logs for the container of the specified code package of the service replica on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getContainerLogsAsync( + String resourceGroupName, + String applicationResourceName, + String serviceResourceName, + String replicaName, + String codePackageName, + Integer tail) { + return getContainerLogsWithResponseAsync( + resourceGroupName, applicationResourceName, serviceResourceName, replicaName, codePackageName, tail) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the logs for the container of the specified code package of the service replica. + * + * @param resourceGroupName Azure resource group name. + * @param applicationResourceName The identity of the application. + * @param serviceResourceName The identity of the service. + * @param replicaName Service Fabric replica name. + * @param codePackageName The name of code package of the service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the logs for the container of the specified code package of the service replica on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getContainerLogsAsync( + String resourceGroupName, + String applicationResourceName, + String serviceResourceName, + String replicaName, + String codePackageName) { + final Integer tail = null; + return getContainerLogsWithResponseAsync( + resourceGroupName, applicationResourceName, serviceResourceName, replicaName, codePackageName, tail) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the logs for the container of the specified code package of the service replica. + * + * @param resourceGroupName Azure resource group name. + * @param applicationResourceName The identity of the application. + * @param serviceResourceName The identity of the service. + * @param replicaName Service Fabric replica name. + * @param codePackageName The name of code package of the service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the logs for the container of the specified code package of the service replica. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ContainerLogsInner getContainerLogs( + String resourceGroupName, + String applicationResourceName, + String serviceResourceName, + String replicaName, + String codePackageName) { + final Integer tail = null; + return getContainerLogsAsync( + resourceGroupName, applicationResourceName, serviceResourceName, replicaName, codePackageName, tail) + .block(); + } + + /** + * Gets the logs for the container of the specified code package of the service replica. + * + * @param resourceGroupName Azure resource group name. + * @param applicationResourceName The identity of the application. + * @param serviceResourceName The identity of the service. + * @param replicaName Service Fabric replica name. + * @param codePackageName The name of code package of the service. + * @param tail Number of lines to show from the end of the logs. Default is 100. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the logs for the container of the specified code package of the service replica along with {@link + * Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getContainerLogsWithResponse( + String resourceGroupName, + String applicationResourceName, + String serviceResourceName, + String replicaName, + String codePackageName, + Integer tail, + Context context) { + return getContainerLogsWithResponseAsync( + resourceGroupName, + applicationResourceName, + serviceResourceName, + replicaName, + codePackageName, + tail, + context) + .block(); + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/CodePackagesImpl.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/CodePackagesImpl.java new file mode 100644 index 0000000000000..9858193da2820 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/CodePackagesImpl.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.implementation; + +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.servicefabricmesh.fluent.CodePackagesClient; +import com.azure.resourcemanager.servicefabricmesh.fluent.models.ContainerLogsInner; +import com.azure.resourcemanager.servicefabricmesh.models.CodePackages; +import com.azure.resourcemanager.servicefabricmesh.models.ContainerLogs; + +public final class CodePackagesImpl implements CodePackages { + private static final ClientLogger LOGGER = new ClientLogger(CodePackagesImpl.class); + + private final CodePackagesClient innerClient; + + private final com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager serviceManager; + + public CodePackagesImpl( + CodePackagesClient innerClient, + com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public ContainerLogs getContainerLogs( + String resourceGroupName, + String applicationResourceName, + String serviceResourceName, + String replicaName, + String codePackageName) { + ContainerLogsInner inner = + this + .serviceClient() + .getContainerLogs( + resourceGroupName, applicationResourceName, serviceResourceName, replicaName, codePackageName); + if (inner != null) { + return new ContainerLogsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getContainerLogsWithResponse( + String resourceGroupName, + String applicationResourceName, + String serviceResourceName, + String replicaName, + String codePackageName, + Integer tail, + Context context) { + Response inner = + this + .serviceClient() + .getContainerLogsWithResponse( + resourceGroupName, + applicationResourceName, + serviceResourceName, + replicaName, + codePackageName, + tail, + context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ContainerLogsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private CodePackagesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/ContainerLogsImpl.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/ContainerLogsImpl.java new file mode 100644 index 0000000000000..9d47ebc2c0685 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/ContainerLogsImpl.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.implementation; + +import com.azure.resourcemanager.servicefabricmesh.fluent.models.ContainerLogsInner; +import com.azure.resourcemanager.servicefabricmesh.models.ContainerLogs; + +public final class ContainerLogsImpl implements ContainerLogs { + private ContainerLogsInner innerObject; + + private final com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager serviceManager; + + ContainerLogsImpl( + ContainerLogsInner innerObject, + com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String content() { + return this.innerModel().content(); + } + + public ContainerLogsInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/GatewayResourceDescriptionImpl.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/GatewayResourceDescriptionImpl.java new file mode 100644 index 0000000000000..6d027d0b3df19 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/GatewayResourceDescriptionImpl.java @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.servicefabricmesh.fluent.models.GatewayResourceDescriptionInner; +import com.azure.resourcemanager.servicefabricmesh.models.GatewayResourceDescription; +import com.azure.resourcemanager.servicefabricmesh.models.HttpConfig; +import com.azure.resourcemanager.servicefabricmesh.models.NetworkRef; +import com.azure.resourcemanager.servicefabricmesh.models.ResourceStatus; +import com.azure.resourcemanager.servicefabricmesh.models.TcpConfig; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class GatewayResourceDescriptionImpl + implements GatewayResourceDescription, GatewayResourceDescription.Definition { + private GatewayResourceDescriptionInner innerObject; + + private final com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager serviceManager; + + GatewayResourceDescriptionImpl( + GatewayResourceDescriptionInner innerObject, + com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public String description() { + return this.innerModel().description(); + } + + public NetworkRef sourceNetwork() { + return this.innerModel().sourceNetwork(); + } + + public NetworkRef destinationNetwork() { + return this.innerModel().destinationNetwork(); + } + + public List tcp() { + List inner = this.innerModel().tcp(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List http() { + List inner = this.innerModel().http(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public ResourceStatus status() { + return this.innerModel().status(); + } + + public String statusDetails() { + return this.innerModel().statusDetails(); + } + + public String ipAddress() { + return this.innerModel().ipAddress(); + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public GatewayResourceDescriptionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String gatewayResourceName; + + public GatewayResourceDescriptionImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public GatewayResourceDescription create() { + this.innerObject = + serviceManager + .serviceClient() + .getGateways() + .createWithResponse(resourceGroupName, gatewayResourceName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public GatewayResourceDescription create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getGateways() + .createWithResponse(resourceGroupName, gatewayResourceName, this.innerModel(), context) + .getValue(); + return this; + } + + GatewayResourceDescriptionImpl( + String name, com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager serviceManager) { + this.innerObject = new GatewayResourceDescriptionInner(); + this.serviceManager = serviceManager; + this.gatewayResourceName = name; + } + + public GatewayResourceDescription refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getGateways() + .getByResourceGroupWithResponse(resourceGroupName, gatewayResourceName, Context.NONE) + .getValue(); + return this; + } + + public GatewayResourceDescription refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getGateways() + .getByResourceGroupWithResponse(resourceGroupName, gatewayResourceName, context) + .getValue(); + return this; + } + + public GatewayResourceDescriptionImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public GatewayResourceDescriptionImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public GatewayResourceDescriptionImpl withSourceNetwork(NetworkRef sourceNetwork) { + this.innerModel().withSourceNetwork(sourceNetwork); + return this; + } + + public GatewayResourceDescriptionImpl withDestinationNetwork(NetworkRef destinationNetwork) { + this.innerModel().withDestinationNetwork(destinationNetwork); + return this; + } + + public GatewayResourceDescriptionImpl withTags(Map tags) { + this.innerModel().withTags(tags); + return this; + } + + public GatewayResourceDescriptionImpl withDescription(String description) { + this.innerModel().withDescription(description); + return this; + } + + public GatewayResourceDescriptionImpl withTcp(List tcp) { + this.innerModel().withTcp(tcp); + return this; + } + + public GatewayResourceDescriptionImpl withHttp(List http) { + this.innerModel().withHttp(http); + return this; + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/GatewaysClientImpl.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/GatewaysClientImpl.java new file mode 100644 index 0000000000000..95e958d0eafe4 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/GatewaysClientImpl.java @@ -0,0 +1,1121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.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.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.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.servicefabricmesh.fluent.GatewaysClient; +import com.azure.resourcemanager.servicefabricmesh.fluent.models.GatewayResourceDescriptionInner; +import com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException; +import com.azure.resourcemanager.servicefabricmesh.models.GatewayResourceDescriptionList; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in GatewaysClient. */ +public final class GatewaysClientImpl implements GatewaysClient { + /** The proxy service used to perform REST calls. */ + private final GatewaysService service; + + /** The service client containing this operation class. */ + private final ServiceFabricMeshManagementClientImpl client; + + /** + * Initializes an instance of GatewaysClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + GatewaysClientImpl(ServiceFabricMeshManagementClientImpl client) { + this.service = RestProxy.create(GatewaysService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ServiceFabricMeshManagementClientGateways to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ServiceFabricMeshMan") + private interface GatewaysService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh" + + "/gateways/{gatewayResourceName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ErrorErrorModelException.class) + Mono> create( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam(value = "gatewayResourceName", encoded = true) String gatewayResourceName, + @BodyParam("application/json") GatewayResourceDescriptionInner gatewayResourceDescription, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh" + + "/gateways/{gatewayResourceName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorErrorModelException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam(value = "gatewayResourceName", encoded = true) String gatewayResourceName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh" + + "/gateways/{gatewayResourceName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ErrorErrorModelException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam(value = "gatewayResourceName", encoded = true) String gatewayResourceName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh" + + "/gateways") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorErrorModelException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @PathParam("resourceGroupName") String resourceGroupName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabricMesh/gateways") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorErrorModelException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorErrorModelException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorErrorModelException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Creates a gateway resource with the specified name, description and properties. If a gateway resource with the + * same name exists, then it is updated with the specified description and properties. Use gateway resources to + * create a gateway for public connectivity for services within your application. + * + * @param resourceGroupName Azure resource group name. + * @param gatewayResourceName The identity of the gateway. + * @param gatewayResourceDescription Description for creating a Gateway resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this type describes a gateway resource along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync( + String resourceGroupName, + String gatewayResourceName, + GatewayResourceDescriptionInner gatewayResourceDescription) { + 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 (gatewayResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter gatewayResourceName is required and cannot be null.")); + } + if (gatewayResourceDescription == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter gatewayResourceDescription is required and cannot be null.")); + } else { + gatewayResourceDescription.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .create( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + resourceGroupName, + gatewayResourceName, + gatewayResourceDescription, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates a gateway resource with the specified name, description and properties. If a gateway resource with the + * same name exists, then it is updated with the specified description and properties. Use gateway resources to + * create a gateway for public connectivity for services within your application. + * + * @param resourceGroupName Azure resource group name. + * @param gatewayResourceName The identity of the gateway. + * @param gatewayResourceDescription Description for creating a Gateway resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this type describes a gateway resource along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync( + String resourceGroupName, + String gatewayResourceName, + GatewayResourceDescriptionInner gatewayResourceDescription, + 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 (gatewayResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter gatewayResourceName is required and cannot be null.")); + } + if (gatewayResourceDescription == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter gatewayResourceDescription is required and cannot be null.")); + } else { + gatewayResourceDescription.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .create( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + resourceGroupName, + gatewayResourceName, + gatewayResourceDescription, + accept, + context); + } + + /** + * Creates a gateway resource with the specified name, description and properties. If a gateway resource with the + * same name exists, then it is updated with the specified description and properties. Use gateway resources to + * create a gateway for public connectivity for services within your application. + * + * @param resourceGroupName Azure resource group name. + * @param gatewayResourceName The identity of the gateway. + * @param gatewayResourceDescription Description for creating a Gateway resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this type describes a gateway resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, + String gatewayResourceName, + GatewayResourceDescriptionInner gatewayResourceDescription) { + return createWithResponseAsync(resourceGroupName, gatewayResourceName, gatewayResourceDescription) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates a gateway resource with the specified name, description and properties. If a gateway resource with the + * same name exists, then it is updated with the specified description and properties. Use gateway resources to + * create a gateway for public connectivity for services within your application. + * + * @param resourceGroupName Azure resource group name. + * @param gatewayResourceName The identity of the gateway. + * @param gatewayResourceDescription Description for creating a Gateway resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this type describes a gateway resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GatewayResourceDescriptionInner create( + String resourceGroupName, + String gatewayResourceName, + GatewayResourceDescriptionInner gatewayResourceDescription) { + return createAsync(resourceGroupName, gatewayResourceName, gatewayResourceDescription).block(); + } + + /** + * Creates a gateway resource with the specified name, description and properties. If a gateway resource with the + * same name exists, then it is updated with the specified description and properties. Use gateway resources to + * create a gateway for public connectivity for services within your application. + * + * @param resourceGroupName Azure resource group name. + * @param gatewayResourceName The identity of the gateway. + * @param gatewayResourceDescription Description for creating a Gateway resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this type describes a gateway resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse( + String resourceGroupName, + String gatewayResourceName, + GatewayResourceDescriptionInner gatewayResourceDescription, + Context context) { + return createWithResponseAsync(resourceGroupName, gatewayResourceName, gatewayResourceDescription, context) + .block(); + } + + /** + * Gets the information about the gateway resource with the given name. The information include the description and + * other properties of the gateway. + * + * @param resourceGroupName Azure resource group name. + * @param gatewayResourceName The identity of the gateway. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about the gateway resource with the given name along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String gatewayResourceName) { + 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 (gatewayResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter gatewayResourceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + resourceGroupName, + gatewayResourceName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the information about the gateway resource with the given name. The information include the description and + * other properties of the gateway. + * + * @param resourceGroupName Azure resource group name. + * @param gatewayResourceName The identity of the gateway. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about the gateway resource with the given name along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String gatewayResourceName, 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 (gatewayResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter gatewayResourceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + resourceGroupName, + gatewayResourceName, + accept, + context); + } + + /** + * Gets the information about the gateway resource with the given name. The information include the description and + * other properties of the gateway. + * + * @param resourceGroupName Azure resource group name. + * @param gatewayResourceName The identity of the gateway. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about the gateway resource with the given name on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync( + String resourceGroupName, String gatewayResourceName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, gatewayResourceName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the information about the gateway resource with the given name. The information include the description and + * other properties of the gateway. + * + * @param resourceGroupName Azure resource group name. + * @param gatewayResourceName The identity of the gateway. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about the gateway resource with the given name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GatewayResourceDescriptionInner getByResourceGroup(String resourceGroupName, String gatewayResourceName) { + return getByResourceGroupAsync(resourceGroupName, gatewayResourceName).block(); + } + + /** + * Gets the information about the gateway resource with the given name. The information include the description and + * other properties of the gateway. + * + * @param resourceGroupName Azure resource group name. + * @param gatewayResourceName The identity of the gateway. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about the gateway resource with the given name along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String gatewayResourceName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, gatewayResourceName, context).block(); + } + + /** + * Deletes the gateway resource identified by the name. + * + * @param resourceGroupName Azure resource group name. + * @param gatewayResourceName The identity of the gateway. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException 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 gatewayResourceName) { + 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 (gatewayResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter gatewayResourceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + resourceGroupName, + gatewayResourceName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes the gateway resource identified by the name. + * + * @param resourceGroupName Azure resource group name. + * @param gatewayResourceName The identity of the gateway. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException 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 gatewayResourceName, 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 (gatewayResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter gatewayResourceName 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(), + this.client.getApiVersion(), + resourceGroupName, + gatewayResourceName, + accept, + context); + } + + /** + * Deletes the gateway resource identified by the name. + * + * @param resourceGroupName Azure resource group name. + * @param gatewayResourceName The identity of the gateway. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException 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 gatewayResourceName) { + return deleteWithResponseAsync(resourceGroupName, gatewayResourceName).flatMap(ignored -> Mono.empty()); + } + + /** + * Deletes the gateway resource identified by the name. + * + * @param resourceGroupName Azure resource group name. + * @param gatewayResourceName The identity of the gateway. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException 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 gatewayResourceName) { + deleteAsync(resourceGroupName, gatewayResourceName).block(); + } + + /** + * Deletes the gateway resource identified by the name. + * + * @param resourceGroupName Azure resource group name. + * @param gatewayResourceName The identity of the gateway. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException 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 gatewayResourceName, Context context) { + return deleteWithResponseAsync(resourceGroupName, gatewayResourceName, context).block(); + } + + /** + * Gets the information about all gateway resources in a given resource group. The information include the + * description and other properties of the Gateway. + * + * @param resourceGroupName Azure resource group name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all gateway resources in a given resource group along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + 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.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + resourceGroupName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the information about all gateway resources in a given resource group. The information include the + * description and other properties of the Gateway. + * + * @param resourceGroupName Azure resource group name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all gateway resources in a given resource group along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + 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.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + resourceGroupName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets the information about all gateway resources in a given resource group. The information include the + * description and other properties of the Gateway. + * + * @param resourceGroupName Azure resource group name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all gateway resources in a given resource group as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Gets the information about all gateway resources in a given resource group. The information include the + * description and other properties of the Gateway. + * + * @param resourceGroupName Azure resource group name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all gateway resources in a given resource group as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync( + String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets the information about all gateway resources in a given resource group. The information include the + * description and other properties of the Gateway. + * + * @param resourceGroupName Azure resource group name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all gateway resources in a given resource group as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Gets the information about all gateway resources in a given resource group. The information include the + * description and other properties of the Gateway. + * + * @param resourceGroupName Azure resource group name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all gateway resources in a given resource group as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup( + String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Gets the information about all gateway resources in a given resource group. The information include the + * description and other properties of the gateway. + * + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all gateway resources in a given resource group along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + 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())); + } + + /** + * Gets the information about all gateway resources in a given resource group. The information include the + * description and other properties of the gateway. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all gateway resources in a given resource group along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets the information about all gateway resources in a given resource group. The information include the + * description and other properties of the gateway. + * + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all gateway resources in a given resource group as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>( + () -> listSinglePageAsync(), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Gets the information about all gateway resources in a given resource group. The information include the + * description and other properties of the gateway. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all gateway resources in a given resource group as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets the information about all gateway resources in a given resource group. The information include the + * description and other properties of the gateway. + * + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all gateway resources in a given resource group as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Gets the information about all gateway resources in a given resource group. The information include the + * description and other properties of the gateway. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all gateway resources in a given resource group as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of gateway resources along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync( + 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.listByResourceGroupNext(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 nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of gateway resources along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync( + 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 + .listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of gateway resources along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync( + 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.listBySubscriptionNext(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 nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of gateway resources along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync( + 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 + .listBySubscriptionNext(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/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/GatewaysImpl.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/GatewaysImpl.java new file mode 100644 index 0000000000000..1f93147933e71 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/GatewaysImpl.java @@ -0,0 +1,173 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.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.servicefabricmesh.fluent.GatewaysClient; +import com.azure.resourcemanager.servicefabricmesh.fluent.models.GatewayResourceDescriptionInner; +import com.azure.resourcemanager.servicefabricmesh.models.GatewayResourceDescription; +import com.azure.resourcemanager.servicefabricmesh.models.Gateways; + +public final class GatewaysImpl implements Gateways { + private static final ClientLogger LOGGER = new ClientLogger(GatewaysImpl.class); + + private final GatewaysClient innerClient; + + private final com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager serviceManager; + + public GatewaysImpl( + GatewaysClient innerClient, + com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public GatewayResourceDescription getByResourceGroup(String resourceGroupName, String gatewayResourceName) { + GatewayResourceDescriptionInner inner = + this.serviceClient().getByResourceGroup(resourceGroupName, gatewayResourceName); + if (inner != null) { + return new GatewayResourceDescriptionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String gatewayResourceName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, gatewayResourceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new GatewayResourceDescriptionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String gatewayResourceName) { + this.serviceClient().delete(resourceGroupName, gatewayResourceName); + } + + public Response deleteWithResponse(String resourceGroupName, String gatewayResourceName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, gatewayResourceName, context); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new GatewayResourceDescriptionImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new GatewayResourceDescriptionImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new GatewayResourceDescriptionImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new GatewayResourceDescriptionImpl(inner1, this.manager())); + } + + public GatewayResourceDescription 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 gatewayResourceName = Utils.getValueFromIdByName(id, "gateways"); + if (gatewayResourceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'gateways'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, gatewayResourceName, 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 gatewayResourceName = Utils.getValueFromIdByName(id, "gateways"); + if (gatewayResourceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'gateways'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, gatewayResourceName, 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 gatewayResourceName = Utils.getValueFromIdByName(id, "gateways"); + if (gatewayResourceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'gateways'.", id))); + } + this.deleteWithResponse(resourceGroupName, gatewayResourceName, 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 gatewayResourceName = Utils.getValueFromIdByName(id, "gateways"); + if (gatewayResourceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'gateways'.", id))); + } + return this.deleteWithResponse(resourceGroupName, gatewayResourceName, context); + } + + private GatewaysClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager() { + return this.serviceManager; + } + + public GatewayResourceDescriptionImpl define(String name) { + return new GatewayResourceDescriptionImpl(name, this.manager()); + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/NetworkResourceDescriptionImpl.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/NetworkResourceDescriptionImpl.java new file mode 100644 index 0000000000000..be67fbb19c81f --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/NetworkResourceDescriptionImpl.java @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.servicefabricmesh.fluent.models.NetworkResourceDescriptionInner; +import com.azure.resourcemanager.servicefabricmesh.models.NetworkResourceDescription; +import com.azure.resourcemanager.servicefabricmesh.models.NetworkResourceProperties; +import java.util.Collections; +import java.util.Map; + +public final class NetworkResourceDescriptionImpl + implements NetworkResourceDescription, NetworkResourceDescription.Definition { + private NetworkResourceDescriptionInner innerObject; + + private final com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager serviceManager; + + NetworkResourceDescriptionImpl( + NetworkResourceDescriptionInner innerObject, + com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public NetworkResourceProperties properties() { + return this.innerModel().properties(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public NetworkResourceDescriptionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String networkResourceName; + + public NetworkResourceDescriptionImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public NetworkResourceDescription create() { + this.innerObject = + serviceManager + .serviceClient() + .getNetworks() + .createWithResponse(resourceGroupName, networkResourceName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public NetworkResourceDescription create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getNetworks() + .createWithResponse(resourceGroupName, networkResourceName, this.innerModel(), context) + .getValue(); + return this; + } + + NetworkResourceDescriptionImpl( + String name, com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager serviceManager) { + this.innerObject = new NetworkResourceDescriptionInner(); + this.serviceManager = serviceManager; + this.networkResourceName = name; + } + + public NetworkResourceDescription refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getNetworks() + .getByResourceGroupWithResponse(resourceGroupName, networkResourceName, Context.NONE) + .getValue(); + return this; + } + + public NetworkResourceDescription refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getNetworks() + .getByResourceGroupWithResponse(resourceGroupName, networkResourceName, context) + .getValue(); + return this; + } + + public NetworkResourceDescriptionImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public NetworkResourceDescriptionImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public NetworkResourceDescriptionImpl withProperties(NetworkResourceProperties properties) { + this.innerModel().withProperties(properties); + return this; + } + + public NetworkResourceDescriptionImpl withTags(Map tags) { + this.innerModel().withTags(tags); + return this; + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/NetworksClientImpl.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/NetworksClientImpl.java new file mode 100644 index 0000000000000..17064556c7253 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/NetworksClientImpl.java @@ -0,0 +1,1116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.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.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.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.servicefabricmesh.fluent.NetworksClient; +import com.azure.resourcemanager.servicefabricmesh.fluent.models.NetworkResourceDescriptionInner; +import com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException; +import com.azure.resourcemanager.servicefabricmesh.models.NetworkResourceDescriptionList; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in NetworksClient. */ +public final class NetworksClientImpl implements NetworksClient { + /** The proxy service used to perform REST calls. */ + private final NetworksService service; + + /** The service client containing this operation class. */ + private final ServiceFabricMeshManagementClientImpl client; + + /** + * Initializes an instance of NetworksClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + NetworksClientImpl(ServiceFabricMeshManagementClientImpl client) { + this.service = RestProxy.create(NetworksService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ServiceFabricMeshManagementClientNetworks to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ServiceFabricMeshMan") + private interface NetworksService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh" + + "/networks/{networkResourceName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ErrorErrorModelException.class) + Mono> create( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam(value = "networkResourceName", encoded = true) String networkResourceName, + @BodyParam("application/json") NetworkResourceDescriptionInner networkResourceDescription, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh" + + "/networks/{networkResourceName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorErrorModelException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam(value = "networkResourceName", encoded = true) String networkResourceName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh" + + "/networks/{networkResourceName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ErrorErrorModelException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam(value = "networkResourceName", encoded = true) String networkResourceName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh" + + "/networks") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorErrorModelException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @PathParam("resourceGroupName") String resourceGroupName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabricMesh/networks") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorErrorModelException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorErrorModelException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorErrorModelException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Creates a network resource with the specified name, description and properties. If a network resource with the + * same name exists, then it is updated with the specified description and properties. + * + * @param resourceGroupName Azure resource group name. + * @param networkResourceName The identity of the network. + * @param networkResourceDescription Description for creating a Network resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this type describes a network resource along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync( + String resourceGroupName, + String networkResourceName, + NetworkResourceDescriptionInner networkResourceDescription) { + 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 (networkResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter networkResourceName is required and cannot be null.")); + } + if (networkResourceDescription == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter networkResourceDescription is required and cannot be null.")); + } else { + networkResourceDescription.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .create( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + resourceGroupName, + networkResourceName, + networkResourceDescription, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates a network resource with the specified name, description and properties. If a network resource with the + * same name exists, then it is updated with the specified description and properties. + * + * @param resourceGroupName Azure resource group name. + * @param networkResourceName The identity of the network. + * @param networkResourceDescription Description for creating a Network resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this type describes a network resource along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync( + String resourceGroupName, + String networkResourceName, + NetworkResourceDescriptionInner networkResourceDescription, + 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 (networkResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter networkResourceName is required and cannot be null.")); + } + if (networkResourceDescription == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter networkResourceDescription is required and cannot be null.")); + } else { + networkResourceDescription.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .create( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + resourceGroupName, + networkResourceName, + networkResourceDescription, + accept, + context); + } + + /** + * Creates a network resource with the specified name, description and properties. If a network resource with the + * same name exists, then it is updated with the specified description and properties. + * + * @param resourceGroupName Azure resource group name. + * @param networkResourceName The identity of the network. + * @param networkResourceDescription Description for creating a Network resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this type describes a network resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, + String networkResourceName, + NetworkResourceDescriptionInner networkResourceDescription) { + return createWithResponseAsync(resourceGroupName, networkResourceName, networkResourceDescription) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates a network resource with the specified name, description and properties. If a network resource with the + * same name exists, then it is updated with the specified description and properties. + * + * @param resourceGroupName Azure resource group name. + * @param networkResourceName The identity of the network. + * @param networkResourceDescription Description for creating a Network resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this type describes a network resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public NetworkResourceDescriptionInner create( + String resourceGroupName, + String networkResourceName, + NetworkResourceDescriptionInner networkResourceDescription) { + return createAsync(resourceGroupName, networkResourceName, networkResourceDescription).block(); + } + + /** + * Creates a network resource with the specified name, description and properties. If a network resource with the + * same name exists, then it is updated with the specified description and properties. + * + * @param resourceGroupName Azure resource group name. + * @param networkResourceName The identity of the network. + * @param networkResourceDescription Description for creating a Network resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this type describes a network resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse( + String resourceGroupName, + String networkResourceName, + NetworkResourceDescriptionInner networkResourceDescription, + Context context) { + return createWithResponseAsync(resourceGroupName, networkResourceName, networkResourceDescription, context) + .block(); + } + + /** + * Gets the information about the network resource with the given name. The information include the description and + * other properties of the network. + * + * @param resourceGroupName Azure resource group name. + * @param networkResourceName The identity of the network. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about the network resource with the given name along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String networkResourceName) { + 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 (networkResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter networkResourceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + resourceGroupName, + networkResourceName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the information about the network resource with the given name. The information include the description and + * other properties of the network. + * + * @param resourceGroupName Azure resource group name. + * @param networkResourceName The identity of the network. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about the network resource with the given name along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String networkResourceName, 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 (networkResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter networkResourceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + resourceGroupName, + networkResourceName, + accept, + context); + } + + /** + * Gets the information about the network resource with the given name. The information include the description and + * other properties of the network. + * + * @param resourceGroupName Azure resource group name. + * @param networkResourceName The identity of the network. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about the network resource with the given name on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync( + String resourceGroupName, String networkResourceName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, networkResourceName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the information about the network resource with the given name. The information include the description and + * other properties of the network. + * + * @param resourceGroupName Azure resource group name. + * @param networkResourceName The identity of the network. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about the network resource with the given name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public NetworkResourceDescriptionInner getByResourceGroup(String resourceGroupName, String networkResourceName) { + return getByResourceGroupAsync(resourceGroupName, networkResourceName).block(); + } + + /** + * Gets the information about the network resource with the given name. The information include the description and + * other properties of the network. + * + * @param resourceGroupName Azure resource group name. + * @param networkResourceName The identity of the network. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about the network resource with the given name along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String networkResourceName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, networkResourceName, context).block(); + } + + /** + * Deletes the network resource identified by the name. + * + * @param resourceGroupName Azure resource group name. + * @param networkResourceName The identity of the network. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException 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 networkResourceName) { + 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 (networkResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter networkResourceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + resourceGroupName, + networkResourceName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes the network resource identified by the name. + * + * @param resourceGroupName Azure resource group name. + * @param networkResourceName The identity of the network. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException 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 networkResourceName, 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 (networkResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter networkResourceName 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(), + this.client.getApiVersion(), + resourceGroupName, + networkResourceName, + accept, + context); + } + + /** + * Deletes the network resource identified by the name. + * + * @param resourceGroupName Azure resource group name. + * @param networkResourceName The identity of the network. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException 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 networkResourceName) { + return deleteWithResponseAsync(resourceGroupName, networkResourceName).flatMap(ignored -> Mono.empty()); + } + + /** + * Deletes the network resource identified by the name. + * + * @param resourceGroupName Azure resource group name. + * @param networkResourceName The identity of the network. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException 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 networkResourceName) { + deleteAsync(resourceGroupName, networkResourceName).block(); + } + + /** + * Deletes the network resource identified by the name. + * + * @param resourceGroupName Azure resource group name. + * @param networkResourceName The identity of the network. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException 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 networkResourceName, Context context) { + return deleteWithResponseAsync(resourceGroupName, networkResourceName, context).block(); + } + + /** + * Gets the information about all network resources in a given resource group. The information include the + * description and other properties of the Network. + * + * @param resourceGroupName Azure resource group name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all network resources in a given resource group along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + 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.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + resourceGroupName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the information about all network resources in a given resource group. The information include the + * description and other properties of the Network. + * + * @param resourceGroupName Azure resource group name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all network resources in a given resource group along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + 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.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + resourceGroupName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets the information about all network resources in a given resource group. The information include the + * description and other properties of the Network. + * + * @param resourceGroupName Azure resource group name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all network resources in a given resource group as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Gets the information about all network resources in a given resource group. The information include the + * description and other properties of the Network. + * + * @param resourceGroupName Azure resource group name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all network resources in a given resource group as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync( + String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets the information about all network resources in a given resource group. The information include the + * description and other properties of the Network. + * + * @param resourceGroupName Azure resource group name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all network resources in a given resource group as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Gets the information about all network resources in a given resource group. The information include the + * description and other properties of the Network. + * + * @param resourceGroupName Azure resource group name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all network resources in a given resource group as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup( + String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Gets the information about all network resources in a given resource group. The information include the + * description and other properties of the network. + * + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all network resources in a given resource group along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + 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())); + } + + /** + * Gets the information about all network resources in a given resource group. The information include the + * description and other properties of the network. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all network resources in a given resource group along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets the information about all network resources in a given resource group. The information include the + * description and other properties of the network. + * + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all network resources in a given resource group as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>( + () -> listSinglePageAsync(), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Gets the information about all network resources in a given resource group. The information include the + * description and other properties of the network. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all network resources in a given resource group as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets the information about all network resources in a given resource group. The information include the + * description and other properties of the network. + * + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all network resources in a given resource group as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Gets the information about all network resources in a given resource group. The information include the + * description and other properties of the network. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all network resources in a given resource group as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of network resources along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync( + 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.listByResourceGroupNext(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 nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of network resources along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync( + 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 + .listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of network resources along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync( + 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.listBySubscriptionNext(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 nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of network resources along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync( + 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 + .listBySubscriptionNext(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/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/NetworksImpl.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/NetworksImpl.java new file mode 100644 index 0000000000000..4d35c401817b0 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/NetworksImpl.java @@ -0,0 +1,173 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.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.servicefabricmesh.fluent.NetworksClient; +import com.azure.resourcemanager.servicefabricmesh.fluent.models.NetworkResourceDescriptionInner; +import com.azure.resourcemanager.servicefabricmesh.models.NetworkResourceDescription; +import com.azure.resourcemanager.servicefabricmesh.models.Networks; + +public final class NetworksImpl implements Networks { + private static final ClientLogger LOGGER = new ClientLogger(NetworksImpl.class); + + private final NetworksClient innerClient; + + private final com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager serviceManager; + + public NetworksImpl( + NetworksClient innerClient, + com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public NetworkResourceDescription getByResourceGroup(String resourceGroupName, String networkResourceName) { + NetworkResourceDescriptionInner inner = + this.serviceClient().getByResourceGroup(resourceGroupName, networkResourceName); + if (inner != null) { + return new NetworkResourceDescriptionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String networkResourceName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, networkResourceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new NetworkResourceDescriptionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String networkResourceName) { + this.serviceClient().delete(resourceGroupName, networkResourceName); + } + + public Response deleteWithResponse(String resourceGroupName, String networkResourceName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, networkResourceName, context); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new NetworkResourceDescriptionImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new NetworkResourceDescriptionImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new NetworkResourceDescriptionImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new NetworkResourceDescriptionImpl(inner1, this.manager())); + } + + public NetworkResourceDescription 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 networkResourceName = Utils.getValueFromIdByName(id, "networks"); + if (networkResourceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'networks'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, networkResourceName, 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 networkResourceName = Utils.getValueFromIdByName(id, "networks"); + if (networkResourceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'networks'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, networkResourceName, 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 networkResourceName = Utils.getValueFromIdByName(id, "networks"); + if (networkResourceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'networks'.", id))); + } + this.deleteWithResponse(resourceGroupName, networkResourceName, 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 networkResourceName = Utils.getValueFromIdByName(id, "networks"); + if (networkResourceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'networks'.", id))); + } + return this.deleteWithResponse(resourceGroupName, networkResourceName, context); + } + + private NetworksClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager() { + return this.serviceManager; + } + + public NetworkResourceDescriptionImpl define(String name) { + return new NetworkResourceDescriptionImpl(name, this.manager()); + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/OperationResultImpl.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/OperationResultImpl.java new file mode 100644 index 0000000000000..08bd048ae5ca6 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/OperationResultImpl.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.servicefabricmesh.implementation; + +import com.azure.resourcemanager.servicefabricmesh.fluent.models.OperationResultInner; +import com.azure.resourcemanager.servicefabricmesh.models.AvailableOperationDisplay; +import com.azure.resourcemanager.servicefabricmesh.models.OperationResult; + +public final class OperationResultImpl implements OperationResult { + private OperationResultInner innerObject; + + private final com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager serviceManager; + + OperationResultImpl( + OperationResultInner innerObject, + com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public AvailableOperationDisplay display() { + return this.innerModel().display(); + } + + public String origin() { + return this.innerModel().origin(); + } + + public String nextLink() { + return this.innerModel().nextLink(); + } + + public OperationResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/OperationsClientImpl.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/OperationsClientImpl.java new file mode 100644 index 0000000000000..6d24215d2d5d4 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/OperationsClientImpl.java @@ -0,0 +1,274 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +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.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.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.servicefabricmesh.fluent.OperationsClient; +import com.azure.resourcemanager.servicefabricmesh.fluent.models.OperationResultInner; +import com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException; +import com.azure.resourcemanager.servicefabricmesh.models.OperationListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public final class OperationsClientImpl implements OperationsClient { + /** The proxy service used to perform REST calls. */ + private final OperationsService service; + + /** The service client containing this operation class. */ + private final ServiceFabricMeshManagementClientImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(ServiceFabricMeshManagementClientImpl client) { + this.service = + RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ServiceFabricMeshManagementClientOperations to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ServiceFabricMeshMan") + private interface OperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.ServiceFabricMesh/operations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorErrorModelException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorErrorModelException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists all the available operations provided by Service Fabric SeaBreeze resource provider. + * + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to list Service Fabric operations along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists all the available operations provided by Service Fabric SeaBreeze resource provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to list Service Fabric operations along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all the available operations provided by Service Fabric SeaBreeze resource provider. + * + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to list Service Fabric operations as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists all the available operations provided by Service Fabric SeaBreeze resource provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to list Service Fabric operations as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all the available operations provided by Service Fabric SeaBreeze resource provider. + * + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to list Service Fabric operations as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Lists all the available operations provided by Service Fabric SeaBreeze resource provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to list Service Fabric operations as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to list Service Fabric operations 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 nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to list Service Fabric operations 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/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/OperationsImpl.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/OperationsImpl.java new file mode 100644 index 0000000000000..322409a92ec27 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/OperationsImpl.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.servicefabricmesh.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.servicefabricmesh.fluent.OperationsClient; +import com.azure.resourcemanager.servicefabricmesh.fluent.models.OperationResultInner; +import com.azure.resourcemanager.servicefabricmesh.models.OperationResult; +import com.azure.resourcemanager.servicefabricmesh.models.Operations; + +public final class OperationsImpl implements Operations { + private static final ClientLogger LOGGER = new ClientLogger(OperationsImpl.class); + + private final OperationsClient innerClient; + + private final com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager serviceManager; + + public OperationsImpl( + OperationsClient innerClient, + com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new OperationResultImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new OperationResultImpl(inner1, this.manager())); + } + + private OperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/SecretResourceDescriptionImpl.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/SecretResourceDescriptionImpl.java new file mode 100644 index 0000000000000..9ddbb7d6fee0c --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/SecretResourceDescriptionImpl.java @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.servicefabricmesh.fluent.models.SecretResourceDescriptionInner; +import com.azure.resourcemanager.servicefabricmesh.models.SecretResourceDescription; +import com.azure.resourcemanager.servicefabricmesh.models.SecretResourceProperties; +import java.util.Collections; +import java.util.Map; + +public final class SecretResourceDescriptionImpl + implements SecretResourceDescription, SecretResourceDescription.Definition { + private SecretResourceDescriptionInner innerObject; + + private final com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager serviceManager; + + SecretResourceDescriptionImpl( + SecretResourceDescriptionInner innerObject, + com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public SecretResourceProperties properties() { + return this.innerModel().properties(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public SecretResourceDescriptionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String secretResourceName; + + public SecretResourceDescriptionImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public SecretResourceDescription create() { + this.innerObject = + serviceManager + .serviceClient() + .getSecrets() + .createWithResponse(resourceGroupName, secretResourceName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public SecretResourceDescription create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSecrets() + .createWithResponse(resourceGroupName, secretResourceName, this.innerModel(), context) + .getValue(); + return this; + } + + SecretResourceDescriptionImpl( + String name, com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager serviceManager) { + this.innerObject = new SecretResourceDescriptionInner(); + this.serviceManager = serviceManager; + this.secretResourceName = name; + } + + public SecretResourceDescription refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getSecrets() + .getByResourceGroupWithResponse(resourceGroupName, secretResourceName, Context.NONE) + .getValue(); + return this; + } + + public SecretResourceDescription refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSecrets() + .getByResourceGroupWithResponse(resourceGroupName, secretResourceName, context) + .getValue(); + return this; + } + + public SecretResourceDescriptionImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public SecretResourceDescriptionImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public SecretResourceDescriptionImpl withProperties(SecretResourceProperties properties) { + this.innerModel().withProperties(properties); + return this; + } + + public SecretResourceDescriptionImpl withTags(Map tags) { + this.innerModel().withTags(tags); + return this; + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/SecretValueImpl.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/SecretValueImpl.java new file mode 100644 index 0000000000000..bdb377ddfa1ab --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/SecretValueImpl.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.implementation; + +import com.azure.resourcemanager.servicefabricmesh.fluent.models.SecretValueInner; +import com.azure.resourcemanager.servicefabricmesh.models.SecretValue; + +public final class SecretValueImpl implements SecretValue { + private SecretValueInner innerObject; + + private final com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager serviceManager; + + SecretValueImpl( + SecretValueInner innerObject, + com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String value() { + return this.innerModel().value(); + } + + public SecretValueInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/SecretValueResourceDescriptionImpl.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/SecretValueResourceDescriptionImpl.java new file mode 100644 index 0000000000000..cc3d613a67d05 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/SecretValueResourceDescriptionImpl.java @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.servicefabricmesh.fluent.models.SecretValueResourceDescriptionInner; +import com.azure.resourcemanager.servicefabricmesh.models.SecretValue; +import com.azure.resourcemanager.servicefabricmesh.models.SecretValueResourceDescription; +import java.util.Collections; +import java.util.Map; + +public final class SecretValueResourceDescriptionImpl + implements SecretValueResourceDescription, SecretValueResourceDescription.Definition { + private SecretValueResourceDescriptionInner innerObject; + + private final com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager serviceManager; + + SecretValueResourceDescriptionImpl( + SecretValueResourceDescriptionInner innerObject, + com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public String value() { + return this.innerModel().value(); + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public SecretValueResourceDescriptionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String secretResourceName; + + private String secretValueResourceName; + + public SecretValueResourceDescriptionImpl withExistingSecret(String resourceGroupName, String secretResourceName) { + this.resourceGroupName = resourceGroupName; + this.secretResourceName = secretResourceName; + return this; + } + + public SecretValueResourceDescription create() { + this.innerObject = + serviceManager + .serviceClient() + .getSecretValues() + .createWithResponse( + resourceGroupName, secretResourceName, secretValueResourceName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public SecretValueResourceDescription create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSecretValues() + .createWithResponse( + resourceGroupName, secretResourceName, secretValueResourceName, this.innerModel(), context) + .getValue(); + return this; + } + + SecretValueResourceDescriptionImpl( + String name, com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager serviceManager) { + this.innerObject = new SecretValueResourceDescriptionInner(); + this.serviceManager = serviceManager; + this.secretValueResourceName = name; + } + + public SecretValueResourceDescription refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getSecretValues() + .getWithResponse(resourceGroupName, secretResourceName, secretValueResourceName, Context.NONE) + .getValue(); + return this; + } + + public SecretValueResourceDescription refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSecretValues() + .getWithResponse(resourceGroupName, secretResourceName, secretValueResourceName, context) + .getValue(); + return this; + } + + public SecretValue listValue() { + return serviceManager.secretValues().listValue(resourceGroupName, secretResourceName, secretValueResourceName); + } + + public Response listValueWithResponse(Context context) { + return serviceManager + .secretValues() + .listValueWithResponse(resourceGroupName, secretResourceName, secretValueResourceName, context); + } + + public SecretValueResourceDescriptionImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public SecretValueResourceDescriptionImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public SecretValueResourceDescriptionImpl withTags(Map tags) { + this.innerModel().withTags(tags); + return this; + } + + public SecretValueResourceDescriptionImpl withValue(String value) { + this.innerModel().withValue(value); + return this; + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/SecretValuesClientImpl.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/SecretValuesClientImpl.java new file mode 100644 index 0000000000000..b65604b2f8e16 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/SecretValuesClientImpl.java @@ -0,0 +1,1162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.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.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.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.servicefabricmesh.fluent.SecretValuesClient; +import com.azure.resourcemanager.servicefabricmesh.fluent.models.SecretValueInner; +import com.azure.resourcemanager.servicefabricmesh.fluent.models.SecretValueResourceDescriptionInner; +import com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException; +import com.azure.resourcemanager.servicefabricmesh.models.SecretValueResourceDescriptionList; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in SecretValuesClient. */ +public final class SecretValuesClientImpl implements SecretValuesClient { + /** The proxy service used to perform REST calls. */ + private final SecretValuesService service; + + /** The service client containing this operation class. */ + private final ServiceFabricMeshManagementClientImpl client; + + /** + * Initializes an instance of SecretValuesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SecretValuesClientImpl(ServiceFabricMeshManagementClientImpl client) { + this.service = + RestProxy.create(SecretValuesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ServiceFabricMeshManagementClientSecretValues to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ServiceFabricMeshMan") + private interface SecretValuesService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh" + + "/secrets/{secretResourceName}/values/{secretValueResourceName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ErrorErrorModelException.class) + Mono> create( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam(value = "secretResourceName", encoded = true) String secretResourceName, + @PathParam(value = "secretValueResourceName", encoded = true) String secretValueResourceName, + @BodyParam("application/json") SecretValueResourceDescriptionInner secretValueResourceDescription, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh" + + "/secrets/{secretResourceName}/values/{secretValueResourceName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorErrorModelException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam(value = "secretResourceName", encoded = true) String secretResourceName, + @PathParam(value = "secretValueResourceName", encoded = true) String secretValueResourceName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh" + + "/secrets/{secretResourceName}/values/{secretValueResourceName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ErrorErrorModelException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam(value = "secretResourceName", encoded = true) String secretResourceName, + @PathParam(value = "secretValueResourceName", encoded = true) String secretValueResourceName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh" + + "/secrets/{secretResourceName}/values") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorErrorModelException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam(value = "secretResourceName", encoded = true) String secretResourceName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh" + + "/secrets/{secretResourceName}/values/{secretValueResourceName}/list_value") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorErrorModelException.class) + Mono> listValue( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam(value = "secretResourceName", encoded = true) String secretResourceName, + @PathParam(value = "secretValueResourceName", encoded = true) String secretValueResourceName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorErrorModelException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Creates a new value of the specified secret resource. The name of the value is typically the version identifier. + * Once created the value cannot be changed. + * + * @param resourceGroupName Azure resource group name. + * @param secretResourceName The name of the secret resource. + * @param secretValueResourceName The name of the secret resource value which is typically the version identifier + * for the value. + * @param secretValueResourceDescription Description for creating a value of a secret resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this type describes a value of a secret resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync( + String resourceGroupName, + String secretResourceName, + String secretValueResourceName, + SecretValueResourceDescriptionInner secretValueResourceDescription) { + 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 (secretResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter secretResourceName is required and cannot be null.")); + } + if (secretValueResourceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter secretValueResourceName is required and cannot be null.")); + } + if (secretValueResourceDescription == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter secretValueResourceDescription is required and cannot be null.")); + } else { + secretValueResourceDescription.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .create( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + resourceGroupName, + secretResourceName, + secretValueResourceName, + secretValueResourceDescription, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates a new value of the specified secret resource. The name of the value is typically the version identifier. + * Once created the value cannot be changed. + * + * @param resourceGroupName Azure resource group name. + * @param secretResourceName The name of the secret resource. + * @param secretValueResourceName The name of the secret resource value which is typically the version identifier + * for the value. + * @param secretValueResourceDescription Description for creating a value of a secret resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this type describes a value of a secret resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync( + String resourceGroupName, + String secretResourceName, + String secretValueResourceName, + SecretValueResourceDescriptionInner secretValueResourceDescription, + 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 (secretResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter secretResourceName is required and cannot be null.")); + } + if (secretValueResourceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter secretValueResourceName is required and cannot be null.")); + } + if (secretValueResourceDescription == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter secretValueResourceDescription is required and cannot be null.")); + } else { + secretValueResourceDescription.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .create( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + resourceGroupName, + secretResourceName, + secretValueResourceName, + secretValueResourceDescription, + accept, + context); + } + + /** + * Creates a new value of the specified secret resource. The name of the value is typically the version identifier. + * Once created the value cannot be changed. + * + * @param resourceGroupName Azure resource group name. + * @param secretResourceName The name of the secret resource. + * @param secretValueResourceName The name of the secret resource value which is typically the version identifier + * for the value. + * @param secretValueResourceDescription Description for creating a value of a secret resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this type describes a value of a secret resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, + String secretResourceName, + String secretValueResourceName, + SecretValueResourceDescriptionInner secretValueResourceDescription) { + return createWithResponseAsync( + resourceGroupName, secretResourceName, secretValueResourceName, secretValueResourceDescription) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates a new value of the specified secret resource. The name of the value is typically the version identifier. + * Once created the value cannot be changed. + * + * @param resourceGroupName Azure resource group name. + * @param secretResourceName The name of the secret resource. + * @param secretValueResourceName The name of the secret resource value which is typically the version identifier + * for the value. + * @param secretValueResourceDescription Description for creating a value of a secret resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this type describes a value of a secret resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SecretValueResourceDescriptionInner create( + String resourceGroupName, + String secretResourceName, + String secretValueResourceName, + SecretValueResourceDescriptionInner secretValueResourceDescription) { + return createAsync( + resourceGroupName, secretResourceName, secretValueResourceName, secretValueResourceDescription) + .block(); + } + + /** + * Creates a new value of the specified secret resource. The name of the value is typically the version identifier. + * Once created the value cannot be changed. + * + * @param resourceGroupName Azure resource group name. + * @param secretResourceName The name of the secret resource. + * @param secretValueResourceName The name of the secret resource value which is typically the version identifier + * for the value. + * @param secretValueResourceDescription Description for creating a value of a secret resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this type describes a value of a secret resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse( + String resourceGroupName, + String secretResourceName, + String secretValueResourceName, + SecretValueResourceDescriptionInner secretValueResourceDescription, + Context context) { + return createWithResponseAsync( + resourceGroupName, secretResourceName, secretValueResourceName, secretValueResourceDescription, context) + .block(); + } + + /** + * Get the information about the specified named secret value resources. The information does not include the actual + * value of the secret. + * + * @param resourceGroupName Azure resource group name. + * @param secretResourceName The name of the secret resource. + * @param secretValueResourceName The name of the secret resource value which is typically the version identifier + * for the value. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about the specified named secret value resources along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String secretResourceName, String secretValueResourceName) { + 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 (secretResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter secretResourceName is required and cannot be null.")); + } + if (secretValueResourceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter secretValueResourceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + resourceGroupName, + secretResourceName, + secretValueResourceName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the information about the specified named secret value resources. The information does not include the actual + * value of the secret. + * + * @param resourceGroupName Azure resource group name. + * @param secretResourceName The name of the secret resource. + * @param secretValueResourceName The name of the secret resource value which is typically the version identifier + * for the value. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about the specified named secret value resources along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String secretResourceName, String secretValueResourceName, 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 (secretResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter secretResourceName is required and cannot be null.")); + } + if (secretValueResourceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter secretValueResourceName 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(), + this.client.getApiVersion(), + resourceGroupName, + secretResourceName, + secretValueResourceName, + accept, + context); + } + + /** + * Get the information about the specified named secret value resources. The information does not include the actual + * value of the secret. + * + * @param resourceGroupName Azure resource group name. + * @param secretResourceName The name of the secret resource. + * @param secretValueResourceName The name of the secret resource value which is typically the version identifier + * for the value. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about the specified named secret value resources on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String secretResourceName, String secretValueResourceName) { + return getWithResponseAsync(resourceGroupName, secretResourceName, secretValueResourceName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get the information about the specified named secret value resources. The information does not include the actual + * value of the secret. + * + * @param resourceGroupName Azure resource group name. + * @param secretResourceName The name of the secret resource. + * @param secretValueResourceName The name of the secret resource value which is typically the version identifier + * for the value. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about the specified named secret value resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SecretValueResourceDescriptionInner get( + String resourceGroupName, String secretResourceName, String secretValueResourceName) { + return getAsync(resourceGroupName, secretResourceName, secretValueResourceName).block(); + } + + /** + * Get the information about the specified named secret value resources. The information does not include the actual + * value of the secret. + * + * @param resourceGroupName Azure resource group name. + * @param secretResourceName The name of the secret resource. + * @param secretValueResourceName The name of the secret resource value which is typically the version identifier + * for the value. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about the specified named secret value resources along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String secretResourceName, String secretValueResourceName, Context context) { + return getWithResponseAsync(resourceGroupName, secretResourceName, secretValueResourceName, context).block(); + } + + /** + * Deletes the secret value resource identified by the name. The name of the resource is typically the version + * associated with that value. Deletion will fail if the specified value is in use. + * + * @param resourceGroupName Azure resource group name. + * @param secretResourceName The name of the secret resource. + * @param secretValueResourceName The name of the secret resource value which is typically the version identifier + * for the value. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException 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 secretResourceName, String secretValueResourceName) { + 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 (secretResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter secretResourceName is required and cannot be null.")); + } + if (secretValueResourceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter secretValueResourceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + resourceGroupName, + secretResourceName, + secretValueResourceName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes the secret value resource identified by the name. The name of the resource is typically the version + * associated with that value. Deletion will fail if the specified value is in use. + * + * @param resourceGroupName Azure resource group name. + * @param secretResourceName The name of the secret resource. + * @param secretValueResourceName The name of the secret resource value which is typically the version identifier + * for the value. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException 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 secretResourceName, String secretValueResourceName, 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 (secretResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter secretResourceName is required and cannot be null.")); + } + if (secretValueResourceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter secretValueResourceName 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(), + this.client.getApiVersion(), + resourceGroupName, + secretResourceName, + secretValueResourceName, + accept, + context); + } + + /** + * Deletes the secret value resource identified by the name. The name of the resource is typically the version + * associated with that value. Deletion will fail if the specified value is in use. + * + * @param resourceGroupName Azure resource group name. + * @param secretResourceName The name of the secret resource. + * @param secretValueResourceName The name of the secret resource value which is typically the version identifier + * for the value. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException 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 secretResourceName, String secretValueResourceName) { + return deleteWithResponseAsync(resourceGroupName, secretResourceName, secretValueResourceName) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Deletes the secret value resource identified by the name. The name of the resource is typically the version + * associated with that value. Deletion will fail if the specified value is in use. + * + * @param resourceGroupName Azure resource group name. + * @param secretResourceName The name of the secret resource. + * @param secretValueResourceName The name of the secret resource value which is typically the version identifier + * for the value. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException 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 secretResourceName, String secretValueResourceName) { + deleteAsync(resourceGroupName, secretResourceName, secretValueResourceName).block(); + } + + /** + * Deletes the secret value resource identified by the name. The name of the resource is typically the version + * associated with that value. Deletion will fail if the specified value is in use. + * + * @param resourceGroupName Azure resource group name. + * @param secretResourceName The name of the secret resource. + * @param secretValueResourceName The name of the secret resource value which is typically the version identifier + * for the value. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException 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 secretResourceName, String secretValueResourceName, Context context) { + return deleteWithResponseAsync(resourceGroupName, secretResourceName, secretValueResourceName, context).block(); + } + + /** + * Gets information about all secret value resources of the specified secret resource. The information includes the + * names of the secret value resources, but not the actual values. + * + * @param resourceGroupName Azure resource group name. + * @param secretResourceName The name of the secret resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about all secret value resources of the specified secret resource along with {@link + * PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String secretResourceName) { + 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 (secretResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter secretResourceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + resourceGroupName, + secretResourceName, + 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())); + } + + /** + * Gets information about all secret value resources of the specified secret resource. The information includes the + * names of the secret value resources, but not the actual values. + * + * @param resourceGroupName Azure resource group name. + * @param secretResourceName The name of the secret resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about all secret value resources of the specified secret resource along with {@link + * PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String secretResourceName, 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 (secretResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter secretResourceName 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(), + this.client.getApiVersion(), + resourceGroupName, + secretResourceName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets information about all secret value resources of the specified secret resource. The information includes the + * names of the secret value resources, but not the actual values. + * + * @param resourceGroupName Azure resource group name. + * @param secretResourceName The name of the secret resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about all secret value resources of the specified secret resource as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, String secretResourceName) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, secretResourceName), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets information about all secret value resources of the specified secret resource. The information includes the + * names of the secret value resources, but not the actual values. + * + * @param resourceGroupName Azure resource group name. + * @param secretResourceName The name of the secret resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about all secret value resources of the specified secret resource as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, String secretResourceName, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, secretResourceName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets information about all secret value resources of the specified secret resource. The information includes the + * names of the secret value resources, but not the actual values. + * + * @param resourceGroupName Azure resource group name. + * @param secretResourceName The name of the secret resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about all secret value resources of the specified secret resource as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, String secretResourceName) { + return new PagedIterable<>(listAsync(resourceGroupName, secretResourceName)); + } + + /** + * Gets information about all secret value resources of the specified secret resource. The information includes the + * names of the secret value resources, but not the actual values. + * + * @param resourceGroupName Azure resource group name. + * @param secretResourceName The name of the secret resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about all secret value resources of the specified secret resource as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, String secretResourceName, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, secretResourceName, context)); + } + + /** + * Lists the decrypted value of the specified named value of the secret resource. This is a privileged operation. + * + * @param resourceGroupName Azure resource group name. + * @param secretResourceName The name of the secret resource. + * @param secretValueResourceName The name of the secret resource value which is typically the version identifier + * for the value. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this type represents the unencrypted value of the secret along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listValueWithResponseAsync( + String resourceGroupName, String secretResourceName, String secretValueResourceName) { + 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 (secretResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter secretResourceName is required and cannot be null.")); + } + if (secretValueResourceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter secretValueResourceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listValue( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + resourceGroupName, + secretResourceName, + secretValueResourceName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the decrypted value of the specified named value of the secret resource. This is a privileged operation. + * + * @param resourceGroupName Azure resource group name. + * @param secretResourceName The name of the secret resource. + * @param secretValueResourceName The name of the secret resource value which is typically the version identifier + * for the value. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this type represents the unencrypted value of the secret along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listValueWithResponseAsync( + String resourceGroupName, String secretResourceName, String secretValueResourceName, 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 (secretResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter secretResourceName is required and cannot be null.")); + } + if (secretValueResourceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter secretValueResourceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listValue( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + resourceGroupName, + secretResourceName, + secretValueResourceName, + accept, + context); + } + + /** + * Lists the decrypted value of the specified named value of the secret resource. This is a privileged operation. + * + * @param resourceGroupName Azure resource group name. + * @param secretResourceName The name of the secret resource. + * @param secretValueResourceName The name of the secret resource value which is typically the version identifier + * for the value. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this type represents the unencrypted value of the secret on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listValueAsync( + String resourceGroupName, String secretResourceName, String secretValueResourceName) { + return listValueWithResponseAsync(resourceGroupName, secretResourceName, secretValueResourceName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Lists the decrypted value of the specified named value of the secret resource. This is a privileged operation. + * + * @param resourceGroupName Azure resource group name. + * @param secretResourceName The name of the secret resource. + * @param secretValueResourceName The name of the secret resource value which is typically the version identifier + * for the value. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this type represents the unencrypted value of the secret. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SecretValueInner listValue( + String resourceGroupName, String secretResourceName, String secretValueResourceName) { + return listValueAsync(resourceGroupName, secretResourceName, secretValueResourceName).block(); + } + + /** + * Lists the decrypted value of the specified named value of the secret resource. This is a privileged operation. + * + * @param resourceGroupName Azure resource group name. + * @param secretResourceName The name of the secret resource. + * @param secretValueResourceName The name of the secret resource value which is typically the version identifier + * for the value. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this type represents the unencrypted value of the secret along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listValueWithResponse( + String resourceGroupName, String secretResourceName, String secretValueResourceName, Context context) { + return listValueWithResponseAsync(resourceGroupName, secretResourceName, secretValueResourceName, context) + .block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of values of a secret resource 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 nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of values of a secret resource 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/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/SecretValuesImpl.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/SecretValuesImpl.java new file mode 100644 index 0000000000000..57045a9dd46f5 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/SecretValuesImpl.java @@ -0,0 +1,229 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.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.servicefabricmesh.fluent.SecretValuesClient; +import com.azure.resourcemanager.servicefabricmesh.fluent.models.SecretValueInner; +import com.azure.resourcemanager.servicefabricmesh.fluent.models.SecretValueResourceDescriptionInner; +import com.azure.resourcemanager.servicefabricmesh.models.SecretValue; +import com.azure.resourcemanager.servicefabricmesh.models.SecretValueResourceDescription; +import com.azure.resourcemanager.servicefabricmesh.models.SecretValues; + +public final class SecretValuesImpl implements SecretValues { + private static final ClientLogger LOGGER = new ClientLogger(SecretValuesImpl.class); + + private final SecretValuesClient innerClient; + + private final com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager serviceManager; + + public SecretValuesImpl( + SecretValuesClient innerClient, + com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public SecretValueResourceDescription get( + String resourceGroupName, String secretResourceName, String secretValueResourceName) { + SecretValueResourceDescriptionInner inner = + this.serviceClient().get(resourceGroupName, secretResourceName, secretValueResourceName); + if (inner != null) { + return new SecretValueResourceDescriptionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String secretResourceName, String secretValueResourceName, Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, secretResourceName, secretValueResourceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SecretValueResourceDescriptionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String secretResourceName, String secretValueResourceName) { + this.serviceClient().delete(resourceGroupName, secretResourceName, secretValueResourceName); + } + + public Response deleteWithResponse( + String resourceGroupName, String secretResourceName, String secretValueResourceName, Context context) { + return this + .serviceClient() + .deleteWithResponse(resourceGroupName, secretResourceName, secretValueResourceName, context); + } + + public PagedIterable list(String resourceGroupName, String secretResourceName) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, secretResourceName); + return Utils.mapPage(inner, inner1 -> new SecretValueResourceDescriptionImpl(inner1, this.manager())); + } + + public PagedIterable list( + String resourceGroupName, String secretResourceName, Context context) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, secretResourceName, context); + return Utils.mapPage(inner, inner1 -> new SecretValueResourceDescriptionImpl(inner1, this.manager())); + } + + public SecretValue listValue(String resourceGroupName, String secretResourceName, String secretValueResourceName) { + SecretValueInner inner = + this.serviceClient().listValue(resourceGroupName, secretResourceName, secretValueResourceName); + if (inner != null) { + return new SecretValueImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response listValueWithResponse( + String resourceGroupName, String secretResourceName, String secretValueResourceName, Context context) { + Response inner = + this + .serviceClient() + .listValueWithResponse(resourceGroupName, secretResourceName, secretValueResourceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SecretValueImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public SecretValueResourceDescription 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 secretResourceName = Utils.getValueFromIdByName(id, "secrets"); + if (secretResourceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'secrets'.", id))); + } + String secretValueResourceName = Utils.getValueFromIdByName(id, "values"); + if (secretValueResourceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'values'.", id))); + } + return this + .getWithResponse(resourceGroupName, secretResourceName, secretValueResourceName, 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 secretResourceName = Utils.getValueFromIdByName(id, "secrets"); + if (secretResourceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'secrets'.", id))); + } + String secretValueResourceName = Utils.getValueFromIdByName(id, "values"); + if (secretValueResourceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'values'.", id))); + } + return this.getWithResponse(resourceGroupName, secretResourceName, secretValueResourceName, 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 secretResourceName = Utils.getValueFromIdByName(id, "secrets"); + if (secretResourceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'secrets'.", id))); + } + String secretValueResourceName = Utils.getValueFromIdByName(id, "values"); + if (secretValueResourceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'values'.", id))); + } + this.deleteWithResponse(resourceGroupName, secretResourceName, secretValueResourceName, 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 secretResourceName = Utils.getValueFromIdByName(id, "secrets"); + if (secretResourceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'secrets'.", id))); + } + String secretValueResourceName = Utils.getValueFromIdByName(id, "values"); + if (secretValueResourceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'values'.", id))); + } + return this.deleteWithResponse(resourceGroupName, secretResourceName, secretValueResourceName, context); + } + + private SecretValuesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager() { + return this.serviceManager; + } + + public SecretValueResourceDescriptionImpl define(String name) { + return new SecretValueResourceDescriptionImpl(name, this.manager()); + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/SecretsClientImpl.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/SecretsClientImpl.java new file mode 100644 index 0000000000000..637f16b75b0c0 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/SecretsClientImpl.java @@ -0,0 +1,1109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.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.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.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.servicefabricmesh.fluent.SecretsClient; +import com.azure.resourcemanager.servicefabricmesh.fluent.models.SecretResourceDescriptionInner; +import com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException; +import com.azure.resourcemanager.servicefabricmesh.models.SecretResourceDescriptionList; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in SecretsClient. */ +public final class SecretsClientImpl implements SecretsClient { + /** The proxy service used to perform REST calls. */ + private final SecretsService service; + + /** The service client containing this operation class. */ + private final ServiceFabricMeshManagementClientImpl client; + + /** + * Initializes an instance of SecretsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SecretsClientImpl(ServiceFabricMeshManagementClientImpl client) { + this.service = RestProxy.create(SecretsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ServiceFabricMeshManagementClientSecrets to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ServiceFabricMeshMan") + private interface SecretsService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh" + + "/secrets/{secretResourceName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ErrorErrorModelException.class) + Mono> create( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam(value = "secretResourceName", encoded = true) String secretResourceName, + @BodyParam("application/json") SecretResourceDescriptionInner secretResourceDescription, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh" + + "/secrets/{secretResourceName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorErrorModelException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam(value = "secretResourceName", encoded = true) String secretResourceName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh" + + "/secrets/{secretResourceName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ErrorErrorModelException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam(value = "secretResourceName", encoded = true) String secretResourceName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh" + + "/secrets") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorErrorModelException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @PathParam("resourceGroupName") String resourceGroupName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabricMesh/secrets") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorErrorModelException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorErrorModelException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorErrorModelException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Creates a secret resource with the specified name, description and properties. If a secret resource with the same + * name exists, then it is updated with the specified description and properties. + * + * @param resourceGroupName Azure resource group name. + * @param secretResourceName The name of the secret resource. + * @param secretResourceDescription Description for creating a secret resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this type describes a secret resource along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync( + String resourceGroupName, String secretResourceName, SecretResourceDescriptionInner secretResourceDescription) { + 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 (secretResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter secretResourceName is required and cannot be null.")); + } + if (secretResourceDescription == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter secretResourceDescription is required and cannot be null.")); + } else { + secretResourceDescription.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .create( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + resourceGroupName, + secretResourceName, + secretResourceDescription, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates a secret resource with the specified name, description and properties. If a secret resource with the same + * name exists, then it is updated with the specified description and properties. + * + * @param resourceGroupName Azure resource group name. + * @param secretResourceName The name of the secret resource. + * @param secretResourceDescription Description for creating a secret resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this type describes a secret resource along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync( + String resourceGroupName, + String secretResourceName, + SecretResourceDescriptionInner secretResourceDescription, + 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 (secretResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter secretResourceName is required and cannot be null.")); + } + if (secretResourceDescription == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter secretResourceDescription is required and cannot be null.")); + } else { + secretResourceDescription.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .create( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + resourceGroupName, + secretResourceName, + secretResourceDescription, + accept, + context); + } + + /** + * Creates a secret resource with the specified name, description and properties. If a secret resource with the same + * name exists, then it is updated with the specified description and properties. + * + * @param resourceGroupName Azure resource group name. + * @param secretResourceName The name of the secret resource. + * @param secretResourceDescription Description for creating a secret resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this type describes a secret resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, String secretResourceName, SecretResourceDescriptionInner secretResourceDescription) { + return createWithResponseAsync(resourceGroupName, secretResourceName, secretResourceDescription) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates a secret resource with the specified name, description and properties. If a secret resource with the same + * name exists, then it is updated with the specified description and properties. + * + * @param resourceGroupName Azure resource group name. + * @param secretResourceName The name of the secret resource. + * @param secretResourceDescription Description for creating a secret resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this type describes a secret resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SecretResourceDescriptionInner create( + String resourceGroupName, String secretResourceName, SecretResourceDescriptionInner secretResourceDescription) { + return createAsync(resourceGroupName, secretResourceName, secretResourceDescription).block(); + } + + /** + * Creates a secret resource with the specified name, description and properties. If a secret resource with the same + * name exists, then it is updated with the specified description and properties. + * + * @param resourceGroupName Azure resource group name. + * @param secretResourceName The name of the secret resource. + * @param secretResourceDescription Description for creating a secret resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this type describes a secret resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse( + String resourceGroupName, + String secretResourceName, + SecretResourceDescriptionInner secretResourceDescription, + Context context) { + return createWithResponseAsync(resourceGroupName, secretResourceName, secretResourceDescription, context) + .block(); + } + + /** + * Gets the information about the secret resource with the given name. The information include the description and + * other properties of the secret. + * + * @param resourceGroupName Azure resource group name. + * @param secretResourceName The name of the secret resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about the secret resource with the given name along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String secretResourceName) { + 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 (secretResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter secretResourceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + resourceGroupName, + secretResourceName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the information about the secret resource with the given name. The information include the description and + * other properties of the secret. + * + * @param resourceGroupName Azure resource group name. + * @param secretResourceName The name of the secret resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about the secret resource with the given name along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String secretResourceName, 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 (secretResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter secretResourceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + resourceGroupName, + secretResourceName, + accept, + context); + } + + /** + * Gets the information about the secret resource with the given name. The information include the description and + * other properties of the secret. + * + * @param resourceGroupName Azure resource group name. + * @param secretResourceName The name of the secret resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about the secret resource with the given name on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync( + String resourceGroupName, String secretResourceName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, secretResourceName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the information about the secret resource with the given name. The information include the description and + * other properties of the secret. + * + * @param resourceGroupName Azure resource group name. + * @param secretResourceName The name of the secret resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about the secret resource with the given name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SecretResourceDescriptionInner getByResourceGroup(String resourceGroupName, String secretResourceName) { + return getByResourceGroupAsync(resourceGroupName, secretResourceName).block(); + } + + /** + * Gets the information about the secret resource with the given name. The information include the description and + * other properties of the secret. + * + * @param resourceGroupName Azure resource group name. + * @param secretResourceName The name of the secret resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about the secret resource with the given name along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String secretResourceName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, secretResourceName, context).block(); + } + + /** + * Deletes the secret resource identified by the name. + * + * @param resourceGroupName Azure resource group name. + * @param secretResourceName The name of the secret resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException 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 secretResourceName) { + 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 (secretResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter secretResourceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + resourceGroupName, + secretResourceName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes the secret resource identified by the name. + * + * @param resourceGroupName Azure resource group name. + * @param secretResourceName The name of the secret resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException 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 secretResourceName, 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 (secretResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter secretResourceName 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(), + this.client.getApiVersion(), + resourceGroupName, + secretResourceName, + accept, + context); + } + + /** + * Deletes the secret resource identified by the name. + * + * @param resourceGroupName Azure resource group name. + * @param secretResourceName The name of the secret resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException 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 secretResourceName) { + return deleteWithResponseAsync(resourceGroupName, secretResourceName).flatMap(ignored -> Mono.empty()); + } + + /** + * Deletes the secret resource identified by the name. + * + * @param resourceGroupName Azure resource group name. + * @param secretResourceName The name of the secret resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException 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 secretResourceName) { + deleteAsync(resourceGroupName, secretResourceName).block(); + } + + /** + * Deletes the secret resource identified by the name. + * + * @param resourceGroupName Azure resource group name. + * @param secretResourceName The name of the secret resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException 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 secretResourceName, Context context) { + return deleteWithResponseAsync(resourceGroupName, secretResourceName, context).block(); + } + + /** + * Gets the information about all secret resources in a given resource group. The information include the + * description and other properties of the Secret. + * + * @param resourceGroupName Azure resource group name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all secret resources in a given resource group along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + 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.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + resourceGroupName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the information about all secret resources in a given resource group. The information include the + * description and other properties of the Secret. + * + * @param resourceGroupName Azure resource group name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all secret resources in a given resource group along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + 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.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + resourceGroupName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets the information about all secret resources in a given resource group. The information include the + * description and other properties of the Secret. + * + * @param resourceGroupName Azure resource group name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all secret resources in a given resource group as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Gets the information about all secret resources in a given resource group. The information include the + * description and other properties of the Secret. + * + * @param resourceGroupName Azure resource group name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all secret resources in a given resource group as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync( + String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets the information about all secret resources in a given resource group. The information include the + * description and other properties of the Secret. + * + * @param resourceGroupName Azure resource group name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all secret resources in a given resource group as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Gets the information about all secret resources in a given resource group. The information include the + * description and other properties of the Secret. + * + * @param resourceGroupName Azure resource group name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all secret resources in a given resource group as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup( + String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Gets the information about all secret resources in a given resource group. The information include the + * description and other properties of the secret. + * + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all secret resources in a given resource group along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + 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())); + } + + /** + * Gets the information about all secret resources in a given resource group. The information include the + * description and other properties of the secret. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all secret resources in a given resource group along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets the information about all secret resources in a given resource group. The information include the + * description and other properties of the secret. + * + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all secret resources in a given resource group as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>( + () -> listSinglePageAsync(), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Gets the information about all secret resources in a given resource group. The information include the + * description and other properties of the secret. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all secret resources in a given resource group as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets the information about all secret resources in a given resource group. The information include the + * description and other properties of the secret. + * + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all secret resources in a given resource group as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Gets the information about all secret resources in a given resource group. The information include the + * description and other properties of the secret. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all secret resources in a given resource group as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of secret resources along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync( + 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.listByResourceGroupNext(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 nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of secret resources along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync( + 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 + .listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of secret resources along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(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.listBySubscriptionNext(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 nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of secret resources along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync( + 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 + .listBySubscriptionNext(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/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/SecretsImpl.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/SecretsImpl.java new file mode 100644 index 0000000000000..3e740104fead4 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/SecretsImpl.java @@ -0,0 +1,173 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.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.servicefabricmesh.fluent.SecretsClient; +import com.azure.resourcemanager.servicefabricmesh.fluent.models.SecretResourceDescriptionInner; +import com.azure.resourcemanager.servicefabricmesh.models.SecretResourceDescription; +import com.azure.resourcemanager.servicefabricmesh.models.Secrets; + +public final class SecretsImpl implements Secrets { + private static final ClientLogger LOGGER = new ClientLogger(SecretsImpl.class); + + private final SecretsClient innerClient; + + private final com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager serviceManager; + + public SecretsImpl( + SecretsClient innerClient, + com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public SecretResourceDescription getByResourceGroup(String resourceGroupName, String secretResourceName) { + SecretResourceDescriptionInner inner = + this.serviceClient().getByResourceGroup(resourceGroupName, secretResourceName); + if (inner != null) { + return new SecretResourceDescriptionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String secretResourceName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, secretResourceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SecretResourceDescriptionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String secretResourceName) { + this.serviceClient().delete(resourceGroupName, secretResourceName); + } + + public Response deleteWithResponse(String resourceGroupName, String secretResourceName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, secretResourceName, context); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new SecretResourceDescriptionImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new SecretResourceDescriptionImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new SecretResourceDescriptionImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new SecretResourceDescriptionImpl(inner1, this.manager())); + } + + public SecretResourceDescription 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 secretResourceName = Utils.getValueFromIdByName(id, "secrets"); + if (secretResourceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'secrets'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, secretResourceName, 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 secretResourceName = Utils.getValueFromIdByName(id, "secrets"); + if (secretResourceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'secrets'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, secretResourceName, 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 secretResourceName = Utils.getValueFromIdByName(id, "secrets"); + if (secretResourceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'secrets'.", id))); + } + this.deleteWithResponse(resourceGroupName, secretResourceName, 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 secretResourceName = Utils.getValueFromIdByName(id, "secrets"); + if (secretResourceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'secrets'.", id))); + } + return this.deleteWithResponse(resourceGroupName, secretResourceName, context); + } + + private SecretsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager() { + return this.serviceManager; + } + + public SecretResourceDescriptionImpl define(String name) { + return new SecretResourceDescriptionImpl(name, this.manager()); + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/ServiceFabricMeshManagementClientBuilder.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/ServiceFabricMeshManagementClientBuilder.java new file mode 100644 index 0000000000000..01cbae8de32f4 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/ServiceFabricMeshManagementClientBuilder.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.implementation; + +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerAdapter; +import java.time.Duration; + +/** A builder for creating a new instance of the ServiceFabricMeshManagementClientImpl type. */ +@ServiceClientBuilder(serviceClients = {ServiceFabricMeshManagementClientImpl.class}) +public final class ServiceFabricMeshManagementClientBuilder { + /* + * The customer subscription identifier + */ + private String subscriptionId; + + /** + * Sets The customer subscription identifier. + * + * @param subscriptionId the subscriptionId value. + * @return the ServiceFabricMeshManagementClientBuilder. + */ + public ServiceFabricMeshManagementClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the ServiceFabricMeshManagementClientBuilder. + */ + public ServiceFabricMeshManagementClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The environment to connect to + */ + private AzureEnvironment environment; + + /** + * Sets The environment to connect to. + * + * @param environment the environment value. + * @return the ServiceFabricMeshManagementClientBuilder. + */ + public ServiceFabricMeshManagementClientBuilder environment(AzureEnvironment environment) { + this.environment = environment; + return this; + } + + /* + * The HTTP pipeline to send requests through + */ + private HttpPipeline pipeline; + + /** + * Sets The HTTP pipeline to send requests through. + * + * @param pipeline the pipeline value. + * @return the ServiceFabricMeshManagementClientBuilder. + */ + public ServiceFabricMeshManagementClientBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + return this; + } + + /* + * The default poll interval for long-running operation + */ + private Duration defaultPollInterval; + + /** + * Sets The default poll interval for long-running operation. + * + * @param defaultPollInterval the defaultPollInterval value. + * @return the ServiceFabricMeshManagementClientBuilder. + */ + public ServiceFabricMeshManagementClientBuilder defaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = defaultPollInterval; + return this; + } + + /* + * The serializer to serialize an object into a string + */ + private SerializerAdapter serializerAdapter; + + /** + * Sets The serializer to serialize an object into a string. + * + * @param serializerAdapter the serializerAdapter value. + * @return the ServiceFabricMeshManagementClientBuilder. + */ + public ServiceFabricMeshManagementClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of ServiceFabricMeshManagementClientImpl with the provided parameters. + * + * @return an instance of ServiceFabricMeshManagementClientImpl. + */ + public ServiceFabricMeshManagementClientImpl buildClient() { + if (endpoint == null) { + this.endpoint = "https://management.azure.com"; + } + if (environment == null) { + this.environment = AzureEnvironment.AZURE; + } + if (pipeline == null) { + this.pipeline = new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(); + } + if (defaultPollInterval == null) { + this.defaultPollInterval = Duration.ofSeconds(30); + } + if (serializerAdapter == null) { + this.serializerAdapter = SerializerFactory.createDefaultManagementSerializerAdapter(); + } + ServiceFabricMeshManagementClientImpl client = + new ServiceFabricMeshManagementClientImpl( + pipeline, serializerAdapter, defaultPollInterval, environment, subscriptionId, endpoint); + return client; + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/ServiceFabricMeshManagementClientImpl.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/ServiceFabricMeshManagementClientImpl.java new file mode 100644 index 0000000000000..2f5a93a06ebb2 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/ServiceFabricMeshManagementClientImpl.java @@ -0,0 +1,416 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.implementation; + +import com.azure.core.annotation.ServiceClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.Response; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.management.polling.PollerFactory; +import com.azure.core.util.Context; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.AsyncPollResponse; +import com.azure.core.util.polling.LongRunningOperationStatus; +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.servicefabricmesh.fluent.ApplicationsClient; +import com.azure.resourcemanager.servicefabricmesh.fluent.CodePackagesClient; +import com.azure.resourcemanager.servicefabricmesh.fluent.GatewaysClient; +import com.azure.resourcemanager.servicefabricmesh.fluent.NetworksClient; +import com.azure.resourcemanager.servicefabricmesh.fluent.OperationsClient; +import com.azure.resourcemanager.servicefabricmesh.fluent.SecretValuesClient; +import com.azure.resourcemanager.servicefabricmesh.fluent.SecretsClient; +import com.azure.resourcemanager.servicefabricmesh.fluent.ServiceFabricMeshManagementClient; +import com.azure.resourcemanager.servicefabricmesh.fluent.ServiceReplicasClient; +import com.azure.resourcemanager.servicefabricmesh.fluent.ServicesClient; +import com.azure.resourcemanager.servicefabricmesh.fluent.VolumesClient; +import java.io.IOException; +import java.lang.reflect.Type; +import java.nio.ByteBuffer; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.time.Duration; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** Initializes a new instance of the ServiceFabricMeshManagementClientImpl type. */ +@ServiceClient(builder = ServiceFabricMeshManagementClientBuilder.class) +public final class ServiceFabricMeshManagementClientImpl implements ServiceFabricMeshManagementClient { + /** The customer subscription identifier. */ + private final String subscriptionId; + + /** + * Gets The customer subscription identifier. + * + * @return the subscriptionId value. + */ + public String getSubscriptionId() { + return this.subscriptionId; + } + + /** server parameter. */ + private final String endpoint; + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** Api Version. */ + private final String apiVersion; + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + public String getApiVersion() { + return this.apiVersion; + } + + /** The HTTP pipeline to send requests through. */ + private final HttpPipeline httpPipeline; + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; + } + + /** The serializer to serialize an object into a string. */ + private final SerializerAdapter serializerAdapter; + + /** + * Gets The serializer to serialize an object into a string. + * + * @return the serializerAdapter value. + */ + SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** The default poll interval for long-running operation. */ + private final Duration defaultPollInterval; + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + public Duration getDefaultPollInterval() { + return this.defaultPollInterval; + } + + /** The OperationsClient object to access its operations. */ + private final OperationsClient operations; + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + public OperationsClient getOperations() { + return this.operations; + } + + /** The SecretsClient object to access its operations. */ + private final SecretsClient secrets; + + /** + * Gets the SecretsClient object to access its operations. + * + * @return the SecretsClient object. + */ + public SecretsClient getSecrets() { + return this.secrets; + } + + /** The SecretValuesClient object to access its operations. */ + private final SecretValuesClient secretValues; + + /** + * Gets the SecretValuesClient object to access its operations. + * + * @return the SecretValuesClient object. + */ + public SecretValuesClient getSecretValues() { + return this.secretValues; + } + + /** The VolumesClient object to access its operations. */ + private final VolumesClient volumes; + + /** + * Gets the VolumesClient object to access its operations. + * + * @return the VolumesClient object. + */ + public VolumesClient getVolumes() { + return this.volumes; + } + + /** The NetworksClient object to access its operations. */ + private final NetworksClient networks; + + /** + * Gets the NetworksClient object to access its operations. + * + * @return the NetworksClient object. + */ + public NetworksClient getNetworks() { + return this.networks; + } + + /** The GatewaysClient object to access its operations. */ + private final GatewaysClient gateways; + + /** + * Gets the GatewaysClient object to access its operations. + * + * @return the GatewaysClient object. + */ + public GatewaysClient getGateways() { + return this.gateways; + } + + /** The ApplicationsClient object to access its operations. */ + private final ApplicationsClient applications; + + /** + * Gets the ApplicationsClient object to access its operations. + * + * @return the ApplicationsClient object. + */ + public ApplicationsClient getApplications() { + return this.applications; + } + + /** The ServicesClient object to access its operations. */ + private final ServicesClient services; + + /** + * Gets the ServicesClient object to access its operations. + * + * @return the ServicesClient object. + */ + public ServicesClient getServices() { + return this.services; + } + + /** The ServiceReplicasClient object to access its operations. */ + private final ServiceReplicasClient serviceReplicas; + + /** + * Gets the ServiceReplicasClient object to access its operations. + * + * @return the ServiceReplicasClient object. + */ + public ServiceReplicasClient getServiceReplicas() { + return this.serviceReplicas; + } + + /** The CodePackagesClient object to access its operations. */ + private final CodePackagesClient codePackages; + + /** + * Gets the CodePackagesClient object to access its operations. + * + * @return the CodePackagesClient object. + */ + public CodePackagesClient getCodePackages() { + return this.codePackages; + } + + /** + * Initializes an instance of ServiceFabricMeshManagementClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param defaultPollInterval The default poll interval for long-running operation. + * @param environment The Azure environment. + * @param subscriptionId The customer subscription identifier. + * @param endpoint server parameter. + */ + ServiceFabricMeshManagementClientImpl( + HttpPipeline httpPipeline, + SerializerAdapter serializerAdapter, + Duration defaultPollInterval, + AzureEnvironment environment, + String subscriptionId, + String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + this.apiVersion = "2018-09-01-preview"; + this.operations = new OperationsClientImpl(this); + this.secrets = new SecretsClientImpl(this); + this.secretValues = new SecretValuesClientImpl(this); + this.volumes = new VolumesClientImpl(this); + this.networks = new NetworksClientImpl(this); + this.gateways = new GatewaysClientImpl(this); + this.applications = new ApplicationsClientImpl(this); + this.services = new ServicesClientImpl(this); + this.serviceReplicas = new ServiceReplicasClientImpl(this); + this.codePackages = new CodePackagesClientImpl(this); + } + + /** + * Gets default client context. + * + * @return the default client context. + */ + public Context getContext() { + return Context.NONE; + } + + /** + * Merges default client context with provided context. + * + * @param context the context to be merged with default client context. + * @return the merged context. + */ + public Context mergeContext(Context context) { + return CoreUtils.mergeContexts(this.getContext(), context); + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param httpPipeline the http pipeline. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return poller flux for poll result and final result. + */ + public PollerFlux, U> getLroResult( + Mono>> activationResponse, + HttpPipeline httpPipeline, + Type pollResultType, + Type finalResultType, + Context context) { + return PollerFactory + .create( + serializerAdapter, + httpPipeline, + pollResultType, + finalResultType, + defaultPollInterval, + activationResponse, + context); + } + + /** + * Gets the final result, or an error, based on last async poll response. + * + * @param response the last async poll response. + * @param type of poll result. + * @param type of final result. + * @return the final result, or an error. + */ + public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { + if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { + String errorMessage; + ManagementError managementError = null; + HttpResponse errorResponse = null; + PollResult.Error lroError = response.getValue().getError(); + if (lroError != null) { + errorResponse = + new HttpResponseImpl( + lroError.getResponseStatusCode(), lroError.getResponseHeaders(), lroError.getResponseBody()); + + errorMessage = response.getValue().getError().getMessage(); + String errorBody = response.getValue().getError().getResponseBody(); + if (errorBody != null) { + // try to deserialize error body to ManagementError + try { + managementError = + this + .getSerializerAdapter() + .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); + if (managementError.getCode() == null || managementError.getMessage() == null) { + managementError = null; + } + } catch (IOException | RuntimeException ioe) { + LOGGER.logThrowableAsWarning(ioe); + } + } + } else { + // fallback to default error message + errorMessage = "Long running operation failed."; + } + if (managementError == null) { + // fallback to default ManagementError + managementError = new ManagementError(response.getStatus().toString(), errorMessage); + } + return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); + } else { + return response.getFinalResult(); + } + } + + private static final class HttpResponseImpl extends HttpResponse { + private final int statusCode; + + private final byte[] responseBody; + + private final HttpHeaders httpHeaders; + + HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { + super(null); + this.statusCode = statusCode; + this.httpHeaders = httpHeaders; + this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); + } + + public int getStatusCode() { + return statusCode; + } + + public String getHeaderValue(String s) { + return httpHeaders.getValue(s); + } + + public HttpHeaders getHeaders() { + return httpHeaders; + } + + public Flux getBody() { + return Flux.just(ByteBuffer.wrap(responseBody)); + } + + public Mono getBodyAsByteArray() { + return Mono.just(responseBody); + } + + public Mono getBodyAsString() { + return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); + } + + public Mono getBodyAsString(Charset charset) { + return Mono.just(new String(responseBody, charset)); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ServiceFabricMeshManagementClientImpl.class); +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/ServiceReplicaDescriptionImpl.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/ServiceReplicaDescriptionImpl.java new file mode 100644 index 0000000000000..b479dcc9d2436 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/ServiceReplicaDescriptionImpl.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.implementation; + +import com.azure.resourcemanager.servicefabricmesh.fluent.models.ServiceReplicaDescriptionInner; +import com.azure.resourcemanager.servicefabricmesh.models.ContainerCodePackageProperties; +import com.azure.resourcemanager.servicefabricmesh.models.DiagnosticsRef; +import com.azure.resourcemanager.servicefabricmesh.models.NetworkRef; +import com.azure.resourcemanager.servicefabricmesh.models.OperatingSystemType; +import com.azure.resourcemanager.servicefabricmesh.models.ServiceReplicaDescription; +import java.util.Collections; +import java.util.List; + +public final class ServiceReplicaDescriptionImpl implements ServiceReplicaDescription { + private ServiceReplicaDescriptionInner innerObject; + + private final com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager serviceManager; + + ServiceReplicaDescriptionImpl( + ServiceReplicaDescriptionInner innerObject, + com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public OperatingSystemType osType() { + return this.innerModel().osType(); + } + + public List codePackages() { + List inner = this.innerModel().codePackages(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List networkRefs() { + List inner = this.innerModel().networkRefs(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public DiagnosticsRef diagnostics() { + return this.innerModel().diagnostics(); + } + + public String replicaName() { + return this.innerModel().replicaName(); + } + + public ServiceReplicaDescriptionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/ServiceReplicasClientImpl.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/ServiceReplicasClientImpl.java new file mode 100644 index 0000000000000..d8417de5c7c7c --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/ServiceReplicasClientImpl.java @@ -0,0 +1,583 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +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.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.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.servicefabricmesh.fluent.ServiceReplicasClient; +import com.azure.resourcemanager.servicefabricmesh.fluent.models.ServiceReplicaDescriptionInner; +import com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException; +import com.azure.resourcemanager.servicefabricmesh.models.ServiceReplicaDescriptionList; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ServiceReplicasClient. */ +public final class ServiceReplicasClientImpl implements ServiceReplicasClient { + /** The proxy service used to perform REST calls. */ + private final ServiceReplicasService service; + + /** The service client containing this operation class. */ + private final ServiceFabricMeshManagementClientImpl client; + + /** + * Initializes an instance of ServiceReplicasClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ServiceReplicasClientImpl(ServiceFabricMeshManagementClientImpl client) { + this.service = + RestProxy.create(ServiceReplicasService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ServiceFabricMeshManagementClientServiceReplicas to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ServiceFabricMeshMan") + private interface ServiceReplicasService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh" + + "/applications/{applicationResourceName}/services/{serviceResourceName}/replicas/{replicaName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorErrorModelException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam(value = "applicationResourceName", encoded = true) String applicationResourceName, + @PathParam(value = "serviceResourceName", encoded = true) String serviceResourceName, + @PathParam(value = "replicaName", encoded = true) String replicaName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh" + + "/applications/{applicationResourceName}/services/{serviceResourceName}/replicas") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorErrorModelException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam(value = "applicationResourceName", encoded = true) String applicationResourceName, + @PathParam(value = "serviceResourceName", encoded = true) String serviceResourceName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorErrorModelException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets the information about the service replica with the given name. The information include the description and + * other properties of the service replica. + * + * @param resourceGroupName Azure resource group name. + * @param applicationResourceName The identity of the application. + * @param serviceResourceName The identity of the service. + * @param replicaName Service Fabric replica name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about the service replica with the given name along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String applicationResourceName, String serviceResourceName, String replicaName) { + 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 (applicationResourceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter applicationResourceName is required and cannot be null.")); + } + if (serviceResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serviceResourceName is required and cannot be null.")); + } + if (replicaName == null) { + return Mono.error(new IllegalArgumentException("Parameter replicaName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + resourceGroupName, + applicationResourceName, + serviceResourceName, + replicaName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the information about the service replica with the given name. The information include the description and + * other properties of the service replica. + * + * @param resourceGroupName Azure resource group name. + * @param applicationResourceName The identity of the application. + * @param serviceResourceName The identity of the service. + * @param replicaName Service Fabric replica name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about the service replica with the given name along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String applicationResourceName, + String serviceResourceName, + String replicaName, + 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 (applicationResourceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter applicationResourceName is required and cannot be null.")); + } + if (serviceResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serviceResourceName is required and cannot be null.")); + } + if (replicaName == null) { + return Mono.error(new IllegalArgumentException("Parameter replicaName 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(), + this.client.getApiVersion(), + resourceGroupName, + applicationResourceName, + serviceResourceName, + replicaName, + accept, + context); + } + + /** + * Gets the information about the service replica with the given name. The information include the description and + * other properties of the service replica. + * + * @param resourceGroupName Azure resource group name. + * @param applicationResourceName The identity of the application. + * @param serviceResourceName The identity of the service. + * @param replicaName Service Fabric replica name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about the service replica with the given name on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String applicationResourceName, String serviceResourceName, String replicaName) { + return getWithResponseAsync(resourceGroupName, applicationResourceName, serviceResourceName, replicaName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the information about the service replica with the given name. The information include the description and + * other properties of the service replica. + * + * @param resourceGroupName Azure resource group name. + * @param applicationResourceName The identity of the application. + * @param serviceResourceName The identity of the service. + * @param replicaName Service Fabric replica name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about the service replica with the given name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServiceReplicaDescriptionInner get( + String resourceGroupName, String applicationResourceName, String serviceResourceName, String replicaName) { + return getAsync(resourceGroupName, applicationResourceName, serviceResourceName, replicaName).block(); + } + + /** + * Gets the information about the service replica with the given name. The information include the description and + * other properties of the service replica. + * + * @param resourceGroupName Azure resource group name. + * @param applicationResourceName The identity of the application. + * @param serviceResourceName The identity of the service. + * @param replicaName Service Fabric replica name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about the service replica with the given name along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String applicationResourceName, + String serviceResourceName, + String replicaName, + Context context) { + return getWithResponseAsync( + resourceGroupName, applicationResourceName, serviceResourceName, replicaName, context) + .block(); + } + + /** + * Gets the information about all replicas of a given service of an application. The information includes the + * runtime properties of the replica instance. + * + * @param resourceGroupName Azure resource group name. + * @param applicationResourceName The identity of the application. + * @param serviceResourceName The identity of the service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all replicas of a given service of an application along with {@link PagedResponse} + * on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String applicationResourceName, String serviceResourceName) { + 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 (applicationResourceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter applicationResourceName is required and cannot be null.")); + } + if (serviceResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serviceResourceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + resourceGroupName, + applicationResourceName, + serviceResourceName, + 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())); + } + + /** + * Gets the information about all replicas of a given service of an application. The information includes the + * runtime properties of the replica instance. + * + * @param resourceGroupName Azure resource group name. + * @param applicationResourceName The identity of the application. + * @param serviceResourceName The identity of the service. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all replicas of a given service of an application along with {@link PagedResponse} + * on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String applicationResourceName, String serviceResourceName, 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 (applicationResourceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter applicationResourceName is required and cannot be null.")); + } + if (serviceResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serviceResourceName 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(), + this.client.getApiVersion(), + resourceGroupName, + applicationResourceName, + serviceResourceName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets the information about all replicas of a given service of an application. The information includes the + * runtime properties of the replica instance. + * + * @param resourceGroupName Azure resource group name. + * @param applicationResourceName The identity of the application. + * @param serviceResourceName The identity of the service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all replicas of a given service of an application as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, String applicationResourceName, String serviceResourceName) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, applicationResourceName, serviceResourceName), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets the information about all replicas of a given service of an application. The information includes the + * runtime properties of the replica instance. + * + * @param resourceGroupName Azure resource group name. + * @param applicationResourceName The identity of the application. + * @param serviceResourceName The identity of the service. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all replicas of a given service of an application as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, String applicationResourceName, String serviceResourceName, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, applicationResourceName, serviceResourceName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets the information about all replicas of a given service of an application. The information includes the + * runtime properties of the replica instance. + * + * @param resourceGroupName Azure resource group name. + * @param applicationResourceName The identity of the application. + * @param serviceResourceName The identity of the service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all replicas of a given service of an application as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, String applicationResourceName, String serviceResourceName) { + return new PagedIterable<>(listAsync(resourceGroupName, applicationResourceName, serviceResourceName)); + } + + /** + * Gets the information about all replicas of a given service of an application. The information includes the + * runtime properties of the replica instance. + * + * @param resourceGroupName Azure resource group name. + * @param applicationResourceName The identity of the application. + * @param serviceResourceName The identity of the service. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all replicas of a given service of an application as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, String applicationResourceName, String serviceResourceName, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, applicationResourceName, serviceResourceName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of service replicas 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 nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of service replicas 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/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/ServiceReplicasImpl.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/ServiceReplicasImpl.java new file mode 100644 index 0000000000000..58a78e7a02f95 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/ServiceReplicasImpl.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.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.servicefabricmesh.fluent.ServiceReplicasClient; +import com.azure.resourcemanager.servicefabricmesh.fluent.models.ServiceReplicaDescriptionInner; +import com.azure.resourcemanager.servicefabricmesh.models.ServiceReplicaDescription; +import com.azure.resourcemanager.servicefabricmesh.models.ServiceReplicas; + +public final class ServiceReplicasImpl implements ServiceReplicas { + private static final ClientLogger LOGGER = new ClientLogger(ServiceReplicasImpl.class); + + private final ServiceReplicasClient innerClient; + + private final com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager serviceManager; + + public ServiceReplicasImpl( + ServiceReplicasClient innerClient, + com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public ServiceReplicaDescription get( + String resourceGroupName, String applicationResourceName, String serviceResourceName, String replicaName) { + ServiceReplicaDescriptionInner inner = + this.serviceClient().get(resourceGroupName, applicationResourceName, serviceResourceName, replicaName); + if (inner != null) { + return new ServiceReplicaDescriptionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, + String applicationResourceName, + String serviceResourceName, + String replicaName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, applicationResourceName, serviceResourceName, replicaName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ServiceReplicaDescriptionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable list( + String resourceGroupName, String applicationResourceName, String serviceResourceName) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, applicationResourceName, serviceResourceName); + return Utils.mapPage(inner, inner1 -> new ServiceReplicaDescriptionImpl(inner1, this.manager())); + } + + public PagedIterable list( + String resourceGroupName, String applicationResourceName, String serviceResourceName, Context context) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, applicationResourceName, serviceResourceName, context); + return Utils.mapPage(inner, inner1 -> new ServiceReplicaDescriptionImpl(inner1, this.manager())); + } + + private ServiceReplicasClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/ServiceResourceDescriptionImpl.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/ServiceResourceDescriptionImpl.java new file mode 100644 index 0000000000000..d400d8d7409cb --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/ServiceResourceDescriptionImpl.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.servicefabricmesh.implementation; + +import com.azure.resourcemanager.servicefabricmesh.fluent.models.ServiceResourceDescriptionInner; +import com.azure.resourcemanager.servicefabricmesh.models.AutoScalingPolicy; +import com.azure.resourcemanager.servicefabricmesh.models.ContainerCodePackageProperties; +import com.azure.resourcemanager.servicefabricmesh.models.DiagnosticsRef; +import com.azure.resourcemanager.servicefabricmesh.models.HealthState; +import com.azure.resourcemanager.servicefabricmesh.models.NetworkRef; +import com.azure.resourcemanager.servicefabricmesh.models.OperatingSystemType; +import com.azure.resourcemanager.servicefabricmesh.models.ResourceStatus; +import com.azure.resourcemanager.servicefabricmesh.models.ServiceResourceDescription; +import java.util.Collections; +import java.util.List; + +public final class ServiceResourceDescriptionImpl implements ServiceResourceDescription { + private ServiceResourceDescriptionInner innerObject; + + private final com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager serviceManager; + + ServiceResourceDescriptionImpl( + ServiceResourceDescriptionInner innerObject, + com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String type() { + return this.innerModel().type(); + } + + public String name() { + return this.innerModel().name(); + } + + public OperatingSystemType osType() { + return this.innerModel().osType(); + } + + public List codePackages() { + List inner = this.innerModel().codePackages(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List networkRefs() { + List inner = this.innerModel().networkRefs(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public DiagnosticsRef diagnostics() { + return this.innerModel().diagnostics(); + } + + public String description() { + return this.innerModel().description(); + } + + public Integer replicaCount() { + return this.innerModel().replicaCount(); + } + + public List autoScalingPolicies() { + List inner = this.innerModel().autoScalingPolicies(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public ResourceStatus status() { + return this.innerModel().status(); + } + + public String statusDetails() { + return this.innerModel().statusDetails(); + } + + public HealthState healthState() { + return this.innerModel().healthState(); + } + + public String unhealthyEvaluation() { + return this.innerModel().unhealthyEvaluation(); + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public ServiceResourceDescriptionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/ServicesClientImpl.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/ServicesClientImpl.java new file mode 100644 index 0000000000000..f7f407b5d028c --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/ServicesClientImpl.java @@ -0,0 +1,541 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +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.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.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.servicefabricmesh.fluent.ServicesClient; +import com.azure.resourcemanager.servicefabricmesh.fluent.models.ServiceResourceDescriptionInner; +import com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException; +import com.azure.resourcemanager.servicefabricmesh.models.ServiceResourceDescriptionList; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ServicesClient. */ +public final class ServicesClientImpl implements ServicesClient { + /** The proxy service used to perform REST calls. */ + private final ServicesService service; + + /** The service client containing this operation class. */ + private final ServiceFabricMeshManagementClientImpl client; + + /** + * Initializes an instance of ServicesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ServicesClientImpl(ServiceFabricMeshManagementClientImpl client) { + this.service = RestProxy.create(ServicesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ServiceFabricMeshManagementClientServices to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ServiceFabricMeshMan") + private interface ServicesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh" + + "/applications/{applicationResourceName}/services/{serviceResourceName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorErrorModelException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam(value = "applicationResourceName", encoded = true) String applicationResourceName, + @PathParam(value = "serviceResourceName", encoded = true) String serviceResourceName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh" + + "/applications/{applicationResourceName}/services") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorErrorModelException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam(value = "applicationResourceName", encoded = true) String applicationResourceName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorErrorModelException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets the information about the service resource with the given name. The information include the description and + * other properties of the service. + * + * @param resourceGroupName Azure resource group name. + * @param applicationResourceName The identity of the application. + * @param serviceResourceName The identity of the service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about the service resource with the given name along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String applicationResourceName, String serviceResourceName) { + 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 (applicationResourceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter applicationResourceName is required and cannot be null.")); + } + if (serviceResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serviceResourceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + resourceGroupName, + applicationResourceName, + serviceResourceName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the information about the service resource with the given name. The information include the description and + * other properties of the service. + * + * @param resourceGroupName Azure resource group name. + * @param applicationResourceName The identity of the application. + * @param serviceResourceName The identity of the service. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about the service resource with the given name along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String applicationResourceName, String serviceResourceName, 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 (applicationResourceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter applicationResourceName is required and cannot be null.")); + } + if (serviceResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serviceResourceName 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(), + this.client.getApiVersion(), + resourceGroupName, + applicationResourceName, + serviceResourceName, + accept, + context); + } + + /** + * Gets the information about the service resource with the given name. The information include the description and + * other properties of the service. + * + * @param resourceGroupName Azure resource group name. + * @param applicationResourceName The identity of the application. + * @param serviceResourceName The identity of the service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about the service resource with the given name on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String applicationResourceName, String serviceResourceName) { + return getWithResponseAsync(resourceGroupName, applicationResourceName, serviceResourceName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the information about the service resource with the given name. The information include the description and + * other properties of the service. + * + * @param resourceGroupName Azure resource group name. + * @param applicationResourceName The identity of the application. + * @param serviceResourceName The identity of the service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about the service resource with the given name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServiceResourceDescriptionInner get( + String resourceGroupName, String applicationResourceName, String serviceResourceName) { + return getAsync(resourceGroupName, applicationResourceName, serviceResourceName).block(); + } + + /** + * Gets the information about the service resource with the given name. The information include the description and + * other properties of the service. + * + * @param resourceGroupName Azure resource group name. + * @param applicationResourceName The identity of the application. + * @param serviceResourceName The identity of the service. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about the service resource with the given name along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String applicationResourceName, String serviceResourceName, Context context) { + return getWithResponseAsync(resourceGroupName, applicationResourceName, serviceResourceName, context).block(); + } + + /** + * Gets the information about all services of an application resource. The information include the description and + * other properties of the Service. + * + * @param resourceGroupName Azure resource group name. + * @param applicationResourceName The identity of the application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all services of an application resource along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String applicationResourceName) { + 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 (applicationResourceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter applicationResourceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + resourceGroupName, + applicationResourceName, + 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())); + } + + /** + * Gets the information about all services of an application resource. The information include the description and + * other properties of the Service. + * + * @param resourceGroupName Azure resource group name. + * @param applicationResourceName The identity of the application. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all services of an application resource along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String applicationResourceName, 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 (applicationResourceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter applicationResourceName 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(), + this.client.getApiVersion(), + resourceGroupName, + applicationResourceName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets the information about all services of an application resource. The information include the description and + * other properties of the Service. + * + * @param resourceGroupName Azure resource group name. + * @param applicationResourceName The identity of the application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all services of an application resource as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, String applicationResourceName) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, applicationResourceName), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets the information about all services of an application resource. The information include the description and + * other properties of the Service. + * + * @param resourceGroupName Azure resource group name. + * @param applicationResourceName The identity of the application. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all services of an application resource as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, String applicationResourceName, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, applicationResourceName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets the information about all services of an application resource. The information include the description and + * other properties of the Service. + * + * @param resourceGroupName Azure resource group name. + * @param applicationResourceName The identity of the application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all services of an application resource as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, String applicationResourceName) { + return new PagedIterable<>(listAsync(resourceGroupName, applicationResourceName)); + } + + /** + * Gets the information about all services of an application resource. The information include the description and + * other properties of the Service. + * + * @param resourceGroupName Azure resource group name. + * @param applicationResourceName The identity of the application. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all services of an application resource as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, String applicationResourceName, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, applicationResourceName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of service resources 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 nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of service resources 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/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/ServicesImpl.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/ServicesImpl.java new file mode 100644 index 0000000000000..54940e4cd1576 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/ServicesImpl.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.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.servicefabricmesh.fluent.ServicesClient; +import com.azure.resourcemanager.servicefabricmesh.fluent.models.ServiceResourceDescriptionInner; +import com.azure.resourcemanager.servicefabricmesh.models.ServiceResourceDescription; +import com.azure.resourcemanager.servicefabricmesh.models.Services; + +public final class ServicesImpl implements Services { + private static final ClientLogger LOGGER = new ClientLogger(ServicesImpl.class); + + private final ServicesClient innerClient; + + private final com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager serviceManager; + + public ServicesImpl( + ServicesClient innerClient, + com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public ServiceResourceDescription get( + String resourceGroupName, String applicationResourceName, String serviceResourceName) { + ServiceResourceDescriptionInner inner = + this.serviceClient().get(resourceGroupName, applicationResourceName, serviceResourceName); + if (inner != null) { + return new ServiceResourceDescriptionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String applicationResourceName, String serviceResourceName, Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, applicationResourceName, serviceResourceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ServiceResourceDescriptionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable list(String resourceGroupName, String applicationResourceName) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, applicationResourceName); + return Utils.mapPage(inner, inner1 -> new ServiceResourceDescriptionImpl(inner1, this.manager())); + } + + public PagedIterable list( + String resourceGroupName, String applicationResourceName, Context context) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, applicationResourceName, context); + return Utils.mapPage(inner, inner1 -> new ServiceResourceDescriptionImpl(inner1, this.manager())); + } + + private ServicesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/Utils.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/Utils.java new file mode 100644 index 0000000000000..4f785ef551ec0 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/Utils.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.servicefabricmesh.implementation; + +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.util.CoreUtils; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import reactor.core.publisher.Flux; + +final class Utils { + static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterator itr = Arrays.stream(id.split("/")).iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && !part.trim().isEmpty()) { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + static String getValueFromIdByParameterName(String id, String pathTemplate, String parameterName) { + if (id == null || pathTemplate == null) { + return null; + } + String parameterNameParentheses = "{" + parameterName + "}"; + List idSegmentsReverted = Arrays.asList(id.split("/")); + List pathSegments = Arrays.asList(pathTemplate.split("/")); + Collections.reverse(idSegmentsReverted); + Iterator idItrReverted = idSegmentsReverted.iterator(); + int pathIndex = pathSegments.size(); + while (idItrReverted.hasNext() && pathIndex > 0) { + String idSegment = idItrReverted.next(); + String pathSegment = pathSegments.get(--pathIndex); + if (!CoreUtils.isNullOrEmpty(idSegment) && !CoreUtils.isNullOrEmpty(pathSegment)) { + if (pathSegment.equalsIgnoreCase(parameterNameParentheses)) { + if (pathIndex == 0 || (pathIndex == 1 && pathSegments.get(0).isEmpty())) { + List segments = new ArrayList<>(); + segments.add(idSegment); + idItrReverted.forEachRemaining(segments::add); + Collections.reverse(segments); + if (segments.size() > 0 && segments.get(0).isEmpty()) { + segments.remove(0); + } + return String.join("/", segments); + } else { + return idSegment; + } + } + } + } + return null; + } + + static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) { + return new PagedIterableImpl(pageIterable, mapper); + } + + private static final class PagedIterableImpl extends PagedIterable { + + private final PagedIterable pagedIterable; + private final Function mapper; + private final Function, PagedResponse> pageMapper; + + private PagedIterableImpl(PagedIterable pagedIterable, Function mapper) { + super( + PagedFlux + .create( + () -> + (continuationToken, pageSize) -> + Flux.fromStream(pagedIterable.streamByPage().map(getPageMapper(mapper))))); + this.pagedIterable = pagedIterable; + this.mapper = mapper; + this.pageMapper = getPageMapper(mapper); + } + + private static Function, PagedResponse> getPageMapper(Function mapper) { + return page -> + new PagedResponseBase( + page.getRequest(), + page.getStatusCode(), + page.getHeaders(), + page.getElements().stream().map(mapper).collect(Collectors.toList()), + page.getContinuationToken(), + null); + } + + @Override + public Stream stream() { + return pagedIterable.stream().map(mapper); + } + + @Override + public Stream> streamByPage() { + return pagedIterable.streamByPage().map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken) { + return pagedIterable.streamByPage(continuationToken).map(pageMapper); + } + + @Override + public Stream> streamByPage(int preferredPageSize) { + return pagedIterable.streamByPage(preferredPageSize).map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken, int preferredPageSize) { + return pagedIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper); + } + + @Override + public Iterator iterator() { + return new IteratorImpl(pagedIterable.iterator(), mapper); + } + + @Override + public Iterable> iterableByPage() { + return new IterableImpl, PagedResponse>(pagedIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); + } + } + + private static final class IteratorImpl implements Iterator { + + private final Iterator iterator; + private final Function mapper; + + private IteratorImpl(Iterator iterator, Function mapper) { + this.iterator = iterator; + this.mapper = mapper; + } + + @Override + public boolean hasNext() { + return iterator.hasNext(); + } + + @Override + public S next() { + return mapper.apply(iterator.next()); + } + + @Override + public void remove() { + iterator.remove(); + } + } + + private static final class IterableImpl implements Iterable { + + private final Iterable iterable; + private final Function mapper; + + private IterableImpl(Iterable iterable, Function mapper) { + this.iterable = iterable; + this.mapper = mapper; + } + + @Override + public Iterator iterator() { + return new IteratorImpl(iterable.iterator(), mapper); + } + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/VolumeResourceDescriptionImpl.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/VolumeResourceDescriptionImpl.java new file mode 100644 index 0000000000000..6da48a5d8bbf9 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/VolumeResourceDescriptionImpl.java @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.servicefabricmesh.fluent.models.VolumeResourceDescriptionInner; +import com.azure.resourcemanager.servicefabricmesh.models.ResourceStatus; +import com.azure.resourcemanager.servicefabricmesh.models.VolumeProvider; +import com.azure.resourcemanager.servicefabricmesh.models.VolumeProviderParametersAzureFile; +import com.azure.resourcemanager.servicefabricmesh.models.VolumeResourceDescription; +import java.util.Collections; +import java.util.Map; + +public final class VolumeResourceDescriptionImpl + implements VolumeResourceDescription, VolumeResourceDescription.Definition { + private VolumeResourceDescriptionInner innerObject; + + private final com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager serviceManager; + + VolumeResourceDescriptionImpl( + VolumeResourceDescriptionInner innerObject, + com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public String description() { + return this.innerModel().description(); + } + + public ResourceStatus status() { + return this.innerModel().status(); + } + + public String statusDetails() { + return this.innerModel().statusDetails(); + } + + public VolumeProvider provider() { + return this.innerModel().provider(); + } + + public VolumeProviderParametersAzureFile azureFileParameters() { + return this.innerModel().azureFileParameters(); + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public VolumeResourceDescriptionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String volumeResourceName; + + public VolumeResourceDescriptionImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public VolumeResourceDescription create() { + this.innerObject = + serviceManager + .serviceClient() + .getVolumes() + .createWithResponse(resourceGroupName, volumeResourceName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public VolumeResourceDescription create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getVolumes() + .createWithResponse(resourceGroupName, volumeResourceName, this.innerModel(), context) + .getValue(); + return this; + } + + VolumeResourceDescriptionImpl( + String name, com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager serviceManager) { + this.innerObject = new VolumeResourceDescriptionInner(); + this.serviceManager = serviceManager; + this.volumeResourceName = name; + } + + public VolumeResourceDescription refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getVolumes() + .getByResourceGroupWithResponse(resourceGroupName, volumeResourceName, Context.NONE) + .getValue(); + return this; + } + + public VolumeResourceDescription refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getVolumes() + .getByResourceGroupWithResponse(resourceGroupName, volumeResourceName, context) + .getValue(); + return this; + } + + public VolumeResourceDescriptionImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public VolumeResourceDescriptionImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public VolumeResourceDescriptionImpl withProvider(VolumeProvider provider) { + this.innerModel().withProvider(provider); + return this; + } + + public VolumeResourceDescriptionImpl withTags(Map tags) { + this.innerModel().withTags(tags); + return this; + } + + public VolumeResourceDescriptionImpl withDescription(String description) { + this.innerModel().withDescription(description); + return this; + } + + public VolumeResourceDescriptionImpl withAzureFileParameters( + VolumeProviderParametersAzureFile azureFileParameters) { + this.innerModel().withAzureFileParameters(azureFileParameters); + return this; + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/VolumesClientImpl.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/VolumesClientImpl.java new file mode 100644 index 0000000000000..3254e40c51066 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/VolumesClientImpl.java @@ -0,0 +1,1109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.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.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.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.servicefabricmesh.fluent.VolumesClient; +import com.azure.resourcemanager.servicefabricmesh.fluent.models.VolumeResourceDescriptionInner; +import com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException; +import com.azure.resourcemanager.servicefabricmesh.models.VolumeResourceDescriptionList; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in VolumesClient. */ +public final class VolumesClientImpl implements VolumesClient { + /** The proxy service used to perform REST calls. */ + private final VolumesService service; + + /** The service client containing this operation class. */ + private final ServiceFabricMeshManagementClientImpl client; + + /** + * Initializes an instance of VolumesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + VolumesClientImpl(ServiceFabricMeshManagementClientImpl client) { + this.service = RestProxy.create(VolumesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ServiceFabricMeshManagementClientVolumes to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ServiceFabricMeshMan") + private interface VolumesService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh" + + "/volumes/{volumeResourceName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ErrorErrorModelException.class) + Mono> create( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam(value = "volumeResourceName", encoded = true) String volumeResourceName, + @BodyParam("application/json") VolumeResourceDescriptionInner volumeResourceDescription, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh" + + "/volumes/{volumeResourceName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorErrorModelException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam(value = "volumeResourceName", encoded = true) String volumeResourceName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh" + + "/volumes/{volumeResourceName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ErrorErrorModelException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam(value = "volumeResourceName", encoded = true) String volumeResourceName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh" + + "/volumes") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorErrorModelException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @PathParam("resourceGroupName") String resourceGroupName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabricMesh/volumes") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorErrorModelException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorErrorModelException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorErrorModelException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Creates a volume resource with the specified name, description and properties. If a volume resource with the same + * name exists, then it is updated with the specified description and properties. + * + * @param resourceGroupName Azure resource group name. + * @param volumeResourceName The identity of the volume. + * @param volumeResourceDescription Description for creating a Volume resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this type describes a volume resource along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync( + String resourceGroupName, String volumeResourceName, VolumeResourceDescriptionInner volumeResourceDescription) { + 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 (volumeResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter volumeResourceName is required and cannot be null.")); + } + if (volumeResourceDescription == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter volumeResourceDescription is required and cannot be null.")); + } else { + volumeResourceDescription.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .create( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + resourceGroupName, + volumeResourceName, + volumeResourceDescription, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates a volume resource with the specified name, description and properties. If a volume resource with the same + * name exists, then it is updated with the specified description and properties. + * + * @param resourceGroupName Azure resource group name. + * @param volumeResourceName The identity of the volume. + * @param volumeResourceDescription Description for creating a Volume resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this type describes a volume resource along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync( + String resourceGroupName, + String volumeResourceName, + VolumeResourceDescriptionInner volumeResourceDescription, + 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 (volumeResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter volumeResourceName is required and cannot be null.")); + } + if (volumeResourceDescription == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter volumeResourceDescription is required and cannot be null.")); + } else { + volumeResourceDescription.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .create( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + resourceGroupName, + volumeResourceName, + volumeResourceDescription, + accept, + context); + } + + /** + * Creates a volume resource with the specified name, description and properties. If a volume resource with the same + * name exists, then it is updated with the specified description and properties. + * + * @param resourceGroupName Azure resource group name. + * @param volumeResourceName The identity of the volume. + * @param volumeResourceDescription Description for creating a Volume resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this type describes a volume resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, String volumeResourceName, VolumeResourceDescriptionInner volumeResourceDescription) { + return createWithResponseAsync(resourceGroupName, volumeResourceName, volumeResourceDescription) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates a volume resource with the specified name, description and properties. If a volume resource with the same + * name exists, then it is updated with the specified description and properties. + * + * @param resourceGroupName Azure resource group name. + * @param volumeResourceName The identity of the volume. + * @param volumeResourceDescription Description for creating a Volume resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this type describes a volume resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VolumeResourceDescriptionInner create( + String resourceGroupName, String volumeResourceName, VolumeResourceDescriptionInner volumeResourceDescription) { + return createAsync(resourceGroupName, volumeResourceName, volumeResourceDescription).block(); + } + + /** + * Creates a volume resource with the specified name, description and properties. If a volume resource with the same + * name exists, then it is updated with the specified description and properties. + * + * @param resourceGroupName Azure resource group name. + * @param volumeResourceName The identity of the volume. + * @param volumeResourceDescription Description for creating a Volume resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this type describes a volume resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse( + String resourceGroupName, + String volumeResourceName, + VolumeResourceDescriptionInner volumeResourceDescription, + Context context) { + return createWithResponseAsync(resourceGroupName, volumeResourceName, volumeResourceDescription, context) + .block(); + } + + /** + * Gets the information about the volume resource with the given name. The information include the description and + * other properties of the volume. + * + * @param resourceGroupName Azure resource group name. + * @param volumeResourceName The identity of the volume. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about the volume resource with the given name along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String volumeResourceName) { + 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 (volumeResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter volumeResourceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + resourceGroupName, + volumeResourceName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the information about the volume resource with the given name. The information include the description and + * other properties of the volume. + * + * @param resourceGroupName Azure resource group name. + * @param volumeResourceName The identity of the volume. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about the volume resource with the given name along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String volumeResourceName, 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 (volumeResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter volumeResourceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + resourceGroupName, + volumeResourceName, + accept, + context); + } + + /** + * Gets the information about the volume resource with the given name. The information include the description and + * other properties of the volume. + * + * @param resourceGroupName Azure resource group name. + * @param volumeResourceName The identity of the volume. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about the volume resource with the given name on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync( + String resourceGroupName, String volumeResourceName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, volumeResourceName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the information about the volume resource with the given name. The information include the description and + * other properties of the volume. + * + * @param resourceGroupName Azure resource group name. + * @param volumeResourceName The identity of the volume. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about the volume resource with the given name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VolumeResourceDescriptionInner getByResourceGroup(String resourceGroupName, String volumeResourceName) { + return getByResourceGroupAsync(resourceGroupName, volumeResourceName).block(); + } + + /** + * Gets the information about the volume resource with the given name. The information include the description and + * other properties of the volume. + * + * @param resourceGroupName Azure resource group name. + * @param volumeResourceName The identity of the volume. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about the volume resource with the given name along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String volumeResourceName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, volumeResourceName, context).block(); + } + + /** + * Deletes the volume resource identified by the name. + * + * @param resourceGroupName Azure resource group name. + * @param volumeResourceName The identity of the volume. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException 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 volumeResourceName) { + 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 (volumeResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter volumeResourceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + resourceGroupName, + volumeResourceName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes the volume resource identified by the name. + * + * @param resourceGroupName Azure resource group name. + * @param volumeResourceName The identity of the volume. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException 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 volumeResourceName, 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 (volumeResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter volumeResourceName 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(), + this.client.getApiVersion(), + resourceGroupName, + volumeResourceName, + accept, + context); + } + + /** + * Deletes the volume resource identified by the name. + * + * @param resourceGroupName Azure resource group name. + * @param volumeResourceName The identity of the volume. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException 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 volumeResourceName) { + return deleteWithResponseAsync(resourceGroupName, volumeResourceName).flatMap(ignored -> Mono.empty()); + } + + /** + * Deletes the volume resource identified by the name. + * + * @param resourceGroupName Azure resource group name. + * @param volumeResourceName The identity of the volume. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException 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 volumeResourceName) { + deleteAsync(resourceGroupName, volumeResourceName).block(); + } + + /** + * Deletes the volume resource identified by the name. + * + * @param resourceGroupName Azure resource group name. + * @param volumeResourceName The identity of the volume. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException 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 volumeResourceName, Context context) { + return deleteWithResponseAsync(resourceGroupName, volumeResourceName, context).block(); + } + + /** + * Gets the information about all volume resources in a given resource group. The information include the + * description and other properties of the Volume. + * + * @param resourceGroupName Azure resource group name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all volume resources in a given resource group along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + 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.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + resourceGroupName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the information about all volume resources in a given resource group. The information include the + * description and other properties of the Volume. + * + * @param resourceGroupName Azure resource group name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all volume resources in a given resource group along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + 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.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + resourceGroupName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets the information about all volume resources in a given resource group. The information include the + * description and other properties of the Volume. + * + * @param resourceGroupName Azure resource group name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all volume resources in a given resource group as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Gets the information about all volume resources in a given resource group. The information include the + * description and other properties of the Volume. + * + * @param resourceGroupName Azure resource group name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all volume resources in a given resource group as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync( + String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets the information about all volume resources in a given resource group. The information include the + * description and other properties of the Volume. + * + * @param resourceGroupName Azure resource group name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all volume resources in a given resource group as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Gets the information about all volume resources in a given resource group. The information include the + * description and other properties of the Volume. + * + * @param resourceGroupName Azure resource group name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all volume resources in a given resource group as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup( + String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Gets the information about all volume resources in a given resource group. The information include the + * description and other properties of the volume. + * + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all volume resources in a given resource group along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + 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())); + } + + /** + * Gets the information about all volume resources in a given resource group. The information include the + * description and other properties of the volume. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all volume resources in a given resource group along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets the information about all volume resources in a given resource group. The information include the + * description and other properties of the volume. + * + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all volume resources in a given resource group as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>( + () -> listSinglePageAsync(), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Gets the information about all volume resources in a given resource group. The information include the + * description and other properties of the volume. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all volume resources in a given resource group as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets the information about all volume resources in a given resource group. The information include the + * description and other properties of the volume. + * + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all volume resources in a given resource group as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Gets the information about all volume resources in a given resource group. The information include the + * description and other properties of the volume. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all volume resources in a given resource group as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of volume resources along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync( + 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.listByResourceGroupNext(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 nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of volume resources along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync( + 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 + .listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of volume resources along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(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.listBySubscriptionNext(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 nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorErrorModelException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of volume resources along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync( + 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 + .listBySubscriptionNext(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/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/VolumesImpl.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/VolumesImpl.java new file mode 100644 index 0000000000000..2746d43904e5d --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/VolumesImpl.java @@ -0,0 +1,173 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.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.servicefabricmesh.fluent.VolumesClient; +import com.azure.resourcemanager.servicefabricmesh.fluent.models.VolumeResourceDescriptionInner; +import com.azure.resourcemanager.servicefabricmesh.models.VolumeResourceDescription; +import com.azure.resourcemanager.servicefabricmesh.models.Volumes; + +public final class VolumesImpl implements Volumes { + private static final ClientLogger LOGGER = new ClientLogger(VolumesImpl.class); + + private final VolumesClient innerClient; + + private final com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager serviceManager; + + public VolumesImpl( + VolumesClient innerClient, + com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public VolumeResourceDescription getByResourceGroup(String resourceGroupName, String volumeResourceName) { + VolumeResourceDescriptionInner inner = + this.serviceClient().getByResourceGroup(resourceGroupName, volumeResourceName); + if (inner != null) { + return new VolumeResourceDescriptionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String volumeResourceName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, volumeResourceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new VolumeResourceDescriptionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String volumeResourceName) { + this.serviceClient().delete(resourceGroupName, volumeResourceName); + } + + public Response deleteWithResponse(String resourceGroupName, String volumeResourceName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, volumeResourceName, context); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new VolumeResourceDescriptionImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new VolumeResourceDescriptionImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new VolumeResourceDescriptionImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new VolumeResourceDescriptionImpl(inner1, this.manager())); + } + + public VolumeResourceDescription 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 volumeResourceName = Utils.getValueFromIdByName(id, "volumes"); + if (volumeResourceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'volumes'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, volumeResourceName, 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 volumeResourceName = Utils.getValueFromIdByName(id, "volumes"); + if (volumeResourceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'volumes'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, volumeResourceName, 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 volumeResourceName = Utils.getValueFromIdByName(id, "volumes"); + if (volumeResourceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'volumes'.", id))); + } + this.deleteWithResponse(resourceGroupName, volumeResourceName, 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 volumeResourceName = Utils.getValueFromIdByName(id, "volumes"); + if (volumeResourceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'volumes'.", id))); + } + return this.deleteWithResponse(resourceGroupName, volumeResourceName, context); + } + + private VolumesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager() { + return this.serviceManager; + } + + public VolumeResourceDescriptionImpl define(String name) { + return new VolumeResourceDescriptionImpl(name, this.manager()); + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/package-info.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/package-info.java new file mode 100644 index 0000000000000..8b81b6886bef8 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/implementation/package-info.java @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the implementations for ServiceFabricMeshManagementClient. Service Fabric Mesh Management Client. + */ +package com.azure.resourcemanager.servicefabricmesh.implementation; diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/AddRemoveReplicaScalingMechanism.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/AddRemoveReplicaScalingMechanism.java new file mode 100644 index 0000000000000..358005b9fe734 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/AddRemoveReplicaScalingMechanism.java @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** Describes the horizontal auto scaling mechanism that adds or removes replicas (containers or container groups). */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "kind") +@JsonTypeName("AddRemoveReplica") +@Fluent +public final class AddRemoveReplicaScalingMechanism extends AutoScalingMechanism { + /* + * Minimum number of containers (scale down won't be performed below this + * number). + */ + @JsonProperty(value = "minCount", required = true) + private int minCount; + + /* + * Maximum number of containers (scale up won't be performed above this + * number). + */ + @JsonProperty(value = "maxCount", required = true) + private int maxCount; + + /* + * Each time auto scaling is performed, this number of containers will be + * added or removed. + */ + @JsonProperty(value = "scaleIncrement", required = true) + private int scaleIncrement; + + /** + * Get the minCount property: Minimum number of containers (scale down won't be performed below this number). + * + * @return the minCount value. + */ + public int minCount() { + return this.minCount; + } + + /** + * Set the minCount property: Minimum number of containers (scale down won't be performed below this number). + * + * @param minCount the minCount value to set. + * @return the AddRemoveReplicaScalingMechanism object itself. + */ + public AddRemoveReplicaScalingMechanism withMinCount(int minCount) { + this.minCount = minCount; + return this; + } + + /** + * Get the maxCount property: Maximum number of containers (scale up won't be performed above this number). + * + * @return the maxCount value. + */ + public int maxCount() { + return this.maxCount; + } + + /** + * Set the maxCount property: Maximum number of containers (scale up won't be performed above this number). + * + * @param maxCount the maxCount value to set. + * @return the AddRemoveReplicaScalingMechanism object itself. + */ + public AddRemoveReplicaScalingMechanism withMaxCount(int maxCount) { + this.maxCount = maxCount; + return this; + } + + /** + * Get the scaleIncrement property: Each time auto scaling is performed, this number of containers will be added or + * removed. + * + * @return the scaleIncrement value. + */ + public int scaleIncrement() { + return this.scaleIncrement; + } + + /** + * Set the scaleIncrement property: Each time auto scaling is performed, this number of containers will be added or + * removed. + * + * @param scaleIncrement the scaleIncrement value to set. + * @return the AddRemoveReplicaScalingMechanism object itself. + */ + public AddRemoveReplicaScalingMechanism withScaleIncrement(int scaleIncrement) { + this.scaleIncrement = scaleIncrement; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ApplicationProperties.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ApplicationProperties.java new file mode 100644 index 0000000000000..63910f0f58fd7 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ApplicationProperties.java @@ -0,0 +1,222 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.servicefabricmesh.fluent.models.ServiceResourceDescriptionInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Describes properties of a application resource. */ +@Fluent +public class ApplicationProperties { + /* + * User readable description of the application. + */ + @JsonProperty(value = "description") + private String description; + + /* + * Describes the services in the application. This property is used to + * create or modify services of the application. On get only the name of + * the service is returned. The service description can be obtained by + * querying for the service resource. + */ + @JsonProperty(value = "services") + private List services; + + /* + * Describes the diagnostics definition and usage for an application + * resource. + */ + @JsonProperty(value = "diagnostics") + private DiagnosticsDescription diagnostics; + + /* + * Internal - used by Visual Studio to setup the debugging session on the + * local development environment. + */ + @JsonProperty(value = "debugParams") + private String debugParams; + + /* + * Names of the services in the application. + */ + @JsonProperty(value = "serviceNames", access = JsonProperty.Access.WRITE_ONLY) + private List serviceNames; + + /* + * Status of the application. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private ResourceStatus status; + + /* + * Gives additional information about the current status of the + * application. + */ + @JsonProperty(value = "statusDetails", access = JsonProperty.Access.WRITE_ONLY) + private String statusDetails; + + /* + * Describes the health state of an application resource. + */ + @JsonProperty(value = "healthState", access = JsonProperty.Access.WRITE_ONLY) + private HealthState healthState; + + /* + * When the application's health state is not 'Ok', this additional details + * from service fabric Health Manager for the user to know why the + * application is marked unhealthy. + */ + @JsonProperty(value = "unhealthyEvaluation", access = JsonProperty.Access.WRITE_ONLY) + private String unhealthyEvaluation; + + /** + * Get the description property: User readable description of the application. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: User readable description of the application. + * + * @param description the description value to set. + * @return the ApplicationProperties object itself. + */ + public ApplicationProperties withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the services property: Describes the services in the application. This property is used to create or modify + * services of the application. On get only the name of the service is returned. The service description can be + * obtained by querying for the service resource. + * + * @return the services value. + */ + public List services() { + return this.services; + } + + /** + * Set the services property: Describes the services in the application. This property is used to create or modify + * services of the application. On get only the name of the service is returned. The service description can be + * obtained by querying for the service resource. + * + * @param services the services value to set. + * @return the ApplicationProperties object itself. + */ + public ApplicationProperties withServices(List services) { + this.services = services; + return this; + } + + /** + * Get the diagnostics property: Describes the diagnostics definition and usage for an application resource. + * + * @return the diagnostics value. + */ + public DiagnosticsDescription diagnostics() { + return this.diagnostics; + } + + /** + * Set the diagnostics property: Describes the diagnostics definition and usage for an application resource. + * + * @param diagnostics the diagnostics value to set. + * @return the ApplicationProperties object itself. + */ + public ApplicationProperties withDiagnostics(DiagnosticsDescription diagnostics) { + this.diagnostics = diagnostics; + return this; + } + + /** + * Get the debugParams property: Internal - used by Visual Studio to setup the debugging session on the local + * development environment. + * + * @return the debugParams value. + */ + public String debugParams() { + return this.debugParams; + } + + /** + * Set the debugParams property: Internal - used by Visual Studio to setup the debugging session on the local + * development environment. + * + * @param debugParams the debugParams value to set. + * @return the ApplicationProperties object itself. + */ + public ApplicationProperties withDebugParams(String debugParams) { + this.debugParams = debugParams; + return this; + } + + /** + * Get the serviceNames property: Names of the services in the application. + * + * @return the serviceNames value. + */ + public List serviceNames() { + return this.serviceNames; + } + + /** + * Get the status property: Status of the application. + * + * @return the status value. + */ + public ResourceStatus status() { + return this.status; + } + + /** + * Get the statusDetails property: Gives additional information about the current status of the application. + * + * @return the statusDetails value. + */ + public String statusDetails() { + return this.statusDetails; + } + + /** + * Get the healthState property: Describes the health state of an application resource. + * + * @return the healthState value. + */ + public HealthState healthState() { + return this.healthState; + } + + /** + * Get the unhealthyEvaluation property: When the application's health state is not 'Ok', this additional details + * from service fabric Health Manager for the user to know why the application is marked unhealthy. + * + * @return the unhealthyEvaluation value. + */ + public String unhealthyEvaluation() { + return this.unhealthyEvaluation; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (services() != null) { + services().forEach(e -> e.validate()); + } + if (diagnostics() != null) { + diagnostics().validate(); + } + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ApplicationResourceDescription.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ApplicationResourceDescription.java new file mode 100644 index 0000000000000..d9b2976502beb --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ApplicationResourceDescription.java @@ -0,0 +1,284 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.servicefabricmesh.fluent.models.ApplicationResourceDescriptionInner; +import com.azure.resourcemanager.servicefabricmesh.fluent.models.ServiceResourceDescriptionInner; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of ApplicationResourceDescription. */ +public interface ApplicationResourceDescription { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the description property: User readable description of the application. + * + * @return the description value. + */ + String description(); + + /** + * Gets the services property: Describes the services in the application. This property is used to create or modify + * services of the application. On get only the name of the service is returned. The service description can be + * obtained by querying for the service resource. + * + * @return the services value. + */ + List services(); + + /** + * Gets the diagnostics property: Describes the diagnostics definition and usage for an application resource. + * + * @return the diagnostics value. + */ + DiagnosticsDescription diagnostics(); + + /** + * Gets the debugParams property: Internal - used by Visual Studio to setup the debugging session on the local + * development environment. + * + * @return the debugParams value. + */ + String debugParams(); + + /** + * Gets the serviceNames property: Names of the services in the application. + * + * @return the serviceNames value. + */ + List serviceNames(); + + /** + * Gets the status property: Status of the application. + * + * @return the status value. + */ + ResourceStatus status(); + + /** + * Gets the statusDetails property: Gives additional information about the current status of the application. + * + * @return the statusDetails value. + */ + String statusDetails(); + + /** + * Gets the healthState property: Describes the health state of an application resource. + * + * @return the healthState value. + */ + HealthState healthState(); + + /** + * Gets the unhealthyEvaluation property: When the application's health state is not 'Ok', this additional details + * from service fabric Health Manager for the user to know why the application is marked unhealthy. + * + * @return the unhealthyEvaluation value. + */ + String unhealthyEvaluation(); + + /** + * Gets the provisioningState property: State of the resource. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.servicefabricmesh.fluent.models.ApplicationResourceDescriptionInner + * object. + * + * @return the inner object. + */ + ApplicationResourceDescriptionInner innerModel(); + + /** The entirety of the ApplicationResourceDescription definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The ApplicationResourceDescription definition stages. */ + interface DefinitionStages { + /** The first stage of the ApplicationResourceDescription definition. */ + interface Blank extends WithLocation { + } + /** The stage of the ApplicationResourceDescription definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + /** The stage of the ApplicationResourceDescription definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName Azure resource group name. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * The stage of the ApplicationResourceDescription definition which contains all the minimum required properties + * for the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, + DefinitionStages.WithDescription, + DefinitionStages.WithServices, + DefinitionStages.WithDiagnostics, + DefinitionStages.WithDebugParams { + /** + * Executes the create request. + * + * @return the created resource. + */ + ApplicationResourceDescription create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ApplicationResourceDescription create(Context context); + } + /** The stage of the ApplicationResourceDescription definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the ApplicationResourceDescription definition allowing to specify description. */ + interface WithDescription { + /** + * Specifies the description property: User readable description of the application.. + * + * @param description User readable description of the application. + * @return the next definition stage. + */ + WithCreate withDescription(String description); + } + /** The stage of the ApplicationResourceDescription definition allowing to specify services. */ + interface WithServices { + /** + * Specifies the services property: Describes the services in the application. This property is used to + * create or modify services of the application. On get only the name of the service is returned. The + * service description can be obtained by querying for the service resource.. + * + * @param services Describes the services in the application. This property is used to create or modify + * services of the application. On get only the name of the service is returned. The service description + * can be obtained by querying for the service resource. + * @return the next definition stage. + */ + WithCreate withServices(List services); + } + /** The stage of the ApplicationResourceDescription definition allowing to specify diagnostics. */ + interface WithDiagnostics { + /** + * Specifies the diagnostics property: Describes the diagnostics definition and usage for an application + * resource.. + * + * @param diagnostics Describes the diagnostics definition and usage for an application resource. + * @return the next definition stage. + */ + WithCreate withDiagnostics(DiagnosticsDescription diagnostics); + } + /** The stage of the ApplicationResourceDescription definition allowing to specify debugParams. */ + interface WithDebugParams { + /** + * Specifies the debugParams property: Internal - used by Visual Studio to setup the debugging session on + * the local development environment.. + * + * @param debugParams Internal - used by Visual Studio to setup the debugging session on the local + * development environment. + * @return the next definition stage. + */ + WithCreate withDebugParams(String debugParams); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ApplicationResourceDescription refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ApplicationResourceDescription refresh(Context context); +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ApplicationResourceDescriptionList.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ApplicationResourceDescriptionList.java new file mode 100644 index 0000000000000..1a0adbc63b203 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ApplicationResourceDescriptionList.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.servicefabricmesh.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.servicefabricmesh.fluent.models.ApplicationResourceDescriptionInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A pageable list of application resources. */ +@Fluent +public final class ApplicationResourceDescriptionList { + /* + * One page of the list. + */ + @JsonProperty(value = "value") + private List value; + + /* + * URI to fetch the next page of the list. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: One page of the list. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: One page of the list. + * + * @param value the value value to set. + * @return the ApplicationResourceDescriptionList object itself. + */ + public ApplicationResourceDescriptionList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: URI to fetch the next page of the list. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: URI to fetch the next page of the list. + * + * @param nextLink the nextLink value to set. + * @return the ApplicationResourceDescriptionList object itself. + */ + public ApplicationResourceDescriptionList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ApplicationScopedVolume.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ApplicationScopedVolume.java new file mode 100644 index 0000000000000..a6331f66ef326 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ApplicationScopedVolume.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.servicefabricmesh.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes a volume whose lifetime is scoped to the application's lifetime. */ +@Fluent +public final class ApplicationScopedVolume extends VolumeReference { + /* + * Describes parameters for creating application-scoped volumes. + */ + @JsonProperty(value = "creationParameters", required = true) + private ApplicationScopedVolumeCreationParameters creationParameters; + + /** + * Get the creationParameters property: Describes parameters for creating application-scoped volumes. + * + * @return the creationParameters value. + */ + public ApplicationScopedVolumeCreationParameters creationParameters() { + return this.creationParameters; + } + + /** + * Set the creationParameters property: Describes parameters for creating application-scoped volumes. + * + * @param creationParameters the creationParameters value to set. + * @return the ApplicationScopedVolume object itself. + */ + public ApplicationScopedVolume withCreationParameters( + ApplicationScopedVolumeCreationParameters creationParameters) { + this.creationParameters = creationParameters; + return this; + } + + /** {@inheritDoc} */ + @Override + public ApplicationScopedVolume withName(String name) { + super.withName(name); + return this; + } + + /** {@inheritDoc} */ + @Override + public ApplicationScopedVolume withReadOnly(Boolean readOnly) { + super.withReadOnly(readOnly); + return this; + } + + /** {@inheritDoc} */ + @Override + public ApplicationScopedVolume withDestinationPath(String destinationPath) { + super.withDestinationPath(destinationPath); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (creationParameters() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property creationParameters in model ApplicationScopedVolume")); + } else { + creationParameters().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ApplicationScopedVolume.class); +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ApplicationScopedVolumeCreationParameters.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ApplicationScopedVolumeCreationParameters.java new file mode 100644 index 0000000000000..975627b481145 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ApplicationScopedVolumeCreationParameters.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** Describes parameters for creating application-scoped volumes. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "kind", + defaultImpl = ApplicationScopedVolumeCreationParameters.class) +@JsonTypeName("ApplicationScopedVolumeCreationParameters") +@JsonSubTypes({ + @JsonSubTypes.Type( + name = "ServiceFabricVolumeDisk", + value = ApplicationScopedVolumeCreationParametersServiceFabricVolumeDisk.class) +}) +@Fluent +public class ApplicationScopedVolumeCreationParameters { + /* + * User readable description of the volume. + */ + @JsonProperty(value = "description") + private String description; + + /** + * Get the description property: User readable description of the volume. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: User readable description of the volume. + * + * @param description the description value to set. + * @return the ApplicationScopedVolumeCreationParameters object itself. + */ + public ApplicationScopedVolumeCreationParameters withDescription(String description) { + this.description = description; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ApplicationScopedVolumeCreationParametersServiceFabricVolumeDisk.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ApplicationScopedVolumeCreationParametersServiceFabricVolumeDisk.java new file mode 100644 index 0000000000000..95a95f412bfc0 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ApplicationScopedVolumeCreationParametersServiceFabricVolumeDisk.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** Describes parameters for creating application-scoped volumes provided by Service Fabric Volume Disks. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "kind") +@JsonTypeName("ServiceFabricVolumeDisk") +@Fluent +public final class ApplicationScopedVolumeCreationParametersServiceFabricVolumeDisk + extends ApplicationScopedVolumeCreationParameters { + /* + * Volume size + */ + @JsonProperty(value = "sizeDisk", required = true) + private SizeTypes sizeDisk; + + /** + * Get the sizeDisk property: Volume size. + * + * @return the sizeDisk value. + */ + public SizeTypes sizeDisk() { + return this.sizeDisk; + } + + /** + * Set the sizeDisk property: Volume size. + * + * @param sizeDisk the sizeDisk value to set. + * @return the ApplicationScopedVolumeCreationParametersServiceFabricVolumeDisk object itself. + */ + public ApplicationScopedVolumeCreationParametersServiceFabricVolumeDisk withSizeDisk(SizeTypes sizeDisk) { + this.sizeDisk = sizeDisk; + return this; + } + + /** {@inheritDoc} */ + @Override + public ApplicationScopedVolumeCreationParametersServiceFabricVolumeDisk withDescription(String description) { + super.withDescription(description); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (sizeDisk() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property sizeDisk in model" + + " ApplicationScopedVolumeCreationParametersServiceFabricVolumeDisk")); + } + } + + private static final ClientLogger LOGGER = + new ClientLogger(ApplicationScopedVolumeCreationParametersServiceFabricVolumeDisk.class); +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ApplicationScopedVolumeKind.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ApplicationScopedVolumeKind.java new file mode 100644 index 0000000000000..c0746da83ce13 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ApplicationScopedVolumeKind.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ApplicationScopedVolumeKind. */ +public final class ApplicationScopedVolumeKind extends ExpandableStringEnum { + /** Static value ServiceFabricVolumeDisk for ApplicationScopedVolumeKind. */ + public static final ApplicationScopedVolumeKind SERVICE_FABRIC_VOLUME_DISK = fromString("ServiceFabricVolumeDisk"); + + /** + * Creates or finds a ApplicationScopedVolumeKind from its string representation. + * + * @param name a name to look for. + * @return the corresponding ApplicationScopedVolumeKind. + */ + @JsonCreator + public static ApplicationScopedVolumeKind fromString(String name) { + return fromString(name, ApplicationScopedVolumeKind.class); + } + + /** + * Gets known ApplicationScopedVolumeKind values. + * + * @return known ApplicationScopedVolumeKind values. + */ + public static Collection values() { + return values(ApplicationScopedVolumeKind.class); + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/Applications.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/Applications.java new file mode 100644 index 0000000000000..52a6ded9accd3 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/Applications.java @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.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 Applications. */ +public interface Applications { + /** + * Gets the information about the application resource with the given name. The information include the description + * and other properties of the application. + * + * @param resourceGroupName Azure resource group name. + * @param applicationResourceName The identity of the application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about the application resource with the given name. + */ + ApplicationResourceDescription getByResourceGroup(String resourceGroupName, String applicationResourceName); + + /** + * Gets the information about the application resource with the given name. The information include the description + * and other properties of the application. + * + * @param resourceGroupName Azure resource group name. + * @param applicationResourceName The identity of the application. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about the application resource with the given name along with {@link Response}. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String applicationResourceName, Context context); + + /** + * Deletes the application resource identified by the name. + * + * @param resourceGroupName Azure resource group name. + * @param applicationResourceName The identity of the application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String applicationResourceName); + + /** + * Deletes the application resource identified by the name. + * + * @param resourceGroupName Azure resource group name. + * @param applicationResourceName The identity of the application. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException 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 applicationResourceName, Context context); + + /** + * Gets the information about all application resources in a given resource group. The information include the + * description and other properties of the Application. + * + * @param resourceGroupName Azure resource group name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all application resources in a given resource group as paginated response with + * {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Gets the information about all application resources in a given resource group. The information include the + * description and other properties of the Application. + * + * @param resourceGroupName Azure resource group name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all application resources in a given resource group as paginated response with + * {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Gets the information about all application resources in a given resource group. The information include the + * description and other properties of the application. + * + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all application resources in a given resource group as paginated response with + * {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * Gets the information about all application resources in a given resource group. The information include the + * description and other properties of the application. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all application resources in a given resource group as paginated response with + * {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Gets the information about the application resource with the given name. The information include the description + * and other properties of the application. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about the application resource with the given name along with {@link Response}. + */ + ApplicationResourceDescription getById(String id); + + /** + * Gets the information about the application resource with the given name. The information include the description + * and other properties of the application. + * + * @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.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about the application resource with the given name along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes the application resource identified by the name. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes the application resource identified by the name. + * + * @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.resourcemanager.servicefabricmesh.models.ErrorErrorModelException 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 ApplicationResourceDescription resource. + * + * @param name resource name. + * @return the first stage of the new ApplicationResourceDescription definition. + */ + ApplicationResourceDescription.DefinitionStages.Blank define(String name); +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/AutoScalingMechanism.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/AutoScalingMechanism.java new file mode 100644 index 0000000000000..7888e8566e9dd --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/AutoScalingMechanism.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.servicefabricmesh.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * Describes the mechanism for performing auto scaling operation. Derived classes will describe the actual mechanism. + */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "kind", + defaultImpl = AutoScalingMechanism.class) +@JsonTypeName("AutoScalingMechanism") +@JsonSubTypes({@JsonSubTypes.Type(name = "AddRemoveReplica", value = AddRemoveReplicaScalingMechanism.class)}) +@Immutable +public class AutoScalingMechanism { + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/AutoScalingMechanismKind.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/AutoScalingMechanismKind.java new file mode 100644 index 0000000000000..31ceb35881130 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/AutoScalingMechanismKind.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for AutoScalingMechanismKind. */ +public final class AutoScalingMechanismKind extends ExpandableStringEnum { + /** Static value AddRemoveReplica for AutoScalingMechanismKind. */ + public static final AutoScalingMechanismKind ADD_REMOVE_REPLICA = fromString("AddRemoveReplica"); + + /** + * Creates or finds a AutoScalingMechanismKind from its string representation. + * + * @param name a name to look for. + * @return the corresponding AutoScalingMechanismKind. + */ + @JsonCreator + public static AutoScalingMechanismKind fromString(String name) { + return fromString(name, AutoScalingMechanismKind.class); + } + + /** + * Gets known AutoScalingMechanismKind values. + * + * @return known AutoScalingMechanismKind values. + */ + public static Collection values() { + return values(AutoScalingMechanismKind.class); + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/AutoScalingMetric.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/AutoScalingMetric.java new file mode 100644 index 0000000000000..ecbb39eb45377 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/AutoScalingMetric.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * Describes the metric that is used for triggering auto scaling operation. Derived classes will describe resources or + * metrics. + */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "kind", + defaultImpl = AutoScalingMetric.class) +@JsonTypeName("AutoScalingMetric") +@JsonSubTypes({@JsonSubTypes.Type(name = "Resource", value = AutoScalingResourceMetric.class)}) +@Immutable +public class AutoScalingMetric { + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/AutoScalingMetricKind.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/AutoScalingMetricKind.java new file mode 100644 index 0000000000000..9c8787d15de41 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/AutoScalingMetricKind.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for AutoScalingMetricKind. */ +public final class AutoScalingMetricKind extends ExpandableStringEnum { + /** Static value Resource for AutoScalingMetricKind. */ + public static final AutoScalingMetricKind RESOURCE = fromString("Resource"); + + /** + * Creates or finds a AutoScalingMetricKind from its string representation. + * + * @param name a name to look for. + * @return the corresponding AutoScalingMetricKind. + */ + @JsonCreator + public static AutoScalingMetricKind fromString(String name) { + return fromString(name, AutoScalingMetricKind.class); + } + + /** + * Gets known AutoScalingMetricKind values. + * + * @return known AutoScalingMetricKind values. + */ + public static Collection values() { + return values(AutoScalingMetricKind.class); + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/AutoScalingPolicy.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/AutoScalingPolicy.java new file mode 100644 index 0000000000000..a9dbad74923be --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/AutoScalingPolicy.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes the auto scaling policy. */ +@Fluent +public final class AutoScalingPolicy { + /* + * The name of the auto scaling policy. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * Determines when auto scaling operation will be invoked. + */ + @JsonProperty(value = "trigger", required = true) + private AutoScalingTrigger trigger; + + /* + * The mechanism that is used to scale when auto scaling operation is + * invoked. + */ + @JsonProperty(value = "mechanism", required = true) + private AutoScalingMechanism mechanism; + + /** + * Get the name property: The name of the auto scaling policy. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the auto scaling policy. + * + * @param name the name value to set. + * @return the AutoScalingPolicy object itself. + */ + public AutoScalingPolicy withName(String name) { + this.name = name; + return this; + } + + /** + * Get the trigger property: Determines when auto scaling operation will be invoked. + * + * @return the trigger value. + */ + public AutoScalingTrigger trigger() { + return this.trigger; + } + + /** + * Set the trigger property: Determines when auto scaling operation will be invoked. + * + * @param trigger the trigger value to set. + * @return the AutoScalingPolicy object itself. + */ + public AutoScalingPolicy withTrigger(AutoScalingTrigger trigger) { + this.trigger = trigger; + return this; + } + + /** + * Get the mechanism property: The mechanism that is used to scale when auto scaling operation is invoked. + * + * @return the mechanism value. + */ + public AutoScalingMechanism mechanism() { + return this.mechanism; + } + + /** + * Set the mechanism property: The mechanism that is used to scale when auto scaling operation is invoked. + * + * @param mechanism the mechanism value to set. + * @return the AutoScalingPolicy object itself. + */ + public AutoScalingPolicy withMechanism(AutoScalingMechanism mechanism) { + this.mechanism = mechanism; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property name in model AutoScalingPolicy")); + } + if (trigger() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property trigger in model AutoScalingPolicy")); + } else { + trigger().validate(); + } + if (mechanism() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property mechanism in model AutoScalingPolicy")); + } else { + mechanism().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(AutoScalingPolicy.class); +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/AutoScalingResourceMetric.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/AutoScalingResourceMetric.java new file mode 100644 index 0000000000000..d98ce41fc0680 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/AutoScalingResourceMetric.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** Describes the resource that is used for triggering auto scaling. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "kind") +@JsonTypeName("Resource") +@Fluent +public final class AutoScalingResourceMetric extends AutoScalingMetric { + /* + * Name of the resource. + */ + @JsonProperty(value = "name", required = true) + private AutoScalingResourceMetricName name; + + /** + * Get the name property: Name of the resource. + * + * @return the name value. + */ + public AutoScalingResourceMetricName name() { + return this.name; + } + + /** + * Set the name property: Name of the resource. + * + * @param name the name value to set. + * @return the AutoScalingResourceMetric object itself. + */ + public AutoScalingResourceMetric withName(AutoScalingResourceMetricName name) { + this.name = name; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (name() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property name in model AutoScalingResourceMetric")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(AutoScalingResourceMetric.class); +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/AutoScalingResourceMetricName.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/AutoScalingResourceMetricName.java new file mode 100644 index 0000000000000..ee5ee3b01b640 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/AutoScalingResourceMetricName.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.servicefabricmesh.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for AutoScalingResourceMetricName. */ +public final class AutoScalingResourceMetricName extends ExpandableStringEnum { + /** Static value cpu for AutoScalingResourceMetricName. */ + public static final AutoScalingResourceMetricName CPU = fromString("cpu"); + + /** Static value memoryInGB for AutoScalingResourceMetricName. */ + public static final AutoScalingResourceMetricName MEMORY_IN_GB = fromString("memoryInGB"); + + /** + * Creates or finds a AutoScalingResourceMetricName from its string representation. + * + * @param name a name to look for. + * @return the corresponding AutoScalingResourceMetricName. + */ + @JsonCreator + public static AutoScalingResourceMetricName fromString(String name) { + return fromString(name, AutoScalingResourceMetricName.class); + } + + /** + * Gets known AutoScalingResourceMetricName values. + * + * @return known AutoScalingResourceMetricName values. + */ + public static Collection values() { + return values(AutoScalingResourceMetricName.class); + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/AutoScalingTrigger.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/AutoScalingTrigger.java new file mode 100644 index 0000000000000..744ae34bac4fc --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/AutoScalingTrigger.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.servicefabricmesh.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** Describes the trigger for performing auto scaling operation. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "kind", + defaultImpl = AutoScalingTrigger.class) +@JsonTypeName("AutoScalingTrigger") +@JsonSubTypes({@JsonSubTypes.Type(name = "AverageLoad", value = AverageLoadScalingTrigger.class)}) +@Immutable +public class AutoScalingTrigger { + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/AutoScalingTriggerKind.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/AutoScalingTriggerKind.java new file mode 100644 index 0000000000000..eceb5e1bf5b87 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/AutoScalingTriggerKind.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for AutoScalingTriggerKind. */ +public final class AutoScalingTriggerKind extends ExpandableStringEnum { + /** Static value AverageLoad for AutoScalingTriggerKind. */ + public static final AutoScalingTriggerKind AVERAGE_LOAD = fromString("AverageLoad"); + + /** + * Creates or finds a AutoScalingTriggerKind from its string representation. + * + * @param name a name to look for. + * @return the corresponding AutoScalingTriggerKind. + */ + @JsonCreator + public static AutoScalingTriggerKind fromString(String name) { + return fromString(name, AutoScalingTriggerKind.class); + } + + /** + * Gets known AutoScalingTriggerKind values. + * + * @return known AutoScalingTriggerKind values. + */ + public static Collection values() { + return values(AutoScalingTriggerKind.class); + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/AvailableOperationDisplay.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/AvailableOperationDisplay.java new file mode 100644 index 0000000000000..8bff55c73dd39 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/AvailableOperationDisplay.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.servicefabricmesh.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** An operation available at the listed Azure resource provider. */ +@Fluent +public final class AvailableOperationDisplay { + /* + * Name of the operation provider. + */ + @JsonProperty(value = "provider") + private String provider; + + /* + * Name of the resource on which the operation is available. + */ + @JsonProperty(value = "resource") + private String resource; + + /* + * Name of the available operation. + */ + @JsonProperty(value = "operation") + private String operation; + + /* + * Description of the available operation. + */ + @JsonProperty(value = "description") + private String description; + + /** + * Get the provider property: Name of the operation provider. + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Set the provider property: Name of the operation provider. + * + * @param provider the provider value to set. + * @return the AvailableOperationDisplay object itself. + */ + public AvailableOperationDisplay withProvider(String provider) { + this.provider = provider; + return this; + } + + /** + * Get the resource property: Name of the resource on which the operation is available. + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Set the resource property: Name of the resource on which the operation is available. + * + * @param resource the resource value to set. + * @return the AvailableOperationDisplay object itself. + */ + public AvailableOperationDisplay withResource(String resource) { + this.resource = resource; + return this; + } + + /** + * Get the operation property: Name of the available operation. + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Set the operation property: Name of the available operation. + * + * @param operation the operation value to set. + * @return the AvailableOperationDisplay object itself. + */ + public AvailableOperationDisplay withOperation(String operation) { + this.operation = operation; + return this; + } + + /** + * Get the description property: Description of the available operation. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Description of the available operation. + * + * @param description the description value to set. + * @return the AvailableOperationDisplay object itself. + */ + public AvailableOperationDisplay withDescription(String description) { + this.description = description; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/AverageLoadScalingTrigger.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/AverageLoadScalingTrigger.java new file mode 100644 index 0000000000000..7165f9a62c9e1 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/AverageLoadScalingTrigger.java @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** Describes the average load trigger used for auto scaling. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "kind") +@JsonTypeName("AverageLoad") +@Fluent +public final class AverageLoadScalingTrigger extends AutoScalingTrigger { + /* + * Description of the metric that is used for scaling. + */ + @JsonProperty(value = "metric", required = true) + private AutoScalingMetric metric; + + /* + * Lower load threshold (if average load is below this threshold, service + * will scale down). + */ + @JsonProperty(value = "lowerLoadThreshold", required = true) + private double lowerLoadThreshold; + + /* + * Upper load threshold (if average load is above this threshold, service + * will scale up). + */ + @JsonProperty(value = "upperLoadThreshold", required = true) + private double upperLoadThreshold; + + /* + * Scale interval that indicates how often will this trigger be checked. + */ + @JsonProperty(value = "scaleIntervalInSeconds", required = true) + private int scaleIntervalInSeconds; + + /** + * Get the metric property: Description of the metric that is used for scaling. + * + * @return the metric value. + */ + public AutoScalingMetric metric() { + return this.metric; + } + + /** + * Set the metric property: Description of the metric that is used for scaling. + * + * @param metric the metric value to set. + * @return the AverageLoadScalingTrigger object itself. + */ + public AverageLoadScalingTrigger withMetric(AutoScalingMetric metric) { + this.metric = metric; + return this; + } + + /** + * Get the lowerLoadThreshold property: Lower load threshold (if average load is below this threshold, service will + * scale down). + * + * @return the lowerLoadThreshold value. + */ + public double lowerLoadThreshold() { + return this.lowerLoadThreshold; + } + + /** + * Set the lowerLoadThreshold property: Lower load threshold (if average load is below this threshold, service will + * scale down). + * + * @param lowerLoadThreshold the lowerLoadThreshold value to set. + * @return the AverageLoadScalingTrigger object itself. + */ + public AverageLoadScalingTrigger withLowerLoadThreshold(double lowerLoadThreshold) { + this.lowerLoadThreshold = lowerLoadThreshold; + return this; + } + + /** + * Get the upperLoadThreshold property: Upper load threshold (if average load is above this threshold, service will + * scale up). + * + * @return the upperLoadThreshold value. + */ + public double upperLoadThreshold() { + return this.upperLoadThreshold; + } + + /** + * Set the upperLoadThreshold property: Upper load threshold (if average load is above this threshold, service will + * scale up). + * + * @param upperLoadThreshold the upperLoadThreshold value to set. + * @return the AverageLoadScalingTrigger object itself. + */ + public AverageLoadScalingTrigger withUpperLoadThreshold(double upperLoadThreshold) { + this.upperLoadThreshold = upperLoadThreshold; + return this; + } + + /** + * Get the scaleIntervalInSeconds property: Scale interval that indicates how often will this trigger be checked. + * + * @return the scaleIntervalInSeconds value. + */ + public int scaleIntervalInSeconds() { + return this.scaleIntervalInSeconds; + } + + /** + * Set the scaleIntervalInSeconds property: Scale interval that indicates how often will this trigger be checked. + * + * @param scaleIntervalInSeconds the scaleIntervalInSeconds value to set. + * @return the AverageLoadScalingTrigger object itself. + */ + public AverageLoadScalingTrigger withScaleIntervalInSeconds(int scaleIntervalInSeconds) { + this.scaleIntervalInSeconds = scaleIntervalInSeconds; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (metric() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property metric in model AverageLoadScalingTrigger")); + } else { + metric().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(AverageLoadScalingTrigger.class); +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/AzureInternalMonitoringPipelineSinkDescription.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/AzureInternalMonitoringPipelineSinkDescription.java new file mode 100644 index 0000000000000..9704273044275 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/AzureInternalMonitoringPipelineSinkDescription.java @@ -0,0 +1,171 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** Diagnostics settings for Geneva. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "kind") +@JsonTypeName("AzureInternalMonitoringPipeline") +@Fluent +public final class AzureInternalMonitoringPipelineSinkDescription extends DiagnosticsSinkProperties { + /* + * Azure Internal monitoring pipeline account. + */ + @JsonProperty(value = "accountName") + private String accountName; + + /* + * Azure Internal monitoring pipeline account namespace. + */ + @JsonProperty(value = "namespace") + private String namespace; + + /* + * Azure Internal monitoring agent configuration. + */ + @JsonProperty(value = "maConfigUrl") + private String maConfigUrl; + + /* + * Azure Internal monitoring agent fluentd configuration. + */ + @JsonProperty(value = "fluentdConfigUrl") + private Object fluentdConfigUrl; + + /* + * Azure Internal monitoring pipeline autokey associated with the + * certificate. + */ + @JsonProperty(value = "autoKeyConfigUrl") + private String autoKeyConfigUrl; + + /** + * Get the accountName property: Azure Internal monitoring pipeline account. + * + * @return the accountName value. + */ + public String accountName() { + return this.accountName; + } + + /** + * Set the accountName property: Azure Internal monitoring pipeline account. + * + * @param accountName the accountName value to set. + * @return the AzureInternalMonitoringPipelineSinkDescription object itself. + */ + public AzureInternalMonitoringPipelineSinkDescription withAccountName(String accountName) { + this.accountName = accountName; + return this; + } + + /** + * Get the namespace property: Azure Internal monitoring pipeline account namespace. + * + * @return the namespace value. + */ + public String namespace() { + return this.namespace; + } + + /** + * Set the namespace property: Azure Internal monitoring pipeline account namespace. + * + * @param namespace the namespace value to set. + * @return the AzureInternalMonitoringPipelineSinkDescription object itself. + */ + public AzureInternalMonitoringPipelineSinkDescription withNamespace(String namespace) { + this.namespace = namespace; + return this; + } + + /** + * Get the maConfigUrl property: Azure Internal monitoring agent configuration. + * + * @return the maConfigUrl value. + */ + public String maConfigUrl() { + return this.maConfigUrl; + } + + /** + * Set the maConfigUrl property: Azure Internal monitoring agent configuration. + * + * @param maConfigUrl the maConfigUrl value to set. + * @return the AzureInternalMonitoringPipelineSinkDescription object itself. + */ + public AzureInternalMonitoringPipelineSinkDescription withMaConfigUrl(String maConfigUrl) { + this.maConfigUrl = maConfigUrl; + return this; + } + + /** + * Get the fluentdConfigUrl property: Azure Internal monitoring agent fluentd configuration. + * + * @return the fluentdConfigUrl value. + */ + public Object fluentdConfigUrl() { + return this.fluentdConfigUrl; + } + + /** + * Set the fluentdConfigUrl property: Azure Internal monitoring agent fluentd configuration. + * + * @param fluentdConfigUrl the fluentdConfigUrl value to set. + * @return the AzureInternalMonitoringPipelineSinkDescription object itself. + */ + public AzureInternalMonitoringPipelineSinkDescription withFluentdConfigUrl(Object fluentdConfigUrl) { + this.fluentdConfigUrl = fluentdConfigUrl; + return this; + } + + /** + * Get the autoKeyConfigUrl property: Azure Internal monitoring pipeline autokey associated with the certificate. + * + * @return the autoKeyConfigUrl value. + */ + public String autoKeyConfigUrl() { + return this.autoKeyConfigUrl; + } + + /** + * Set the autoKeyConfigUrl property: Azure Internal monitoring pipeline autokey associated with the certificate. + * + * @param autoKeyConfigUrl the autoKeyConfigUrl value to set. + * @return the AzureInternalMonitoringPipelineSinkDescription object itself. + */ + public AzureInternalMonitoringPipelineSinkDescription withAutoKeyConfigUrl(String autoKeyConfigUrl) { + this.autoKeyConfigUrl = autoKeyConfigUrl; + return this; + } + + /** {@inheritDoc} */ + @Override + public AzureInternalMonitoringPipelineSinkDescription withName(String name) { + super.withName(name); + return this; + } + + /** {@inheritDoc} */ + @Override + public AzureInternalMonitoringPipelineSinkDescription withDescription(String description) { + super.withDescription(description); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/CodePackages.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/CodePackages.java new file mode 100644 index 0000000000000..dbca9aa4cfd45 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/CodePackages.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.servicefabricmesh.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of CodePackages. */ +public interface CodePackages { + /** + * Gets the logs for the container of the specified code package of the service replica. + * + * @param resourceGroupName Azure resource group name. + * @param applicationResourceName The identity of the application. + * @param serviceResourceName The identity of the service. + * @param replicaName Service Fabric replica name. + * @param codePackageName The name of code package of the service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the logs for the container of the specified code package of the service replica. + */ + ContainerLogs getContainerLogs( + String resourceGroupName, + String applicationResourceName, + String serviceResourceName, + String replicaName, + String codePackageName); + + /** + * Gets the logs for the container of the specified code package of the service replica. + * + * @param resourceGroupName Azure resource group name. + * @param applicationResourceName The identity of the application. + * @param serviceResourceName The identity of the service. + * @param replicaName Service Fabric replica name. + * @param codePackageName The name of code package of the service. + * @param tail Number of lines to show from the end of the logs. Default is 100. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the logs for the container of the specified code package of the service replica along with {@link + * Response}. + */ + Response getContainerLogsWithResponse( + String resourceGroupName, + String applicationResourceName, + String serviceResourceName, + String replicaName, + String codePackageName, + Integer tail, + Context context); +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ContainerCodePackageProperties.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ContainerCodePackageProperties.java new file mode 100644 index 0000000000000..64c576d040f4f --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ContainerCodePackageProperties.java @@ -0,0 +1,470 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Describes a container and its runtime properties. */ +@Fluent +public final class ContainerCodePackageProperties { + /* + * The name of the code package. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * The Container image to use. + */ + @JsonProperty(value = "image", required = true) + private String image; + + /* + * Image registry credential. + */ + @JsonProperty(value = "imageRegistryCredential") + private ImageRegistryCredential imageRegistryCredential; + + /* + * Override for the default entry point in the container. + */ + @JsonProperty(value = "entrypoint") + private String entrypoint; + + /* + * Command array to execute within the container in exec form. + */ + @JsonProperty(value = "commands") + private List commands; + + /* + * The environment variables to set in this container + */ + @JsonProperty(value = "environmentVariables") + private List environmentVariables; + + /* + * The settings to set in this container. The setting file path can be + * fetched from environment variable "Fabric_SettingPath". The path for + * Windows container is "C:\\secrets". The path for Linux container is + * "/var/secrets". + */ + @JsonProperty(value = "settings") + private List settings; + + /* + * The labels to set in this container. + */ + @JsonProperty(value = "labels") + private List labels; + + /* + * The endpoints exposed by this container. + */ + @JsonProperty(value = "endpoints") + private List endpoints; + + /* + * The resources required by this container. + */ + @JsonProperty(value = "resources", required = true) + private ResourceRequirements resources; + + /* + * Volumes to be attached to the container. The lifetime of these volumes + * is independent of the application's lifetime. + */ + @JsonProperty(value = "volumeRefs") + private List volumeRefs; + + /* + * Volumes to be attached to the container. The lifetime of these volumes + * is scoped to the application's lifetime. + */ + @JsonProperty(value = "volumes") + private List volumes; + + /* + * Reference to sinks in DiagnosticsDescription. + */ + @JsonProperty(value = "diagnostics") + private DiagnosticsRef diagnostics; + + /* + * A list of ReliableCollection resources used by this particular code + * package. Please refer to ReliableCollectionsRef for more details. + */ + @JsonProperty(value = "reliableCollectionsRefs") + private List reliableCollectionsRefs; + + /* + * Runtime information of a container instance. + */ + @JsonProperty(value = "instanceView", access = JsonProperty.Access.WRITE_ONLY) + private ContainerInstanceView instanceView; + + /** + * Get the name property: The name of the code package. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the code package. + * + * @param name the name value to set. + * @return the ContainerCodePackageProperties object itself. + */ + public ContainerCodePackageProperties withName(String name) { + this.name = name; + return this; + } + + /** + * Get the image property: The Container image to use. + * + * @return the image value. + */ + public String image() { + return this.image; + } + + /** + * Set the image property: The Container image to use. + * + * @param image the image value to set. + * @return the ContainerCodePackageProperties object itself. + */ + public ContainerCodePackageProperties withImage(String image) { + this.image = image; + return this; + } + + /** + * Get the imageRegistryCredential property: Image registry credential. + * + * @return the imageRegistryCredential value. + */ + public ImageRegistryCredential imageRegistryCredential() { + return this.imageRegistryCredential; + } + + /** + * Set the imageRegistryCredential property: Image registry credential. + * + * @param imageRegistryCredential the imageRegistryCredential value to set. + * @return the ContainerCodePackageProperties object itself. + */ + public ContainerCodePackageProperties withImageRegistryCredential(ImageRegistryCredential imageRegistryCredential) { + this.imageRegistryCredential = imageRegistryCredential; + return this; + } + + /** + * Get the entrypoint property: Override for the default entry point in the container. + * + * @return the entrypoint value. + */ + public String entrypoint() { + return this.entrypoint; + } + + /** + * Set the entrypoint property: Override for the default entry point in the container. + * + * @param entrypoint the entrypoint value to set. + * @return the ContainerCodePackageProperties object itself. + */ + public ContainerCodePackageProperties withEntrypoint(String entrypoint) { + this.entrypoint = entrypoint; + return this; + } + + /** + * Get the commands property: Command array to execute within the container in exec form. + * + * @return the commands value. + */ + public List commands() { + return this.commands; + } + + /** + * Set the commands property: Command array to execute within the container in exec form. + * + * @param commands the commands value to set. + * @return the ContainerCodePackageProperties object itself. + */ + public ContainerCodePackageProperties withCommands(List commands) { + this.commands = commands; + return this; + } + + /** + * Get the environmentVariables property: The environment variables to set in this container. + * + * @return the environmentVariables value. + */ + public List environmentVariables() { + return this.environmentVariables; + } + + /** + * Set the environmentVariables property: The environment variables to set in this container. + * + * @param environmentVariables the environmentVariables value to set. + * @return the ContainerCodePackageProperties object itself. + */ + public ContainerCodePackageProperties withEnvironmentVariables(List environmentVariables) { + this.environmentVariables = environmentVariables; + return this; + } + + /** + * Get the settings property: The settings to set in this container. The setting file path can be fetched from + * environment variable "Fabric_SettingPath". The path for Windows container is "C:\\secrets". The path for Linux + * container is "/var/secrets". + * + * @return the settings value. + */ + public List settings() { + return this.settings; + } + + /** + * Set the settings property: The settings to set in this container. The setting file path can be fetched from + * environment variable "Fabric_SettingPath". The path for Windows container is "C:\\secrets". The path for Linux + * container is "/var/secrets". + * + * @param settings the settings value to set. + * @return the ContainerCodePackageProperties object itself. + */ + public ContainerCodePackageProperties withSettings(List settings) { + this.settings = settings; + return this; + } + + /** + * Get the labels property: The labels to set in this container. + * + * @return the labels value. + */ + public List labels() { + return this.labels; + } + + /** + * Set the labels property: The labels to set in this container. + * + * @param labels the labels value to set. + * @return the ContainerCodePackageProperties object itself. + */ + public ContainerCodePackageProperties withLabels(List labels) { + this.labels = labels; + return this; + } + + /** + * Get the endpoints property: The endpoints exposed by this container. + * + * @return the endpoints value. + */ + public List endpoints() { + return this.endpoints; + } + + /** + * Set the endpoints property: The endpoints exposed by this container. + * + * @param endpoints the endpoints value to set. + * @return the ContainerCodePackageProperties object itself. + */ + public ContainerCodePackageProperties withEndpoints(List endpoints) { + this.endpoints = endpoints; + return this; + } + + /** + * Get the resources property: The resources required by this container. + * + * @return the resources value. + */ + public ResourceRequirements resources() { + return this.resources; + } + + /** + * Set the resources property: The resources required by this container. + * + * @param resources the resources value to set. + * @return the ContainerCodePackageProperties object itself. + */ + public ContainerCodePackageProperties withResources(ResourceRequirements resources) { + this.resources = resources; + return this; + } + + /** + * Get the volumeRefs property: Volumes to be attached to the container. The lifetime of these volumes is + * independent of the application's lifetime. + * + * @return the volumeRefs value. + */ + public List volumeRefs() { + return this.volumeRefs; + } + + /** + * Set the volumeRefs property: Volumes to be attached to the container. The lifetime of these volumes is + * independent of the application's lifetime. + * + * @param volumeRefs the volumeRefs value to set. + * @return the ContainerCodePackageProperties object itself. + */ + public ContainerCodePackageProperties withVolumeRefs(List volumeRefs) { + this.volumeRefs = volumeRefs; + return this; + } + + /** + * Get the volumes property: Volumes to be attached to the container. The lifetime of these volumes is scoped to the + * application's lifetime. + * + * @return the volumes value. + */ + public List volumes() { + return this.volumes; + } + + /** + * Set the volumes property: Volumes to be attached to the container. The lifetime of these volumes is scoped to the + * application's lifetime. + * + * @param volumes the volumes value to set. + * @return the ContainerCodePackageProperties object itself. + */ + public ContainerCodePackageProperties withVolumes(List volumes) { + this.volumes = volumes; + return this; + } + + /** + * Get the diagnostics property: Reference to sinks in DiagnosticsDescription. + * + * @return the diagnostics value. + */ + public DiagnosticsRef diagnostics() { + return this.diagnostics; + } + + /** + * Set the diagnostics property: Reference to sinks in DiagnosticsDescription. + * + * @param diagnostics the diagnostics value to set. + * @return the ContainerCodePackageProperties object itself. + */ + public ContainerCodePackageProperties withDiagnostics(DiagnosticsRef diagnostics) { + this.diagnostics = diagnostics; + return this; + } + + /** + * Get the reliableCollectionsRefs property: A list of ReliableCollection resources used by this particular code + * package. Please refer to ReliableCollectionsRef for more details. + * + * @return the reliableCollectionsRefs value. + */ + public List reliableCollectionsRefs() { + return this.reliableCollectionsRefs; + } + + /** + * Set the reliableCollectionsRefs property: A list of ReliableCollection resources used by this particular code + * package. Please refer to ReliableCollectionsRef for more details. + * + * @param reliableCollectionsRefs the reliableCollectionsRefs value to set. + * @return the ContainerCodePackageProperties object itself. + */ + public ContainerCodePackageProperties withReliableCollectionsRefs( + List reliableCollectionsRefs) { + this.reliableCollectionsRefs = reliableCollectionsRefs; + return this; + } + + /** + * Get the instanceView property: Runtime information of a container instance. + * + * @return the instanceView value. + */ + public ContainerInstanceView instanceView() { + return this.instanceView; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property name in model ContainerCodePackageProperties")); + } + if (image() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property image in model ContainerCodePackageProperties")); + } + if (imageRegistryCredential() != null) { + imageRegistryCredential().validate(); + } + if (environmentVariables() != null) { + environmentVariables().forEach(e -> e.validate()); + } + if (settings() != null) { + settings().forEach(e -> e.validate()); + } + if (labels() != null) { + labels().forEach(e -> e.validate()); + } + if (endpoints() != null) { + endpoints().forEach(e -> e.validate()); + } + if (resources() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property resources in model ContainerCodePackageProperties")); + } else { + resources().validate(); + } + if (volumeRefs() != null) { + volumeRefs().forEach(e -> e.validate()); + } + if (volumes() != null) { + volumes().forEach(e -> e.validate()); + } + if (diagnostics() != null) { + diagnostics().validate(); + } + if (reliableCollectionsRefs() != null) { + reliableCollectionsRefs().forEach(e -> e.validate()); + } + if (instanceView() != null) { + instanceView().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ContainerCodePackageProperties.class); +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ContainerEvent.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ContainerEvent.java new file mode 100644 index 0000000000000..cf4d4e2be09aa --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ContainerEvent.java @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A container event. */ +@Fluent +public final class ContainerEvent { + /* + * The name of the container event. + */ + @JsonProperty(value = "name") + private String name; + + /* + * The count of the event. + */ + @JsonProperty(value = "count") + private Integer count; + + /* + * Date/time of the first event. + */ + @JsonProperty(value = "firstTimestamp") + private String firstTimestamp; + + /* + * Date/time of the last event. + */ + @JsonProperty(value = "lastTimestamp") + private String lastTimestamp; + + /* + * The event message + */ + @JsonProperty(value = "message") + private String message; + + /* + * The event type. + */ + @JsonProperty(value = "type") + private String type; + + /** + * Get the name property: The name of the container event. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the container event. + * + * @param name the name value to set. + * @return the ContainerEvent object itself. + */ + public ContainerEvent withName(String name) { + this.name = name; + return this; + } + + /** + * Get the count property: The count of the event. + * + * @return the count value. + */ + public Integer count() { + return this.count; + } + + /** + * Set the count property: The count of the event. + * + * @param count the count value to set. + * @return the ContainerEvent object itself. + */ + public ContainerEvent withCount(Integer count) { + this.count = count; + return this; + } + + /** + * Get the firstTimestamp property: Date/time of the first event. + * + * @return the firstTimestamp value. + */ + public String firstTimestamp() { + return this.firstTimestamp; + } + + /** + * Set the firstTimestamp property: Date/time of the first event. + * + * @param firstTimestamp the firstTimestamp value to set. + * @return the ContainerEvent object itself. + */ + public ContainerEvent withFirstTimestamp(String firstTimestamp) { + this.firstTimestamp = firstTimestamp; + return this; + } + + /** + * Get the lastTimestamp property: Date/time of the last event. + * + * @return the lastTimestamp value. + */ + public String lastTimestamp() { + return this.lastTimestamp; + } + + /** + * Set the lastTimestamp property: Date/time of the last event. + * + * @param lastTimestamp the lastTimestamp value to set. + * @return the ContainerEvent object itself. + */ + public ContainerEvent withLastTimestamp(String lastTimestamp) { + this.lastTimestamp = lastTimestamp; + return this; + } + + /** + * Get the message property: The event message. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Set the message property: The event message. + * + * @param message the message value to set. + * @return the ContainerEvent object itself. + */ + public ContainerEvent withMessage(String message) { + this.message = message; + return this; + } + + /** + * Get the type property: The event type. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: The event type. + * + * @param type the type value to set. + * @return the ContainerEvent object itself. + */ + public ContainerEvent withType(String type) { + this.type = type; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ContainerInstanceView.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ContainerInstanceView.java new file mode 100644 index 0000000000000..5dd2ab92b243f --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ContainerInstanceView.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Runtime information of a container instance. */ +@Fluent +public final class ContainerInstanceView { + /* + * The number of times the container has been restarted. + */ + @JsonProperty(value = "restartCount") + private Integer restartCount; + + /* + * Current container instance state. + */ + @JsonProperty(value = "currentState") + private ContainerState currentState; + + /* + * Previous container instance state. + */ + @JsonProperty(value = "previousState") + private ContainerState previousState; + + /* + * The events of this container instance. + */ + @JsonProperty(value = "events") + private List events; + + /** + * Get the restartCount property: The number of times the container has been restarted. + * + * @return the restartCount value. + */ + public Integer restartCount() { + return this.restartCount; + } + + /** + * Set the restartCount property: The number of times the container has been restarted. + * + * @param restartCount the restartCount value to set. + * @return the ContainerInstanceView object itself. + */ + public ContainerInstanceView withRestartCount(Integer restartCount) { + this.restartCount = restartCount; + return this; + } + + /** + * Get the currentState property: Current container instance state. + * + * @return the currentState value. + */ + public ContainerState currentState() { + return this.currentState; + } + + /** + * Set the currentState property: Current container instance state. + * + * @param currentState the currentState value to set. + * @return the ContainerInstanceView object itself. + */ + public ContainerInstanceView withCurrentState(ContainerState currentState) { + this.currentState = currentState; + return this; + } + + /** + * Get the previousState property: Previous container instance state. + * + * @return the previousState value. + */ + public ContainerState previousState() { + return this.previousState; + } + + /** + * Set the previousState property: Previous container instance state. + * + * @param previousState the previousState value to set. + * @return the ContainerInstanceView object itself. + */ + public ContainerInstanceView withPreviousState(ContainerState previousState) { + this.previousState = previousState; + return this; + } + + /** + * Get the events property: The events of this container instance. + * + * @return the events value. + */ + public List events() { + return this.events; + } + + /** + * Set the events property: The events of this container instance. + * + * @param events the events value to set. + * @return the ContainerInstanceView object itself. + */ + public ContainerInstanceView withEvents(List events) { + this.events = events; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (currentState() != null) { + currentState().validate(); + } + if (previousState() != null) { + previousState().validate(); + } + if (events() != null) { + events().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ContainerLabel.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ContainerLabel.java new file mode 100644 index 0000000000000..2436780887dd2 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ContainerLabel.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes a container label. */ +@Fluent +public final class ContainerLabel { + /* + * The name of the container label. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * The value of the container label. + */ + @JsonProperty(value = "value", required = true) + private String value; + + /** + * Get the name property: The name of the container label. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the container label. + * + * @param name the name value to set. + * @return the ContainerLabel object itself. + */ + public ContainerLabel withName(String name) { + this.name = name; + return this; + } + + /** + * Get the value property: The value of the container label. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Set the value property: The value of the container label. + * + * @param value the value value to set. + * @return the ContainerLabel object itself. + */ + public ContainerLabel withValue(String value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property name in model ContainerLabel")); + } + if (value() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property value in model ContainerLabel")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ContainerLabel.class); +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ContainerLogs.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ContainerLogs.java new file mode 100644 index 0000000000000..838d5b57ba8f2 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ContainerLogs.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.models; + +import com.azure.resourcemanager.servicefabricmesh.fluent.models.ContainerLogsInner; + +/** An immutable client-side representation of ContainerLogs. */ +public interface ContainerLogs { + /** + * Gets the content property: Container logs. + * + * @return the content value. + */ + String content(); + + /** + * Gets the inner com.azure.resourcemanager.servicefabricmesh.fluent.models.ContainerLogsInner object. + * + * @return the inner object. + */ + ContainerLogsInner innerModel(); +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ContainerState.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ContainerState.java new file mode 100644 index 0000000000000..e2547982c373c --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ContainerState.java @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** The container state. */ +@Fluent +public final class ContainerState { + /* + * The state of this container + */ + @JsonProperty(value = "state") + private String state; + + /* + * Date/time when the container state started. + */ + @JsonProperty(value = "startTime") + private OffsetDateTime startTime; + + /* + * The container exit code. + */ + @JsonProperty(value = "exitCode") + private String exitCode; + + /* + * Date/time when the container state finished. + */ + @JsonProperty(value = "finishTime") + private OffsetDateTime finishTime; + + /* + * Human-readable status of this state. + */ + @JsonProperty(value = "detailStatus") + private String detailStatus; + + /** + * Get the state property: The state of this container. + * + * @return the state value. + */ + public String state() { + return this.state; + } + + /** + * Set the state property: The state of this container. + * + * @param state the state value to set. + * @return the ContainerState object itself. + */ + public ContainerState withState(String state) { + this.state = state; + return this; + } + + /** + * Get the startTime property: Date/time when the container state started. + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Set the startTime property: Date/time when the container state started. + * + * @param startTime the startTime value to set. + * @return the ContainerState object itself. + */ + public ContainerState withStartTime(OffsetDateTime startTime) { + this.startTime = startTime; + return this; + } + + /** + * Get the exitCode property: The container exit code. + * + * @return the exitCode value. + */ + public String exitCode() { + return this.exitCode; + } + + /** + * Set the exitCode property: The container exit code. + * + * @param exitCode the exitCode value to set. + * @return the ContainerState object itself. + */ + public ContainerState withExitCode(String exitCode) { + this.exitCode = exitCode; + return this; + } + + /** + * Get the finishTime property: Date/time when the container state finished. + * + * @return the finishTime value. + */ + public OffsetDateTime finishTime() { + return this.finishTime; + } + + /** + * Set the finishTime property: Date/time when the container state finished. + * + * @param finishTime the finishTime value to set. + * @return the ContainerState object itself. + */ + public ContainerState withFinishTime(OffsetDateTime finishTime) { + this.finishTime = finishTime; + return this; + } + + /** + * Get the detailStatus property: Human-readable status of this state. + * + * @return the detailStatus value. + */ + public String detailStatus() { + return this.detailStatus; + } + + /** + * Set the detailStatus property: Human-readable status of this state. + * + * @param detailStatus the detailStatus value to set. + * @return the ContainerState object itself. + */ + public ContainerState withDetailStatus(String detailStatus) { + this.detailStatus = detailStatus; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/DiagnosticsDescription.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/DiagnosticsDescription.java new file mode 100644 index 0000000000000..5ca8949bca99a --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/DiagnosticsDescription.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.servicefabricmesh.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Describes the diagnostics options available. */ +@Fluent +public final class DiagnosticsDescription { + /* + * List of supported sinks that can be referenced. + */ + @JsonProperty(value = "sinks") + private List sinks; + + /* + * Status of whether or not sinks are enabled. + */ + @JsonProperty(value = "enabled") + private Boolean enabled; + + /* + * The sinks to be used if diagnostics is enabled. Sink choices can be + * overridden at the service and code package level. + */ + @JsonProperty(value = "defaultSinkRefs") + private List defaultSinkRefs; + + /** + * Get the sinks property: List of supported sinks that can be referenced. + * + * @return the sinks value. + */ + public List sinks() { + return this.sinks; + } + + /** + * Set the sinks property: List of supported sinks that can be referenced. + * + * @param sinks the sinks value to set. + * @return the DiagnosticsDescription object itself. + */ + public DiagnosticsDescription withSinks(List sinks) { + this.sinks = sinks; + return this; + } + + /** + * Get the enabled property: Status of whether or not sinks are enabled. + * + * @return the enabled value. + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set the enabled property: Status of whether or not sinks are enabled. + * + * @param enabled the enabled value to set. + * @return the DiagnosticsDescription object itself. + */ + public DiagnosticsDescription withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the defaultSinkRefs property: The sinks to be used if diagnostics is enabled. Sink choices can be overridden + * at the service and code package level. + * + * @return the defaultSinkRefs value. + */ + public List defaultSinkRefs() { + return this.defaultSinkRefs; + } + + /** + * Set the defaultSinkRefs property: The sinks to be used if diagnostics is enabled. Sink choices can be overridden + * at the service and code package level. + * + * @param defaultSinkRefs the defaultSinkRefs value to set. + * @return the DiagnosticsDescription object itself. + */ + public DiagnosticsDescription withDefaultSinkRefs(List defaultSinkRefs) { + this.defaultSinkRefs = defaultSinkRefs; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sinks() != null) { + sinks().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/DiagnosticsRef.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/DiagnosticsRef.java new file mode 100644 index 0000000000000..235623630a6de --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/DiagnosticsRef.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.servicefabricmesh.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Reference to sinks in DiagnosticsDescription. */ +@Fluent +public final class DiagnosticsRef { + /* + * Status of whether or not sinks are enabled. + */ + @JsonProperty(value = "enabled") + private Boolean enabled; + + /* + * List of sinks to be used if enabled. References the list of sinks in + * DiagnosticsDescription. + */ + @JsonProperty(value = "sinkRefs") + private List sinkRefs; + + /** + * Get the enabled property: Status of whether or not sinks are enabled. + * + * @return the enabled value. + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set the enabled property: Status of whether or not sinks are enabled. + * + * @param enabled the enabled value to set. + * @return the DiagnosticsRef object itself. + */ + public DiagnosticsRef withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the sinkRefs property: List of sinks to be used if enabled. References the list of sinks in + * DiagnosticsDescription. + * + * @return the sinkRefs value. + */ + public List sinkRefs() { + return this.sinkRefs; + } + + /** + * Set the sinkRefs property: List of sinks to be used if enabled. References the list of sinks in + * DiagnosticsDescription. + * + * @param sinkRefs the sinkRefs value to set. + * @return the DiagnosticsRef object itself. + */ + public DiagnosticsRef withSinkRefs(List sinkRefs) { + this.sinkRefs = sinkRefs; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/DiagnosticsSinkKind.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/DiagnosticsSinkKind.java new file mode 100644 index 0000000000000..c8ee826ccca21 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/DiagnosticsSinkKind.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for DiagnosticsSinkKind. */ +public final class DiagnosticsSinkKind extends ExpandableStringEnum { + /** Static value Invalid for DiagnosticsSinkKind. */ + public static final DiagnosticsSinkKind INVALID = fromString("Invalid"); + + /** Static value AzureInternalMonitoringPipeline for DiagnosticsSinkKind. */ + public static final DiagnosticsSinkKind AZURE_INTERNAL_MONITORING_PIPELINE = + fromString("AzureInternalMonitoringPipeline"); + + /** + * Creates or finds a DiagnosticsSinkKind from its string representation. + * + * @param name a name to look for. + * @return the corresponding DiagnosticsSinkKind. + */ + @JsonCreator + public static DiagnosticsSinkKind fromString(String name) { + return fromString(name, DiagnosticsSinkKind.class); + } + + /** + * Gets known DiagnosticsSinkKind values. + * + * @return known DiagnosticsSinkKind values. + */ + public static Collection values() { + return values(DiagnosticsSinkKind.class); + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/DiagnosticsSinkProperties.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/DiagnosticsSinkProperties.java new file mode 100644 index 0000000000000..be5280178c965 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/DiagnosticsSinkProperties.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** Properties of a DiagnosticsSink. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "kind", + defaultImpl = DiagnosticsSinkProperties.class) +@JsonTypeName("DiagnosticsSinkProperties") +@JsonSubTypes({ + @JsonSubTypes.Type( + name = "AzureInternalMonitoringPipeline", + value = AzureInternalMonitoringPipelineSinkDescription.class) +}) +@Fluent +public class DiagnosticsSinkProperties { + /* + * Name of the sink. This value is referenced by + * DiagnosticsReferenceDescription + */ + @JsonProperty(value = "name") + private String name; + + /* + * A description of the sink. + */ + @JsonProperty(value = "description") + private String description; + + /** + * Get the name property: Name of the sink. This value is referenced by DiagnosticsReferenceDescription. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name of the sink. This value is referenced by DiagnosticsReferenceDescription. + * + * @param name the name value to set. + * @return the DiagnosticsSinkProperties object itself. + */ + public DiagnosticsSinkProperties withName(String name) { + this.name = name; + return this; + } + + /** + * Get the description property: A description of the sink. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: A description of the sink. + * + * @param description the description value to set. + * @return the DiagnosticsSinkProperties object itself. + */ + public DiagnosticsSinkProperties withDescription(String description) { + this.description = description; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/EndpointProperties.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/EndpointProperties.java new file mode 100644 index 0000000000000..21cd067103090 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/EndpointProperties.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes a container endpoint. */ +@Fluent +public final class EndpointProperties { + /* + * The name of the endpoint. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * Port used by the container. + */ + @JsonProperty(value = "port") + private Integer port; + + /** + * Get the name property: The name of the endpoint. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the endpoint. + * + * @param name the name value to set. + * @return the EndpointProperties object itself. + */ + public EndpointProperties withName(String name) { + this.name = name; + return this; + } + + /** + * Get the port property: Port used by the container. + * + * @return the port value. + */ + public Integer port() { + return this.port; + } + + /** + * Set the port property: Port used by the container. + * + * @param port the port value to set. + * @return the EndpointProperties object itself. + */ + public EndpointProperties withPort(Integer port) { + this.port = port; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property name in model EndpointProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(EndpointProperties.class); +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/EndpointRef.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/EndpointRef.java new file mode 100644 index 0000000000000..798f0c49bea5d --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/EndpointRef.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.servicefabricmesh.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes a reference to a service endpoint. */ +@Fluent +public final class EndpointRef { + /* + * Name of the endpoint. + */ + @JsonProperty(value = "name") + private String name; + + /** + * Get the name property: Name of the endpoint. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name of the endpoint. + * + * @param name the name value to set. + * @return the EndpointRef object itself. + */ + public EndpointRef withName(String name) { + this.name = name; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/EnvironmentVariable.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/EnvironmentVariable.java new file mode 100644 index 0000000000000..7a3f6717e57bc --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/EnvironmentVariable.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes an environment variable for the container. */ +@Fluent +public final class EnvironmentVariable { + /* + * The name of the environment variable. + */ + @JsonProperty(value = "name") + private String name; + + /* + * The value of the environment variable. + */ + @JsonProperty(value = "value") + private String value; + + /** + * Get the name property: The name of the environment variable. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the environment variable. + * + * @param name the name value to set. + * @return the EnvironmentVariable object itself. + */ + public EnvironmentVariable withName(String name) { + this.name = name; + return this; + } + + /** + * Get the value property: The value of the environment variable. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Set the value property: The value of the environment variable. + * + * @param value the value value to set. + * @return the EnvironmentVariable object itself. + */ + public EnvironmentVariable 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/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ErrorErrorModel.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ErrorErrorModel.java new file mode 100644 index 0000000000000..897d196e46f8c --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ErrorErrorModel.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.exception.ManagementError; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The error details. */ +@Immutable +public final class ErrorErrorModel extends ManagementError { + /* + * The innerError property. + */ + @JsonProperty(value = "innerError", access = JsonProperty.Access.WRITE_ONLY) + private String innerError; + + /** + * Get the innerError property: The innerError property. + * + * @return the innerError value. + */ + public String getInnerError() { + return this.innerError; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ErrorErrorModelException.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ErrorErrorModelException.java new file mode 100644 index 0000000000000..cbf4a74692030 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ErrorErrorModelException.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.servicefabricmesh.models; + +import com.azure.core.http.HttpResponse; +import com.azure.core.management.exception.ManagementException; + +/** Exception thrown for an invalid response with ErrorErrorModel information. */ +public final class ErrorErrorModelException extends ManagementException { + /** + * Initializes a new instance of the ErrorErrorModelException class. + * + * @param message the exception message or the response content if a message is not available. + * @param response the HTTP response. + */ + public ErrorErrorModelException(String message, HttpResponse response) { + super(message, response); + } + + /** + * Initializes a new instance of the ErrorErrorModelException class. + * + * @param message the exception message or the response content if a message is not available. + * @param response the HTTP response. + * @param value the deserialized response value. + */ + public ErrorErrorModelException(String message, HttpResponse response, ErrorErrorModel value) { + super(message, response, value); + } + + @Override + public ErrorErrorModel getValue() { + return (ErrorErrorModel) super.getValue(); + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/GatewayDestination.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/GatewayDestination.java new file mode 100644 index 0000000000000..cd7cfb12fdbf7 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/GatewayDestination.java @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes destination endpoint for routing traffic. */ +@Fluent +public final class GatewayDestination { + /* + * Name of the service fabric Mesh application. + */ + @JsonProperty(value = "applicationName", required = true) + private String applicationName; + + /* + * service that contains the endpoint. + */ + @JsonProperty(value = "serviceName", required = true) + private String serviceName; + + /* + * name of the endpoint in the service. + */ + @JsonProperty(value = "endpointName", required = true) + private String endpointName; + + /** + * Get the applicationName property: Name of the service fabric Mesh application. + * + * @return the applicationName value. + */ + public String applicationName() { + return this.applicationName; + } + + /** + * Set the applicationName property: Name of the service fabric Mesh application. + * + * @param applicationName the applicationName value to set. + * @return the GatewayDestination object itself. + */ + public GatewayDestination withApplicationName(String applicationName) { + this.applicationName = applicationName; + return this; + } + + /** + * Get the serviceName property: service that contains the endpoint. + * + * @return the serviceName value. + */ + public String serviceName() { + return this.serviceName; + } + + /** + * Set the serviceName property: service that contains the endpoint. + * + * @param serviceName the serviceName value to set. + * @return the GatewayDestination object itself. + */ + public GatewayDestination withServiceName(String serviceName) { + this.serviceName = serviceName; + return this; + } + + /** + * Get the endpointName property: name of the endpoint in the service. + * + * @return the endpointName value. + */ + public String endpointName() { + return this.endpointName; + } + + /** + * Set the endpointName property: name of the endpoint in the service. + * + * @param endpointName the endpointName value to set. + * @return the GatewayDestination object itself. + */ + public GatewayDestination withEndpointName(String endpointName) { + this.endpointName = endpointName; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (applicationName() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property applicationName in model GatewayDestination")); + } + if (serviceName() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property serviceName in model GatewayDestination")); + } + if (endpointName() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property endpointName in model GatewayDestination")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(GatewayDestination.class); +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/GatewayProperties.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/GatewayProperties.java new file mode 100644 index 0000000000000..934719b633449 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/GatewayProperties.java @@ -0,0 +1,222 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Describes properties of a gateway resource. */ +@Fluent +public class GatewayProperties { + /* + * User readable description of the gateway. + */ + @JsonProperty(value = "description") + private String description; + + /* + * Network the gateway should listen on for requests. + */ + @JsonProperty(value = "sourceNetwork", required = true) + private NetworkRef sourceNetwork; + + /* + * Network that the Application is using. + */ + @JsonProperty(value = "destinationNetwork", required = true) + private NetworkRef destinationNetwork; + + /* + * Configuration for tcp connectivity for this gateway. + */ + @JsonProperty(value = "tcp") + private List tcp; + + /* + * Configuration for http connectivity for this gateway. + */ + @JsonProperty(value = "http") + private List http; + + /* + * Status of the resource. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private ResourceStatus status; + + /* + * Gives additional information about the current status of the gateway. + */ + @JsonProperty(value = "statusDetails", access = JsonProperty.Access.WRITE_ONLY) + private String statusDetails; + + /* + * IP address of the gateway. This is populated in the response and is + * ignored for incoming requests. + */ + @JsonProperty(value = "ipAddress", access = JsonProperty.Access.WRITE_ONLY) + private String ipAddress; + + /** + * Get the description property: User readable description of the gateway. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: User readable description of the gateway. + * + * @param description the description value to set. + * @return the GatewayProperties object itself. + */ + public GatewayProperties withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the sourceNetwork property: Network the gateway should listen on for requests. + * + * @return the sourceNetwork value. + */ + public NetworkRef sourceNetwork() { + return this.sourceNetwork; + } + + /** + * Set the sourceNetwork property: Network the gateway should listen on for requests. + * + * @param sourceNetwork the sourceNetwork value to set. + * @return the GatewayProperties object itself. + */ + public GatewayProperties withSourceNetwork(NetworkRef sourceNetwork) { + this.sourceNetwork = sourceNetwork; + return this; + } + + /** + * Get the destinationNetwork property: Network that the Application is using. + * + * @return the destinationNetwork value. + */ + public NetworkRef destinationNetwork() { + return this.destinationNetwork; + } + + /** + * Set the destinationNetwork property: Network that the Application is using. + * + * @param destinationNetwork the destinationNetwork value to set. + * @return the GatewayProperties object itself. + */ + public GatewayProperties withDestinationNetwork(NetworkRef destinationNetwork) { + this.destinationNetwork = destinationNetwork; + return this; + } + + /** + * Get the tcp property: Configuration for tcp connectivity for this gateway. + * + * @return the tcp value. + */ + public List tcp() { + return this.tcp; + } + + /** + * Set the tcp property: Configuration for tcp connectivity for this gateway. + * + * @param tcp the tcp value to set. + * @return the GatewayProperties object itself. + */ + public GatewayProperties withTcp(List tcp) { + this.tcp = tcp; + return this; + } + + /** + * Get the http property: Configuration for http connectivity for this gateway. + * + * @return the http value. + */ + public List http() { + return this.http; + } + + /** + * Set the http property: Configuration for http connectivity for this gateway. + * + * @param http the http value to set. + * @return the GatewayProperties object itself. + */ + public GatewayProperties withHttp(List http) { + this.http = http; + return this; + } + + /** + * Get the status property: Status of the resource. + * + * @return the status value. + */ + public ResourceStatus status() { + return this.status; + } + + /** + * Get the statusDetails property: Gives additional information about the current status of the gateway. + * + * @return the statusDetails value. + */ + public String statusDetails() { + return this.statusDetails; + } + + /** + * Get the ipAddress property: IP address of the gateway. This is populated in the response and is ignored for + * incoming requests. + * + * @return the ipAddress value. + */ + public String ipAddress() { + return this.ipAddress; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sourceNetwork() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property sourceNetwork in model GatewayProperties")); + } else { + sourceNetwork().validate(); + } + if (destinationNetwork() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property destinationNetwork in model GatewayProperties")); + } else { + destinationNetwork().validate(); + } + if (tcp() != null) { + tcp().forEach(e -> e.validate()); + } + if (http() != null) { + http().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(GatewayProperties.class); +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/GatewayResourceDescription.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/GatewayResourceDescription.java new file mode 100644 index 0000000000000..b7810d0fa3ad4 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/GatewayResourceDescription.java @@ -0,0 +1,276 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.servicefabricmesh.fluent.models.GatewayResourceDescriptionInner; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of GatewayResourceDescription. */ +public interface GatewayResourceDescription { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the description property: User readable description of the gateway. + * + * @return the description value. + */ + String description(); + + /** + * Gets the sourceNetwork property: Network the gateway should listen on for requests. + * + * @return the sourceNetwork value. + */ + NetworkRef sourceNetwork(); + + /** + * Gets the destinationNetwork property: Network that the Application is using. + * + * @return the destinationNetwork value. + */ + NetworkRef destinationNetwork(); + + /** + * Gets the tcp property: Configuration for tcp connectivity for this gateway. + * + * @return the tcp value. + */ + List tcp(); + + /** + * Gets the http property: Configuration for http connectivity for this gateway. + * + * @return the http value. + */ + List http(); + + /** + * Gets the status property: Status of the resource. + * + * @return the status value. + */ + ResourceStatus status(); + + /** + * Gets the statusDetails property: Gives additional information about the current status of the gateway. + * + * @return the statusDetails value. + */ + String statusDetails(); + + /** + * Gets the ipAddress property: IP address of the gateway. This is populated in the response and is ignored for + * incoming requests. + * + * @return the ipAddress value. + */ + String ipAddress(); + + /** + * Gets the provisioningState property: State of the resource. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.servicefabricmesh.fluent.models.GatewayResourceDescriptionInner object. + * + * @return the inner object. + */ + GatewayResourceDescriptionInner innerModel(); + + /** The entirety of the GatewayResourceDescription definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithSourceNetwork, + DefinitionStages.WithDestinationNetwork, + DefinitionStages.WithCreate { + } + /** The GatewayResourceDescription definition stages. */ + interface DefinitionStages { + /** The first stage of the GatewayResourceDescription definition. */ + interface Blank extends WithLocation { + } + /** The stage of the GatewayResourceDescription definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + /** The stage of the GatewayResourceDescription definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName Azure resource group name. + * @return the next definition stage. + */ + WithSourceNetwork withExistingResourceGroup(String resourceGroupName); + } + /** The stage of the GatewayResourceDescription definition allowing to specify sourceNetwork. */ + interface WithSourceNetwork { + /** + * Specifies the sourceNetwork property: Network the gateway should listen on for requests.. + * + * @param sourceNetwork Network the gateway should listen on for requests. + * @return the next definition stage. + */ + WithDestinationNetwork withSourceNetwork(NetworkRef sourceNetwork); + } + /** The stage of the GatewayResourceDescription definition allowing to specify destinationNetwork. */ + interface WithDestinationNetwork { + /** + * Specifies the destinationNetwork property: Network that the Application is using.. + * + * @param destinationNetwork Network that the Application is using. + * @return the next definition stage. + */ + WithCreate withDestinationNetwork(NetworkRef destinationNetwork); + } + /** + * The stage of the GatewayResourceDescription definition which contains all the minimum required properties for + * the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, + DefinitionStages.WithDescription, + DefinitionStages.WithTcp, + DefinitionStages.WithHttp { + /** + * Executes the create request. + * + * @return the created resource. + */ + GatewayResourceDescription create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + GatewayResourceDescription create(Context context); + } + /** The stage of the GatewayResourceDescription definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the GatewayResourceDescription definition allowing to specify description. */ + interface WithDescription { + /** + * Specifies the description property: User readable description of the gateway.. + * + * @param description User readable description of the gateway. + * @return the next definition stage. + */ + WithCreate withDescription(String description); + } + /** The stage of the GatewayResourceDescription definition allowing to specify tcp. */ + interface WithTcp { + /** + * Specifies the tcp property: Configuration for tcp connectivity for this gateway.. + * + * @param tcp Configuration for tcp connectivity for this gateway. + * @return the next definition stage. + */ + WithCreate withTcp(List tcp); + } + /** The stage of the GatewayResourceDescription definition allowing to specify http. */ + interface WithHttp { + /** + * Specifies the http property: Configuration for http connectivity for this gateway.. + * + * @param http Configuration for http connectivity for this gateway. + * @return the next definition stage. + */ + WithCreate withHttp(List http); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + GatewayResourceDescription refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + GatewayResourceDescription refresh(Context context); +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/GatewayResourceDescriptionList.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/GatewayResourceDescriptionList.java new file mode 100644 index 0000000000000..c9b2b2b669ebc --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/GatewayResourceDescriptionList.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.servicefabricmesh.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.servicefabricmesh.fluent.models.GatewayResourceDescriptionInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A pageable list of gateway resources. */ +@Fluent +public final class GatewayResourceDescriptionList { + /* + * One page of the list. + */ + @JsonProperty(value = "value") + private List value; + + /* + * URI to fetch the next page of the list. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: One page of the list. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: One page of the list. + * + * @param value the value value to set. + * @return the GatewayResourceDescriptionList object itself. + */ + public GatewayResourceDescriptionList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: URI to fetch the next page of the list. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: URI to fetch the next page of the list. + * + * @param nextLink the nextLink value to set. + * @return the GatewayResourceDescriptionList object itself. + */ + public GatewayResourceDescriptionList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/Gateways.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/Gateways.java new file mode 100644 index 0000000000000..49dd9fdc368e6 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/Gateways.java @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.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 Gateways. */ +public interface Gateways { + /** + * Gets the information about the gateway resource with the given name. The information include the description and + * other properties of the gateway. + * + * @param resourceGroupName Azure resource group name. + * @param gatewayResourceName The identity of the gateway. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about the gateway resource with the given name. + */ + GatewayResourceDescription getByResourceGroup(String resourceGroupName, String gatewayResourceName); + + /** + * Gets the information about the gateway resource with the given name. The information include the description and + * other properties of the gateway. + * + * @param resourceGroupName Azure resource group name. + * @param gatewayResourceName The identity of the gateway. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about the gateway resource with the given name along with {@link Response}. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String gatewayResourceName, Context context); + + /** + * Deletes the gateway resource identified by the name. + * + * @param resourceGroupName Azure resource group name. + * @param gatewayResourceName The identity of the gateway. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String gatewayResourceName); + + /** + * Deletes the gateway resource identified by the name. + * + * @param resourceGroupName Azure resource group name. + * @param gatewayResourceName The identity of the gateway. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException 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 gatewayResourceName, Context context); + + /** + * Gets the information about all gateway resources in a given resource group. The information include the + * description and other properties of the Gateway. + * + * @param resourceGroupName Azure resource group name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all gateway resources in a given resource group as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Gets the information about all gateway resources in a given resource group. The information include the + * description and other properties of the Gateway. + * + * @param resourceGroupName Azure resource group name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all gateway resources in a given resource group as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Gets the information about all gateway resources in a given resource group. The information include the + * description and other properties of the gateway. + * + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all gateway resources in a given resource group as paginated response with {@link + * PagedIterable}. + */ + PagedIterable list(); + + /** + * Gets the information about all gateway resources in a given resource group. The information include the + * description and other properties of the gateway. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all gateway resources in a given resource group as paginated response with {@link + * PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Gets the information about the gateway resource with the given name. The information include the description and + * other properties of the gateway. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about the gateway resource with the given name along with {@link Response}. + */ + GatewayResourceDescription getById(String id); + + /** + * Gets the information about the gateway resource with the given name. The information include the description and + * other properties of the gateway. + * + * @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.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about the gateway resource with the given name along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes the gateway resource identified by the name. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes the gateway resource identified by the name. + * + * @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.resourcemanager.servicefabricmesh.models.ErrorErrorModelException 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 GatewayResourceDescription resource. + * + * @param name resource name. + * @return the first stage of the new GatewayResourceDescription definition. + */ + GatewayResourceDescription.DefinitionStages.Blank define(String name); +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/HeaderMatchType.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/HeaderMatchType.java new file mode 100644 index 0000000000000..03cbd50c31253 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/HeaderMatchType.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for HeaderMatchType. */ +public final class HeaderMatchType extends ExpandableStringEnum { + /** Static value exact for HeaderMatchType. */ + public static final HeaderMatchType EXACT = fromString("exact"); + + /** + * Creates or finds a HeaderMatchType from its string representation. + * + * @param name a name to look for. + * @return the corresponding HeaderMatchType. + */ + @JsonCreator + public static HeaderMatchType fromString(String name) { + return fromString(name, HeaderMatchType.class); + } + + /** + * Gets known HeaderMatchType values. + * + * @return known HeaderMatchType values. + */ + public static Collection values() { + return values(HeaderMatchType.class); + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/HealthState.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/HealthState.java new file mode 100644 index 0000000000000..f54db65c1283f --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/HealthState.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.servicefabricmesh.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for HealthState. */ +public final class HealthState extends ExpandableStringEnum { + /** Static value Invalid for HealthState. */ + public static final HealthState INVALID = fromString("Invalid"); + + /** Static value Ok for HealthState. */ + public static final HealthState OK = fromString("Ok"); + + /** Static value Warning for HealthState. */ + public static final HealthState WARNING = fromString("Warning"); + + /** Static value Error for HealthState. */ + public static final HealthState ERROR = fromString("Error"); + + /** Static value Unknown for HealthState. */ + public static final HealthState UNKNOWN = fromString("Unknown"); + + /** + * Creates or finds a HealthState from its string representation. + * + * @param name a name to look for. + * @return the corresponding HealthState. + */ + @JsonCreator + public static HealthState fromString(String name) { + return fromString(name, HealthState.class); + } + + /** + * Gets known HealthState values. + * + * @return known HealthState values. + */ + public static Collection values() { + return values(HealthState.class); + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/HttpConfig.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/HttpConfig.java new file mode 100644 index 0000000000000..8dbda0c5a19d9 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/HttpConfig.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.servicefabricmesh.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Describes the http configuration for external connectivity for this network. */ +@Fluent +public final class HttpConfig { + /* + * http gateway config name. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * Specifies the port at which the service endpoint below needs to be + * exposed. + */ + @JsonProperty(value = "port", required = true) + private int port; + + /* + * description for routing. + */ + @JsonProperty(value = "hosts", required = true) + private List hosts; + + /** + * Get the name property: http gateway config name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: http gateway config name. + * + * @param name the name value to set. + * @return the HttpConfig object itself. + */ + public HttpConfig withName(String name) { + this.name = name; + return this; + } + + /** + * Get the port property: Specifies the port at which the service endpoint below needs to be exposed. + * + * @return the port value. + */ + public int port() { + return this.port; + } + + /** + * Set the port property: Specifies the port at which the service endpoint below needs to be exposed. + * + * @param port the port value to set. + * @return the HttpConfig object itself. + */ + public HttpConfig withPort(int port) { + this.port = port; + return this; + } + + /** + * Get the hosts property: description for routing. + * + * @return the hosts value. + */ + public List hosts() { + return this.hosts; + } + + /** + * Set the hosts property: description for routing. + * + * @param hosts the hosts value to set. + * @return the HttpConfig object itself. + */ + public HttpConfig withHosts(List hosts) { + this.hosts = hosts; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property name in model HttpConfig")); + } + if (hosts() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property hosts in model HttpConfig")); + } else { + hosts().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(HttpConfig.class); +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/HttpHostConfig.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/HttpHostConfig.java new file mode 100644 index 0000000000000..1acc1e2b2cd7b --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/HttpHostConfig.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Describes the hostname properties for http routing. */ +@Fluent +public final class HttpHostConfig { + /* + * http hostname config name. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * Route information to use for routing. Routes are processed in the order + * they are specified. Specify routes that are more specific before routes + * that can handle general cases. + */ + @JsonProperty(value = "routes", required = true) + private List routes; + + /** + * Get the name property: http hostname config name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: http hostname config name. + * + * @param name the name value to set. + * @return the HttpHostConfig object itself. + */ + public HttpHostConfig withName(String name) { + this.name = name; + return this; + } + + /** + * Get the routes property: Route information to use for routing. Routes are processed in the order they are + * specified. Specify routes that are more specific before routes that can handle general cases. + * + * @return the routes value. + */ + public List routes() { + return this.routes; + } + + /** + * Set the routes property: Route information to use for routing. Routes are processed in the order they are + * specified. Specify routes that are more specific before routes that can handle general cases. + * + * @param routes the routes value to set. + * @return the HttpHostConfig object itself. + */ + public HttpHostConfig withRoutes(List routes) { + this.routes = routes; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property name in model HttpHostConfig")); + } + if (routes() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property routes in model HttpHostConfig")); + } else { + routes().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(HttpHostConfig.class); +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/HttpRouteConfig.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/HttpRouteConfig.java new file mode 100644 index 0000000000000..93503a20248af --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/HttpRouteConfig.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.servicefabricmesh.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes the hostname properties for http routing. */ +@Fluent +public final class HttpRouteConfig { + /* + * http route name. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * Describes a rule for http route matching. + */ + @JsonProperty(value = "match", required = true) + private HttpRouteMatchRule match; + + /* + * Describes destination endpoint for routing traffic. + */ + @JsonProperty(value = "destination", required = true) + private GatewayDestination destination; + + /** + * Get the name property: http route name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: http route name. + * + * @param name the name value to set. + * @return the HttpRouteConfig object itself. + */ + public HttpRouteConfig withName(String name) { + this.name = name; + return this; + } + + /** + * Get the match property: Describes a rule for http route matching. + * + * @return the match value. + */ + public HttpRouteMatchRule match() { + return this.match; + } + + /** + * Set the match property: Describes a rule for http route matching. + * + * @param match the match value to set. + * @return the HttpRouteConfig object itself. + */ + public HttpRouteConfig withMatch(HttpRouteMatchRule match) { + this.match = match; + return this; + } + + /** + * Get the destination property: Describes destination endpoint for routing traffic. + * + * @return the destination value. + */ + public GatewayDestination destination() { + return this.destination; + } + + /** + * Set the destination property: Describes destination endpoint for routing traffic. + * + * @param destination the destination value to set. + * @return the HttpRouteConfig object itself. + */ + public HttpRouteConfig withDestination(GatewayDestination destination) { + this.destination = destination; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property name in model HttpRouteConfig")); + } + if (match() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property match in model HttpRouteConfig")); + } else { + match().validate(); + } + if (destination() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property destination in model HttpRouteConfig")); + } else { + destination().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(HttpRouteConfig.class); +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/HttpRouteMatchHeader.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/HttpRouteMatchHeader.java new file mode 100644 index 0000000000000..da91a75fe021d --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/HttpRouteMatchHeader.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes header information for http route matching. */ +@Fluent +public final class HttpRouteMatchHeader { + /* + * Name of header to match in request. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * Value of header to match in request. + */ + @JsonProperty(value = "value") + private String value; + + /* + * how to match header value + */ + @JsonProperty(value = "type") + private HeaderMatchType type; + + /** + * Get the name property: Name of header to match in request. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name of header to match in request. + * + * @param name the name value to set. + * @return the HttpRouteMatchHeader object itself. + */ + public HttpRouteMatchHeader withName(String name) { + this.name = name; + return this; + } + + /** + * Get the value property: Value of header to match in request. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Set the value property: Value of header to match in request. + * + * @param value the value value to set. + * @return the HttpRouteMatchHeader object itself. + */ + public HttpRouteMatchHeader withValue(String value) { + this.value = value; + return this; + } + + /** + * Get the type property: how to match header value. + * + * @return the type value. + */ + public HeaderMatchType type() { + return this.type; + } + + /** + * Set the type property: how to match header value. + * + * @param type the type value to set. + * @return the HttpRouteMatchHeader object itself. + */ + public HttpRouteMatchHeader withType(HeaderMatchType type) { + this.type = type; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property name in model HttpRouteMatchHeader")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(HttpRouteMatchHeader.class); +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/HttpRouteMatchPath.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/HttpRouteMatchPath.java new file mode 100644 index 0000000000000..1769edd3bbf75 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/HttpRouteMatchPath.java @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Path to match for routing. */ +@Fluent +public final class HttpRouteMatchPath { + /* + * Uri path to match for request. + */ + @JsonProperty(value = "value", required = true) + private String value; + + /* + * replacement string for matched part of the Uri. + */ + @JsonProperty(value = "rewrite") + private String rewrite; + + /* + * how to match value in the Uri + */ + @JsonProperty(value = "type", required = true) + private PathMatchType type; + + /** + * Get the value property: Uri path to match for request. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Set the value property: Uri path to match for request. + * + * @param value the value value to set. + * @return the HttpRouteMatchPath object itself. + */ + public HttpRouteMatchPath withValue(String value) { + this.value = value; + return this; + } + + /** + * Get the rewrite property: replacement string for matched part of the Uri. + * + * @return the rewrite value. + */ + public String rewrite() { + return this.rewrite; + } + + /** + * Set the rewrite property: replacement string for matched part of the Uri. + * + * @param rewrite the rewrite value to set. + * @return the HttpRouteMatchPath object itself. + */ + public HttpRouteMatchPath withRewrite(String rewrite) { + this.rewrite = rewrite; + return this; + } + + /** + * Get the type property: how to match value in the Uri. + * + * @return the type value. + */ + public PathMatchType type() { + return this.type; + } + + /** + * Set the type property: how to match value in the Uri. + * + * @param type the type value to set. + * @return the HttpRouteMatchPath object itself. + */ + public HttpRouteMatchPath withType(PathMatchType type) { + this.type = type; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property value in model HttpRouteMatchPath")); + } + if (type() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property type in model HttpRouteMatchPath")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(HttpRouteMatchPath.class); +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/HttpRouteMatchRule.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/HttpRouteMatchRule.java new file mode 100644 index 0000000000000..aad936cb8e95a --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/HttpRouteMatchRule.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Describes a rule for http route matching. */ +@Fluent +public final class HttpRouteMatchRule { + /* + * Path to match for routing. + */ + @JsonProperty(value = "path", required = true) + private HttpRouteMatchPath path; + + /* + * headers and their values to match in request. + */ + @JsonProperty(value = "headers") + private List headers; + + /** + * Get the path property: Path to match for routing. + * + * @return the path value. + */ + public HttpRouteMatchPath path() { + return this.path; + } + + /** + * Set the path property: Path to match for routing. + * + * @param path the path value to set. + * @return the HttpRouteMatchRule object itself. + */ + public HttpRouteMatchRule withPath(HttpRouteMatchPath path) { + this.path = path; + return this; + } + + /** + * Get the headers property: headers and their values to match in request. + * + * @return the headers value. + */ + public List headers() { + return this.headers; + } + + /** + * Set the headers property: headers and their values to match in request. + * + * @param headers the headers value to set. + * @return the HttpRouteMatchRule object itself. + */ + public HttpRouteMatchRule withHeaders(List headers) { + this.headers = headers; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (path() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property path in model HttpRouteMatchRule")); + } else { + path().validate(); + } + if (headers() != null) { + headers().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(HttpRouteMatchRule.class); +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ImageRegistryCredential.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ImageRegistryCredential.java new file mode 100644 index 0000000000000..9f2af620afb08 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ImageRegistryCredential.java @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Image registry credential. */ +@Fluent +public final class ImageRegistryCredential { + /* + * Docker image registry server, without protocol such as `http` and + * `https`. + */ + @JsonProperty(value = "server", required = true) + private String server; + + /* + * The username for the private registry. + */ + @JsonProperty(value = "username", required = true) + private String username; + + /* + * The password for the private registry. The password is required for + * create or update operations, however it is not returned in the get or + * list operations. + */ + @JsonProperty(value = "password") + private String password; + + /** + * Get the server property: Docker image registry server, without protocol such as `http` and `https`. + * + * @return the server value. + */ + public String server() { + return this.server; + } + + /** + * Set the server property: Docker image registry server, without protocol such as `http` and `https`. + * + * @param server the server value to set. + * @return the ImageRegistryCredential object itself. + */ + public ImageRegistryCredential withServer(String server) { + this.server = server; + return this; + } + + /** + * Get the username property: The username for the private registry. + * + * @return the username value. + */ + public String username() { + return this.username; + } + + /** + * Set the username property: The username for the private registry. + * + * @param username the username value to set. + * @return the ImageRegistryCredential object itself. + */ + public ImageRegistryCredential withUsername(String username) { + this.username = username; + return this; + } + + /** + * Get the password property: The password for the private registry. The password is required for create or update + * operations, however it is not returned in the get or list operations. + * + * @return the password value. + */ + public String password() { + return this.password; + } + + /** + * Set the password property: The password for the private registry. The password is required for create or update + * operations, however it is not returned in the get or list operations. + * + * @param password the password value to set. + * @return the ImageRegistryCredential object itself. + */ + public ImageRegistryCredential withPassword(String password) { + this.password = password; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (server() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property server in model ImageRegistryCredential")); + } + if (username() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property username in model ImageRegistryCredential")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ImageRegistryCredential.class); +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/InlinedValueSecretResourceProperties.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/InlinedValueSecretResourceProperties.java new file mode 100644 index 0000000000000..c3eff8350656f --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/InlinedValueSecretResourceProperties.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * Describes the properties of a secret resource whose value is provided explicitly as plaintext. The secret resource + * may have multiple values, each being uniquely versioned. The secret value of each version is stored encrypted, and + * delivered as plaintext into the context of applications referencing it. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "kind") +@JsonTypeName("inlinedValue") +@Fluent +public final class InlinedValueSecretResourceProperties extends SecretResourceProperties { + /** {@inheritDoc} */ + @Override + public InlinedValueSecretResourceProperties withDescription(String description) { + super.withDescription(description); + return this; + } + + /** {@inheritDoc} */ + @Override + public InlinedValueSecretResourceProperties withContentType(String contentType) { + super.withContentType(contentType); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/LocalNetworkResourceProperties.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/LocalNetworkResourceProperties.java new file mode 100644 index 0000000000000..e069bb20dd277 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/LocalNetworkResourceProperties.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** Information about a Service Fabric container network local to a single Service Fabric cluster. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "kind") +@JsonTypeName("Local") +@Fluent +public final class LocalNetworkResourceProperties extends NetworkResourceProperties { + /* + * Address space for the local container network. + */ + @JsonProperty(value = "networkAddressPrefix") + private String networkAddressPrefix; + + /** + * Get the networkAddressPrefix property: Address space for the local container network. + * + * @return the networkAddressPrefix value. + */ + public String networkAddressPrefix() { + return this.networkAddressPrefix; + } + + /** + * Set the networkAddressPrefix property: Address space for the local container network. + * + * @param networkAddressPrefix the networkAddressPrefix value to set. + * @return the LocalNetworkResourceProperties object itself. + */ + public LocalNetworkResourceProperties withNetworkAddressPrefix(String networkAddressPrefix) { + this.networkAddressPrefix = networkAddressPrefix; + return this; + } + + /** {@inheritDoc} */ + @Override + public LocalNetworkResourceProperties withDescription(String description) { + super.withDescription(description); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ManagedProxyResource.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ManagedProxyResource.java new file mode 100644 index 0000000000000..fffdaaca22341 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ManagedProxyResource.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.servicefabricmesh.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The resource model definition for Azure Resource Manager proxy resource. It will have everything other than required + * location and tags. This proxy resource is explicitly created or updated by including it in the parent resource. + */ +@Fluent +public class ManagedProxyResource extends ProxyResource { + /* + * The name of the resource + */ + @JsonProperty(value = "name") + private String name; + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the resource. + * + * @param name the name value to set. + * @return the ManagedProxyResource object itself. + */ + public ManagedProxyResource withName(String name) { + this.name = name; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/NetworkKind.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/NetworkKind.java new file mode 100644 index 0000000000000..f4e7c4d9e591c --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/NetworkKind.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for NetworkKind. */ +public final class NetworkKind extends ExpandableStringEnum { + /** Static value Local for NetworkKind. */ + public static final NetworkKind LOCAL = fromString("Local"); + + /** + * Creates or finds a NetworkKind from its string representation. + * + * @param name a name to look for. + * @return the corresponding NetworkKind. + */ + @JsonCreator + public static NetworkKind fromString(String name) { + return fromString(name, NetworkKind.class); + } + + /** + * Gets known NetworkKind values. + * + * @return known NetworkKind values. + */ + public static Collection values() { + return values(NetworkKind.class); + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/NetworkRef.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/NetworkRef.java new file mode 100644 index 0000000000000..d910a44361c1d --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/NetworkRef.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.servicefabricmesh.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Describes a network reference in a service. */ +@Fluent +public final class NetworkRef { + /* + * Name of the network + */ + @JsonProperty(value = "name") + private String name; + + /* + * A list of endpoints that are exposed on this network. + */ + @JsonProperty(value = "endpointRefs") + private List endpointRefs; + + /** + * Get the name property: Name of the network. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name of the network. + * + * @param name the name value to set. + * @return the NetworkRef object itself. + */ + public NetworkRef withName(String name) { + this.name = name; + return this; + } + + /** + * Get the endpointRefs property: A list of endpoints that are exposed on this network. + * + * @return the endpointRefs value. + */ + public List endpointRefs() { + return this.endpointRefs; + } + + /** + * Set the endpointRefs property: A list of endpoints that are exposed on this network. + * + * @param endpointRefs the endpointRefs value to set. + * @return the NetworkRef object itself. + */ + public NetworkRef withEndpointRefs(List endpointRefs) { + this.endpointRefs = endpointRefs; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (endpointRefs() != null) { + endpointRefs().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/NetworkResourceDescription.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/NetworkResourceDescription.java new file mode 100644 index 0000000000000..1bbee8b3a8a87 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/NetworkResourceDescription.java @@ -0,0 +1,173 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.servicefabricmesh.fluent.models.NetworkResourceDescriptionInner; +import java.util.Map; + +/** An immutable client-side representation of NetworkResourceDescription. */ +public interface NetworkResourceDescription { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the properties property: Describes properties of a network resource. + * + * @return the properties value. + */ + NetworkResourceProperties properties(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.servicefabricmesh.fluent.models.NetworkResourceDescriptionInner object. + * + * @return the inner object. + */ + NetworkResourceDescriptionInner innerModel(); + + /** The entirety of the NetworkResourceDescription definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithProperties, + DefinitionStages.WithCreate { + } + /** The NetworkResourceDescription definition stages. */ + interface DefinitionStages { + /** The first stage of the NetworkResourceDescription definition. */ + interface Blank extends WithLocation { + } + /** The stage of the NetworkResourceDescription definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + /** The stage of the NetworkResourceDescription definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName Azure resource group name. + * @return the next definition stage. + */ + WithProperties withExistingResourceGroup(String resourceGroupName); + } + /** The stage of the NetworkResourceDescription definition allowing to specify properties. */ + interface WithProperties { + /** + * Specifies the properties property: Describes properties of a network resource.. + * + * @param properties Describes properties of a network resource. + * @return the next definition stage. + */ + WithCreate withProperties(NetworkResourceProperties properties); + } + /** + * The stage of the NetworkResourceDescription definition which contains all the minimum required properties for + * the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithTags { + /** + * Executes the create request. + * + * @return the created resource. + */ + NetworkResourceDescription create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + NetworkResourceDescription create(Context context); + } + /** The stage of the NetworkResourceDescription definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + NetworkResourceDescription refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + NetworkResourceDescription refresh(Context context); +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/NetworkResourceDescriptionList.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/NetworkResourceDescriptionList.java new file mode 100644 index 0000000000000..efea6f30e97ad --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/NetworkResourceDescriptionList.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.servicefabricmesh.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.servicefabricmesh.fluent.models.NetworkResourceDescriptionInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A pageable list of network resources. */ +@Fluent +public final class NetworkResourceDescriptionList { + /* + * One page of the list. + */ + @JsonProperty(value = "value") + private List value; + + /* + * URI to fetch the next page of the list. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: One page of the list. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: One page of the list. + * + * @param value the value value to set. + * @return the NetworkResourceDescriptionList object itself. + */ + public NetworkResourceDescriptionList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: URI to fetch the next page of the list. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: URI to fetch the next page of the list. + * + * @param nextLink the nextLink value to set. + * @return the NetworkResourceDescriptionList object itself. + */ + public NetworkResourceDescriptionList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/NetworkResourceProperties.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/NetworkResourceProperties.java new file mode 100644 index 0000000000000..4d03c06d366c5 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/NetworkResourceProperties.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.servicefabricmesh.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** Describes properties of a network resource. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "kind", + defaultImpl = NetworkResourceProperties.class) +@JsonTypeName("NetworkResourceProperties") +@JsonSubTypes({@JsonSubTypes.Type(name = "Local", value = LocalNetworkResourceProperties.class)}) +@Fluent +public class NetworkResourceProperties extends NetworkResourcePropertiesBase { + /* + * User readable description of the network. + */ + @JsonProperty(value = "description") + private String description; + + /* + * Status of the network. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private ResourceStatus status; + + /* + * Gives additional information about the current status of the network. + */ + @JsonProperty(value = "statusDetails", access = JsonProperty.Access.WRITE_ONLY) + private String statusDetails; + + /** + * Get the description property: User readable description of the network. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: User readable description of the network. + * + * @param description the description value to set. + * @return the NetworkResourceProperties object itself. + */ + public NetworkResourceProperties withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the status property: Status of the network. + * + * @return the status value. + */ + public ResourceStatus status() { + return this.status; + } + + /** + * Get the statusDetails property: Gives additional information about the current status of the network. + * + * @return the statusDetails value. + */ + public String statusDetails() { + return this.statusDetails; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/NetworkResourcePropertiesBase.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/NetworkResourcePropertiesBase.java new file mode 100644 index 0000000000000..67242eb91e091 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/NetworkResourcePropertiesBase.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.servicefabricmesh.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** This type describes the properties of a network resource, including its kind. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "kind", + defaultImpl = NetworkResourcePropertiesBase.class) +@JsonTypeName("NetworkResourcePropertiesBase") +@JsonSubTypes({@JsonSubTypes.Type(name = "NetworkResourceProperties", value = NetworkResourceProperties.class)}) +@Immutable +public class NetworkResourcePropertiesBase extends ProvisionedResourceProperties { + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/Networks.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/Networks.java new file mode 100644 index 0000000000000..78b26214c8751 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/Networks.java @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.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 Networks. */ +public interface Networks { + /** + * Gets the information about the network resource with the given name. The information include the description and + * other properties of the network. + * + * @param resourceGroupName Azure resource group name. + * @param networkResourceName The identity of the network. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about the network resource with the given name. + */ + NetworkResourceDescription getByResourceGroup(String resourceGroupName, String networkResourceName); + + /** + * Gets the information about the network resource with the given name. The information include the description and + * other properties of the network. + * + * @param resourceGroupName Azure resource group name. + * @param networkResourceName The identity of the network. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about the network resource with the given name along with {@link Response}. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String networkResourceName, Context context); + + /** + * Deletes the network resource identified by the name. + * + * @param resourceGroupName Azure resource group name. + * @param networkResourceName The identity of the network. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String networkResourceName); + + /** + * Deletes the network resource identified by the name. + * + * @param resourceGroupName Azure resource group name. + * @param networkResourceName The identity of the network. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException 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 networkResourceName, Context context); + + /** + * Gets the information about all network resources in a given resource group. The information include the + * description and other properties of the Network. + * + * @param resourceGroupName Azure resource group name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all network resources in a given resource group as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Gets the information about all network resources in a given resource group. The information include the + * description and other properties of the Network. + * + * @param resourceGroupName Azure resource group name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all network resources in a given resource group as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Gets the information about all network resources in a given resource group. The information include the + * description and other properties of the network. + * + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all network resources in a given resource group as paginated response with {@link + * PagedIterable}. + */ + PagedIterable list(); + + /** + * Gets the information about all network resources in a given resource group. The information include the + * description and other properties of the network. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all network resources in a given resource group as paginated response with {@link + * PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Gets the information about the network resource with the given name. The information include the description and + * other properties of the network. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about the network resource with the given name along with {@link Response}. + */ + NetworkResourceDescription getById(String id); + + /** + * Gets the information about the network resource with the given name. The information include the description and + * other properties of the network. + * + * @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.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about the network resource with the given name along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes the network resource identified by the name. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes the network resource identified by the name. + * + * @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.resourcemanager.servicefabricmesh.models.ErrorErrorModelException 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 NetworkResourceDescription resource. + * + * @param name resource name. + * @return the first stage of the new NetworkResourceDescription definition. + */ + NetworkResourceDescription.DefinitionStages.Blank define(String name); +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/OperatingSystemType.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/OperatingSystemType.java new file mode 100644 index 0000000000000..11d7ee7c3ac77 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/OperatingSystemType.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.servicefabricmesh.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for OperatingSystemType. */ +public final class OperatingSystemType extends ExpandableStringEnum { + /** Static value Linux for OperatingSystemType. */ + public static final OperatingSystemType LINUX = fromString("Linux"); + + /** Static value Windows for OperatingSystemType. */ + public static final OperatingSystemType WINDOWS = fromString("Windows"); + + /** + * Creates or finds a OperatingSystemType from its string representation. + * + * @param name a name to look for. + * @return the corresponding OperatingSystemType. + */ + @JsonCreator + public static OperatingSystemType fromString(String name) { + return fromString(name, OperatingSystemType.class); + } + + /** + * Gets known OperatingSystemType values. + * + * @return known OperatingSystemType values. + */ + public static Collection values() { + return values(OperatingSystemType.class); + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/OperationListResult.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/OperationListResult.java new file mode 100644 index 0000000000000..c303221a1e9bf --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/OperationListResult.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.servicefabricmesh.fluent.models.OperationResultInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Describes the result of the request to list Service Fabric operations. */ +@Fluent +public final class OperationListResult { + /* + * List of Service Fabric operations supported by the + * Microsoft.ServiceFabric resource provider. + */ + @JsonProperty(value = "value") + private List value; + + /* + * URL to get the next set of operation list results if there are any. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: List of Service Fabric operations supported by the Microsoft.ServiceFabric resource + * provider. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of Service Fabric operations supported by the Microsoft.ServiceFabric resource + * provider. + * + * @param value the value value to set. + * @return the OperationListResult object itself. + */ + public OperationListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: URL to get the next set of operation list results if there are any. + * + * @return the nextLink value. + */ + public String nextLink() { + 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/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/OperationResult.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/OperationResult.java new file mode 100644 index 0000000000000..f62fa6ae93d67 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/OperationResult.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.models; + +import com.azure.resourcemanager.servicefabricmesh.fluent.models.OperationResultInner; + +/** An immutable client-side representation of OperationResult. */ +public interface OperationResult { + /** + * Gets the name property: The name of the operation. + * + * @return the name value. + */ + String name(); + + /** + * Gets the display property: The object that represents the operation. + * + * @return the display value. + */ + AvailableOperationDisplay display(); + + /** + * Gets the origin property: Origin result. + * + * @return the origin value. + */ + String origin(); + + /** + * Gets the nextLink property: The URL to use for getting the next set of results. + * + * @return the nextLink value. + */ + String nextLink(); + + /** + * Gets the inner com.azure.resourcemanager.servicefabricmesh.fluent.models.OperationResultInner object. + * + * @return the inner object. + */ + OperationResultInner innerModel(); +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/Operations.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/Operations.java new file mode 100644 index 0000000000000..d6e69b721cde8 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/Operations.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Operations. */ +public interface Operations { + /** + * Lists all the available operations provided by Service Fabric SeaBreeze resource provider. + * + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to list Service Fabric operations as paginated response with {@link + * PagedIterable}. + */ + PagedIterable list(); + + /** + * Lists all the available operations provided by Service Fabric SeaBreeze resource provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the result of the request to list Service Fabric operations as paginated response with {@link + * PagedIterable}. + */ + PagedIterable list(Context context); +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/PathMatchType.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/PathMatchType.java new file mode 100644 index 0000000000000..ab7c4655e8764 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/PathMatchType.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for PathMatchType. */ +public final class PathMatchType extends ExpandableStringEnum { + /** Static value prefix for PathMatchType. */ + public static final PathMatchType PREFIX = fromString("prefix"); + + /** + * Creates or finds a PathMatchType from its string representation. + * + * @param name a name to look for. + * @return the corresponding PathMatchType. + */ + @JsonCreator + public static PathMatchType fromString(String name) { + return fromString(name, PathMatchType.class); + } + + /** + * Gets known PathMatchType values. + * + * @return known PathMatchType values. + */ + public static Collection values() { + return values(PathMatchType.class); + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ProvisionedResourceProperties.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ProvisionedResourceProperties.java new file mode 100644 index 0000000000000..a60c5e519e81f --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ProvisionedResourceProperties.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes common properties of a provisioned resource. */ +@Immutable +public class ProvisionedResourceProperties { + /* + * State of the resource. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** + * Get the provisioningState property: State of the resource. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ReliableCollectionsRef.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ReliableCollectionsRef.java new file mode 100644 index 0000000000000..f17838fdab6cd --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ReliableCollectionsRef.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.servicefabricmesh.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Specifying this parameter adds support for reliable collections. */ +@Fluent +public final class ReliableCollectionsRef { + /* + * Name of ReliableCollection resource. Right now it's not used and you can + * use any string. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * False (the default) if ReliableCollections state is persisted to disk as + * usual. True if you do not want to persist state, in which case + * replication is still enabled and you can use ReliableCollections as + * distributed cache. + */ + @JsonProperty(value = "doNotPersistState") + private Boolean doNotPersistState; + + /** + * Get the name property: Name of ReliableCollection resource. Right now it's not used and you can use any string. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name of ReliableCollection resource. Right now it's not used and you can use any string. + * + * @param name the name value to set. + * @return the ReliableCollectionsRef object itself. + */ + public ReliableCollectionsRef withName(String name) { + this.name = name; + return this; + } + + /** + * Get the doNotPersistState property: False (the default) if ReliableCollections state is persisted to disk as + * usual. True if you do not want to persist state, in which case replication is still enabled and you can use + * ReliableCollections as distributed cache. + * + * @return the doNotPersistState value. + */ + public Boolean doNotPersistState() { + return this.doNotPersistState; + } + + /** + * Set the doNotPersistState property: False (the default) if ReliableCollections state is persisted to disk as + * usual. True if you do not want to persist state, in which case replication is still enabled and you can use + * ReliableCollections as distributed cache. + * + * @param doNotPersistState the doNotPersistState value to set. + * @return the ReliableCollectionsRef object itself. + */ + public ReliableCollectionsRef withDoNotPersistState(Boolean doNotPersistState) { + this.doNotPersistState = doNotPersistState; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property name in model ReliableCollectionsRef")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ReliableCollectionsRef.class); +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ResourceLimits.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ResourceLimits.java new file mode 100644 index 0000000000000..bb9c9d912224f --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ResourceLimits.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * This type describes the resource limits for a given container. It describes the most amount of resources a container + * is allowed to use before being restarted. + */ +@Fluent +public final class ResourceLimits { + /* + * The memory limit in GB. + */ + @JsonProperty(value = "memoryInGB") + private Double memoryInGB; + + /* + * CPU limits in cores. At present, only full cores are supported. + */ + @JsonProperty(value = "cpu") + private Double cpu; + + /** + * Get the memoryInGB property: The memory limit in GB. + * + * @return the memoryInGB value. + */ + public Double memoryInGB() { + return this.memoryInGB; + } + + /** + * Set the memoryInGB property: The memory limit in GB. + * + * @param memoryInGB the memoryInGB value to set. + * @return the ResourceLimits object itself. + */ + public ResourceLimits withMemoryInGB(Double memoryInGB) { + this.memoryInGB = memoryInGB; + return this; + } + + /** + * Get the cpu property: CPU limits in cores. At present, only full cores are supported. + * + * @return the cpu value. + */ + public Double cpu() { + return this.cpu; + } + + /** + * Set the cpu property: CPU limits in cores. At present, only full cores are supported. + * + * @param cpu the cpu value to set. + * @return the ResourceLimits object itself. + */ + public ResourceLimits withCpu(Double cpu) { + this.cpu = cpu; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ResourceRequests.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ResourceRequests.java new file mode 100644 index 0000000000000..b308e4e271451 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ResourceRequests.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.servicefabricmesh.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * This type describes the requested resources for a given container. It describes the least amount of resources + * required for the container. A container can consume more than requested resources up to the specified limits before + * being restarted. Currently, the requested resources are treated as limits. + */ +@Fluent +public final class ResourceRequests { + /* + * The memory request in GB for this container. + */ + @JsonProperty(value = "memoryInGB", required = true) + private double memoryInGB; + + /* + * Requested number of CPU cores. At present, only full cores are + * supported. + */ + @JsonProperty(value = "cpu", required = true) + private double cpu; + + /** + * Get the memoryInGB property: The memory request in GB for this container. + * + * @return the memoryInGB value. + */ + public double memoryInGB() { + return this.memoryInGB; + } + + /** + * Set the memoryInGB property: The memory request in GB for this container. + * + * @param memoryInGB the memoryInGB value to set. + * @return the ResourceRequests object itself. + */ + public ResourceRequests withMemoryInGB(double memoryInGB) { + this.memoryInGB = memoryInGB; + return this; + } + + /** + * Get the cpu property: Requested number of CPU cores. At present, only full cores are supported. + * + * @return the cpu value. + */ + public double cpu() { + return this.cpu; + } + + /** + * Set the cpu property: Requested number of CPU cores. At present, only full cores are supported. + * + * @param cpu the cpu value to set. + * @return the ResourceRequests object itself. + */ + public ResourceRequests withCpu(double cpu) { + this.cpu = cpu; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ResourceRequirements.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ResourceRequirements.java new file mode 100644 index 0000000000000..ba7e58ce7e187 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ResourceRequirements.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** This type describes the resource requirements for a container or a service. */ +@Fluent +public final class ResourceRequirements { + /* + * Describes the requested resources for a given container. + */ + @JsonProperty(value = "requests", required = true) + private ResourceRequests requests; + + /* + * Describes the maximum limits on the resources for a given container. + */ + @JsonProperty(value = "limits") + private ResourceLimits limits; + + /** + * Get the requests property: Describes the requested resources for a given container. + * + * @return the requests value. + */ + public ResourceRequests requests() { + return this.requests; + } + + /** + * Set the requests property: Describes the requested resources for a given container. + * + * @param requests the requests value to set. + * @return the ResourceRequirements object itself. + */ + public ResourceRequirements withRequests(ResourceRequests requests) { + this.requests = requests; + return this; + } + + /** + * Get the limits property: Describes the maximum limits on the resources for a given container. + * + * @return the limits value. + */ + public ResourceLimits limits() { + return this.limits; + } + + /** + * Set the limits property: Describes the maximum limits on the resources for a given container. + * + * @param limits the limits value to set. + * @return the ResourceRequirements object itself. + */ + public ResourceRequirements withLimits(ResourceLimits limits) { + this.limits = limits; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (requests() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property requests in model ResourceRequirements")); + } else { + requests().validate(); + } + if (limits() != null) { + limits().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ResourceRequirements.class); +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ResourceStatus.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ResourceStatus.java new file mode 100644 index 0000000000000..a9498aa696987 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ResourceStatus.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.servicefabricmesh.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ResourceStatus. */ +public final class ResourceStatus extends ExpandableStringEnum { + /** Static value Unknown for ResourceStatus. */ + public static final ResourceStatus UNKNOWN = fromString("Unknown"); + + /** Static value Ready for ResourceStatus. */ + public static final ResourceStatus READY = fromString("Ready"); + + /** Static value Upgrading for ResourceStatus. */ + public static final ResourceStatus UPGRADING = fromString("Upgrading"); + + /** Static value Creating for ResourceStatus. */ + public static final ResourceStatus CREATING = fromString("Creating"); + + /** Static value Deleting for ResourceStatus. */ + public static final ResourceStatus DELETING = fromString("Deleting"); + + /** Static value Failed for ResourceStatus. */ + public static final ResourceStatus FAILED = fromString("Failed"); + + /** + * Creates or finds a ResourceStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding ResourceStatus. + */ + @JsonCreator + public static ResourceStatus fromString(String name) { + return fromString(name, ResourceStatus.class); + } + + /** + * Gets known ResourceStatus values. + * + * @return known ResourceStatus values. + */ + public static Collection values() { + return values(ResourceStatus.class); + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/SecretKind.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/SecretKind.java new file mode 100644 index 0000000000000..9b83153f9607e --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/SecretKind.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for SecretKind. */ +public final class SecretKind extends ExpandableStringEnum { + /** Static value inlinedValue for SecretKind. */ + public static final SecretKind INLINED_VALUE = fromString("inlinedValue"); + + /** + * Creates or finds a SecretKind from its string representation. + * + * @param name a name to look for. + * @return the corresponding SecretKind. + */ + @JsonCreator + public static SecretKind fromString(String name) { + return fromString(name, SecretKind.class); + } + + /** + * Gets known SecretKind values. + * + * @return known SecretKind values. + */ + public static Collection values() { + return values(SecretKind.class); + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/SecretResourceDescription.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/SecretResourceDescription.java new file mode 100644 index 0000000000000..b524a4f2d566b --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/SecretResourceDescription.java @@ -0,0 +1,173 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.servicefabricmesh.fluent.models.SecretResourceDescriptionInner; +import java.util.Map; + +/** An immutable client-side representation of SecretResourceDescription. */ +public interface SecretResourceDescription { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the properties property: Describes the properties of a secret resource. + * + * @return the properties value. + */ + SecretResourceProperties properties(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.servicefabricmesh.fluent.models.SecretResourceDescriptionInner object. + * + * @return the inner object. + */ + SecretResourceDescriptionInner innerModel(); + + /** The entirety of the SecretResourceDescription definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithProperties, + DefinitionStages.WithCreate { + } + /** The SecretResourceDescription definition stages. */ + interface DefinitionStages { + /** The first stage of the SecretResourceDescription definition. */ + interface Blank extends WithLocation { + } + /** The stage of the SecretResourceDescription definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + /** The stage of the SecretResourceDescription definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName Azure resource group name. + * @return the next definition stage. + */ + WithProperties withExistingResourceGroup(String resourceGroupName); + } + /** The stage of the SecretResourceDescription definition allowing to specify properties. */ + interface WithProperties { + /** + * Specifies the properties property: Describes the properties of a secret resource.. + * + * @param properties Describes the properties of a secret resource. + * @return the next definition stage. + */ + WithCreate withProperties(SecretResourceProperties properties); + } + /** + * The stage of the SecretResourceDescription definition which contains all the minimum required properties for + * the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithTags { + /** + * Executes the create request. + * + * @return the created resource. + */ + SecretResourceDescription create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + SecretResourceDescription create(Context context); + } + /** The stage of the SecretResourceDescription definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + SecretResourceDescription refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + SecretResourceDescription refresh(Context context); +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/SecretResourceDescriptionList.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/SecretResourceDescriptionList.java new file mode 100644 index 0000000000000..40ce76392e325 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/SecretResourceDescriptionList.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.servicefabricmesh.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.servicefabricmesh.fluent.models.SecretResourceDescriptionInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A pageable list of secret resources. */ +@Fluent +public final class SecretResourceDescriptionList { + /* + * One page of the list. + */ + @JsonProperty(value = "value") + private List value; + + /* + * URI to fetch the next page of the list. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: One page of the list. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: One page of the list. + * + * @param value the value value to set. + * @return the SecretResourceDescriptionList object itself. + */ + public SecretResourceDescriptionList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: URI to fetch the next page of the list. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: URI to fetch the next page of the list. + * + * @param nextLink the nextLink value to set. + * @return the SecretResourceDescriptionList object itself. + */ + public SecretResourceDescriptionList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/SecretResourceProperties.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/SecretResourceProperties.java new file mode 100644 index 0000000000000..4cc1192f25daa --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/SecretResourceProperties.java @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** Describes the properties of a secret resource. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "kind", + defaultImpl = SecretResourceProperties.class) +@JsonTypeName("SecretResourceProperties") +@JsonSubTypes({@JsonSubTypes.Type(name = "inlinedValue", value = InlinedValueSecretResourceProperties.class)}) +@Fluent +public class SecretResourceProperties extends SecretResourcePropertiesBase { + /* + * User readable description of the secret. + */ + @JsonProperty(value = "description") + private String description; + + /* + * Status of the resource. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private ResourceStatus status; + + /* + * Gives additional information about the current status of the secret. + */ + @JsonProperty(value = "statusDetails", access = JsonProperty.Access.WRITE_ONLY) + private String statusDetails; + + /* + * The type of the content stored in the secret value. The value of this + * property is opaque to Service Fabric. Once set, the value of this + * property cannot be changed. + */ + @JsonProperty(value = "contentType") + private String contentType; + + /** + * Get the description property: User readable description of the secret. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: User readable description of the secret. + * + * @param description the description value to set. + * @return the SecretResourceProperties object itself. + */ + public SecretResourceProperties withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the status property: Status of the resource. + * + * @return the status value. + */ + public ResourceStatus status() { + return this.status; + } + + /** + * Get the statusDetails property: Gives additional information about the current status of the secret. + * + * @return the statusDetails value. + */ + public String statusDetails() { + return this.statusDetails; + } + + /** + * Get the contentType property: The type of the content stored in the secret value. The value of this property is + * opaque to Service Fabric. Once set, the value of this property cannot be changed. + * + * @return the contentType value. + */ + public String contentType() { + return this.contentType; + } + + /** + * Set the contentType property: The type of the content stored in the secret value. The value of this property is + * opaque to Service Fabric. Once set, the value of this property cannot be changed. + * + * @param contentType the contentType value to set. + * @return the SecretResourceProperties object itself. + */ + public SecretResourceProperties withContentType(String contentType) { + this.contentType = contentType; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/SecretResourcePropertiesBase.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/SecretResourcePropertiesBase.java new file mode 100644 index 0000000000000..f10ef1d10a896 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/SecretResourcePropertiesBase.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.servicefabricmesh.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** This type describes the properties of a secret resource, including its kind. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "kind", + defaultImpl = SecretResourcePropertiesBase.class) +@JsonTypeName("SecretResourcePropertiesBase") +@JsonSubTypes({@JsonSubTypes.Type(name = "SecretResourceProperties", value = SecretResourceProperties.class)}) +@Immutable +public class SecretResourcePropertiesBase extends ProvisionedResourceProperties { + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/SecretValue.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/SecretValue.java new file mode 100644 index 0000000000000..4fbdb10c60537 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/SecretValue.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.models; + +import com.azure.resourcemanager.servicefabricmesh.fluent.models.SecretValueInner; + +/** An immutable client-side representation of SecretValue. */ +public interface SecretValue { + /** + * Gets the value property: The actual value of the secret. + * + * @return the value value. + */ + String value(); + + /** + * Gets the inner com.azure.resourcemanager.servicefabricmesh.fluent.models.SecretValueInner object. + * + * @return the inner object. + */ + SecretValueInner innerModel(); +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/SecretValueProperties.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/SecretValueProperties.java new file mode 100644 index 0000000000000..eb37d30fe4474 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/SecretValueProperties.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.servicefabricmesh.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** This type describes properties of secret value resource. */ +@Fluent +public class SecretValueProperties { + /* + * The actual value of the secret. + */ + @JsonProperty(value = "value") + private String value; + + /** + * Get the value property: The actual value of the secret. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Set the value property: The actual value of the secret. + * + * @param value the value value to set. + * @return the SecretValueProperties object itself. + */ + public SecretValueProperties 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/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/SecretValueResourceDescription.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/SecretValueResourceDescription.java new file mode 100644 index 0000000000000..c961aff444d7a --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/SecretValueResourceDescription.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.servicefabricmesh.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.servicefabricmesh.fluent.models.SecretValueResourceDescriptionInner; +import java.util.Map; + +/** An immutable client-side representation of SecretValueResourceDescription. */ +public interface SecretValueResourceDescription { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the value property: The actual value of the secret. + * + * @return the value value. + */ + String value(); + + /** + * Gets the provisioningState property: State of the resource. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.servicefabricmesh.fluent.models.SecretValueResourceDescriptionInner + * object. + * + * @return the inner object. + */ + SecretValueResourceDescriptionInner innerModel(); + + /** The entirety of the SecretValueResourceDescription definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithParentResource, + DefinitionStages.WithCreate { + } + /** The SecretValueResourceDescription definition stages. */ + interface DefinitionStages { + /** The first stage of the SecretValueResourceDescription definition. */ + interface Blank extends WithLocation { + } + /** The stage of the SecretValueResourceDescription definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(String location); + } + /** The stage of the SecretValueResourceDescription definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, secretResourceName. + * + * @param resourceGroupName Azure resource group name. + * @param secretResourceName The name of the secret resource. + * @return the next definition stage. + */ + WithCreate withExistingSecret(String resourceGroupName, String secretResourceName); + } + /** + * The stage of the SecretValueResourceDescription definition which contains all the minimum required properties + * for the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithTags, DefinitionStages.WithValue { + /** + * Executes the create request. + * + * @return the created resource. + */ + SecretValueResourceDescription create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + SecretValueResourceDescription create(Context context); + } + /** The stage of the SecretValueResourceDescription definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the SecretValueResourceDescription definition allowing to specify value. */ + interface WithValue { + /** + * Specifies the value property: The actual value of the secret.. + * + * @param value The actual value of the secret. + * @return the next definition stage. + */ + WithCreate withValue(String value); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + SecretValueResourceDescription refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + SecretValueResourceDescription refresh(Context context); + + /** + * Lists the decrypted value of the specified named value of the secret resource. This is a privileged operation. + * + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this type represents the unencrypted value of the secret. + */ + SecretValue listValue(); + + /** + * Lists the decrypted value of the specified named value of the secret resource. This is a privileged operation. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this type represents the unencrypted value of the secret along with {@link Response}. + */ + Response listValueWithResponse(Context context); +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/SecretValueResourceDescriptionList.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/SecretValueResourceDescriptionList.java new file mode 100644 index 0000000000000..3b240771b508c --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/SecretValueResourceDescriptionList.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.servicefabricmesh.fluent.models.SecretValueResourceDescriptionInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * A pageable list of values of a secret resource. The information does not include only the name of the value and not + * the actual unencrypted value. + */ +@Fluent +public final class SecretValueResourceDescriptionList { + /* + * One page of the list. + */ + @JsonProperty(value = "value") + private List value; + + /* + * URI to fetch the next page of the list. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: One page of the list. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: One page of the list. + * + * @param value the value value to set. + * @return the SecretValueResourceDescriptionList object itself. + */ + public SecretValueResourceDescriptionList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: URI to fetch the next page of the list. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: URI to fetch the next page of the list. + * + * @param nextLink the nextLink value to set. + * @return the SecretValueResourceDescriptionList object itself. + */ + public SecretValueResourceDescriptionList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/SecretValues.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/SecretValues.java new file mode 100644 index 0000000000000..44b034de5b221 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/SecretValues.java @@ -0,0 +1,205 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.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 SecretValues. */ +public interface SecretValues { + /** + * Get the information about the specified named secret value resources. The information does not include the actual + * value of the secret. + * + * @param resourceGroupName Azure resource group name. + * @param secretResourceName The name of the secret resource. + * @param secretValueResourceName The name of the secret resource value which is typically the version identifier + * for the value. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about the specified named secret value resources. + */ + SecretValueResourceDescription get( + String resourceGroupName, String secretResourceName, String secretValueResourceName); + + /** + * Get the information about the specified named secret value resources. The information does not include the actual + * value of the secret. + * + * @param resourceGroupName Azure resource group name. + * @param secretResourceName The name of the secret resource. + * @param secretValueResourceName The name of the secret resource value which is typically the version identifier + * for the value. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about the specified named secret value resources along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String secretResourceName, String secretValueResourceName, Context context); + + /** + * Deletes the secret value resource identified by the name. The name of the resource is typically the version + * associated with that value. Deletion will fail if the specified value is in use. + * + * @param resourceGroupName Azure resource group name. + * @param secretResourceName The name of the secret resource. + * @param secretValueResourceName The name of the secret resource value which is typically the version identifier + * for the value. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException 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 secretResourceName, String secretValueResourceName); + + /** + * Deletes the secret value resource identified by the name. The name of the resource is typically the version + * associated with that value. Deletion will fail if the specified value is in use. + * + * @param resourceGroupName Azure resource group name. + * @param secretResourceName The name of the secret resource. + * @param secretValueResourceName The name of the secret resource value which is typically the version identifier + * for the value. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException 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 secretResourceName, String secretValueResourceName, Context context); + + /** + * Gets information about all secret value resources of the specified secret resource. The information includes the + * names of the secret value resources, but not the actual values. + * + * @param resourceGroupName Azure resource group name. + * @param secretResourceName The name of the secret resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about all secret value resources of the specified secret resource as paginated response with + * {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String secretResourceName); + + /** + * Gets information about all secret value resources of the specified secret resource. The information includes the + * names of the secret value resources, but not the actual values. + * + * @param resourceGroupName Azure resource group name. + * @param secretResourceName The name of the secret resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about all secret value resources of the specified secret resource as paginated response with + * {@link PagedIterable}. + */ + PagedIterable list( + String resourceGroupName, String secretResourceName, Context context); + + /** + * Lists the decrypted value of the specified named value of the secret resource. This is a privileged operation. + * + * @param resourceGroupName Azure resource group name. + * @param secretResourceName The name of the secret resource. + * @param secretValueResourceName The name of the secret resource value which is typically the version identifier + * for the value. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this type represents the unencrypted value of the secret. + */ + SecretValue listValue(String resourceGroupName, String secretResourceName, String secretValueResourceName); + + /** + * Lists the decrypted value of the specified named value of the secret resource. This is a privileged operation. + * + * @param resourceGroupName Azure resource group name. + * @param secretResourceName The name of the secret resource. + * @param secretValueResourceName The name of the secret resource value which is typically the version identifier + * for the value. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this type represents the unencrypted value of the secret along with {@link Response}. + */ + Response listValueWithResponse( + String resourceGroupName, String secretResourceName, String secretValueResourceName, Context context); + + /** + * Get the information about the specified named secret value resources. The information does not include the actual + * value of the secret. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about the specified named secret value resources along with {@link Response}. + */ + SecretValueResourceDescription getById(String id); + + /** + * Get the information about the specified named secret value resources. The information does not include the actual + * value of the secret. + * + * @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.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about the specified named secret value resources along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes the secret value resource identified by the name. The name of the resource is typically the version + * associated with that value. Deletion will fail if the specified value is in use. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes the secret value resource identified by the name. The name of the resource is typically the version + * associated with that value. Deletion will fail if the specified value is in use. + * + * @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.resourcemanager.servicefabricmesh.models.ErrorErrorModelException 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 SecretValueResourceDescription resource. + * + * @param name resource name. + * @return the first stage of the new SecretValueResourceDescription definition. + */ + SecretValueResourceDescription.DefinitionStages.Blank define(String name); +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/Secrets.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/Secrets.java new file mode 100644 index 0000000000000..2929ea05995ba --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/Secrets.java @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.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 Secrets. */ +public interface Secrets { + /** + * Gets the information about the secret resource with the given name. The information include the description and + * other properties of the secret. + * + * @param resourceGroupName Azure resource group name. + * @param secretResourceName The name of the secret resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about the secret resource with the given name. + */ + SecretResourceDescription getByResourceGroup(String resourceGroupName, String secretResourceName); + + /** + * Gets the information about the secret resource with the given name. The information include the description and + * other properties of the secret. + * + * @param resourceGroupName Azure resource group name. + * @param secretResourceName The name of the secret resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about the secret resource with the given name along with {@link Response}. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String secretResourceName, Context context); + + /** + * Deletes the secret resource identified by the name. + * + * @param resourceGroupName Azure resource group name. + * @param secretResourceName The name of the secret resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String secretResourceName); + + /** + * Deletes the secret resource identified by the name. + * + * @param resourceGroupName Azure resource group name. + * @param secretResourceName The name of the secret resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException 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 secretResourceName, Context context); + + /** + * Gets the information about all secret resources in a given resource group. The information include the + * description and other properties of the Secret. + * + * @param resourceGroupName Azure resource group name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all secret resources in a given resource group as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Gets the information about all secret resources in a given resource group. The information include the + * description and other properties of the Secret. + * + * @param resourceGroupName Azure resource group name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all secret resources in a given resource group as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Gets the information about all secret resources in a given resource group. The information include the + * description and other properties of the secret. + * + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all secret resources in a given resource group as paginated response with {@link + * PagedIterable}. + */ + PagedIterable list(); + + /** + * Gets the information about all secret resources in a given resource group. The information include the + * description and other properties of the secret. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all secret resources in a given resource group as paginated response with {@link + * PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Gets the information about the secret resource with the given name. The information include the description and + * other properties of the secret. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about the secret resource with the given name along with {@link Response}. + */ + SecretResourceDescription getById(String id); + + /** + * Gets the information about the secret resource with the given name. The information include the description and + * other properties of the secret. + * + * @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.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about the secret resource with the given name along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes the secret resource identified by the name. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes the secret resource identified by the name. + * + * @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.resourcemanager.servicefabricmesh.models.ErrorErrorModelException 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 SecretResourceDescription resource. + * + * @param name resource name. + * @return the first stage of the new SecretResourceDescription definition. + */ + SecretResourceDescription.DefinitionStages.Blank define(String name); +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ServiceProperties.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ServiceProperties.java new file mode 100644 index 0000000000000..245c7b0ac8319 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ServiceProperties.java @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Describes properties of a service resource. */ +@Fluent +public class ServiceProperties { + /* + * User readable description of the service. + */ + @JsonProperty(value = "description") + private String description; + + /* + * The number of replicas of the service to create. Defaults to 1 if not + * specified. + */ + @JsonProperty(value = "replicaCount") + private Integer replicaCount; + + /* + * Auto scaling policies + */ + @JsonProperty(value = "autoScalingPolicies") + private List autoScalingPolicies; + + /* + * Status of the service. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private ResourceStatus status; + + /* + * Gives additional information about the current status of the service. + */ + @JsonProperty(value = "statusDetails", access = JsonProperty.Access.WRITE_ONLY) + private String statusDetails; + + /* + * Describes the health state of an application resource. + */ + @JsonProperty(value = "healthState", access = JsonProperty.Access.WRITE_ONLY) + private HealthState healthState; + + /* + * When the service's health state is not 'Ok', this additional details + * from service fabric Health Manager for the user to know why the service + * is marked unhealthy. + */ + @JsonProperty(value = "unhealthyEvaluation", access = JsonProperty.Access.WRITE_ONLY) + private String unhealthyEvaluation; + + /** + * Get the description property: User readable description of the service. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: User readable description of the service. + * + * @param description the description value to set. + * @return the ServiceProperties object itself. + */ + public ServiceProperties withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the replicaCount property: The number of replicas of the service to create. Defaults to 1 if not specified. + * + * @return the replicaCount value. + */ + public Integer replicaCount() { + return this.replicaCount; + } + + /** + * Set the replicaCount property: The number of replicas of the service to create. Defaults to 1 if not specified. + * + * @param replicaCount the replicaCount value to set. + * @return the ServiceProperties object itself. + */ + public ServiceProperties withReplicaCount(Integer replicaCount) { + this.replicaCount = replicaCount; + return this; + } + + /** + * Get the autoScalingPolicies property: Auto scaling policies. + * + * @return the autoScalingPolicies value. + */ + public List autoScalingPolicies() { + return this.autoScalingPolicies; + } + + /** + * Set the autoScalingPolicies property: Auto scaling policies. + * + * @param autoScalingPolicies the autoScalingPolicies value to set. + * @return the ServiceProperties object itself. + */ + public ServiceProperties withAutoScalingPolicies(List autoScalingPolicies) { + this.autoScalingPolicies = autoScalingPolicies; + return this; + } + + /** + * Get the status property: Status of the service. + * + * @return the status value. + */ + public ResourceStatus status() { + return this.status; + } + + /** + * Get the statusDetails property: Gives additional information about the current status of the service. + * + * @return the statusDetails value. + */ + public String statusDetails() { + return this.statusDetails; + } + + /** + * Get the healthState property: Describes the health state of an application resource. + * + * @return the healthState value. + */ + public HealthState healthState() { + return this.healthState; + } + + /** + * Get the unhealthyEvaluation property: When the service's health state is not 'Ok', this additional details from + * service fabric Health Manager for the user to know why the service is marked unhealthy. + * + * @return the unhealthyEvaluation value. + */ + public String unhealthyEvaluation() { + return this.unhealthyEvaluation; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (autoScalingPolicies() != null) { + autoScalingPolicies().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ServiceReplicaDescription.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ServiceReplicaDescription.java new file mode 100644 index 0000000000000..b1594c9ad50bf --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ServiceReplicaDescription.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.models; + +import com.azure.resourcemanager.servicefabricmesh.fluent.models.ServiceReplicaDescriptionInner; +import java.util.List; + +/** An immutable client-side representation of ServiceReplicaDescription. */ +public interface ServiceReplicaDescription { + /** + * Gets the osType property: The operation system required by the code in service. + * + * @return the osType value. + */ + OperatingSystemType osType(); + + /** + * Gets the codePackages property: Describes the set of code packages that forms the service. A code package + * describes the container and the properties for running it. All the code packages are started together on the same + * host and share the same context (network, process etc.). + * + * @return the codePackages value. + */ + List codePackages(); + + /** + * Gets the networkRefs property: The names of the private networks that this service needs to be part of. + * + * @return the networkRefs value. + */ + List networkRefs(); + + /** + * Gets the diagnostics property: Reference to sinks in DiagnosticsDescription. + * + * @return the diagnostics value. + */ + DiagnosticsRef diagnostics(); + + /** + * Gets the replicaName property: Name of the replica. + * + * @return the replicaName value. + */ + String replicaName(); + + /** + * Gets the inner com.azure.resourcemanager.servicefabricmesh.fluent.models.ServiceReplicaDescriptionInner object. + * + * @return the inner object. + */ + ServiceReplicaDescriptionInner innerModel(); +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ServiceReplicaDescriptionList.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ServiceReplicaDescriptionList.java new file mode 100644 index 0000000000000..55447831ddbe9 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ServiceReplicaDescriptionList.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.servicefabricmesh.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.servicefabricmesh.fluent.models.ServiceReplicaDescriptionInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A pageable list of service replicas. */ +@Fluent +public final class ServiceReplicaDescriptionList { + /* + * One page of the list. + */ + @JsonProperty(value = "value") + private List value; + + /* + * URI to fetch the next page of the list. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: One page of the list. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: One page of the list. + * + * @param value the value value to set. + * @return the ServiceReplicaDescriptionList object itself. + */ + public ServiceReplicaDescriptionList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: URI to fetch the next page of the list. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: URI to fetch the next page of the list. + * + * @param nextLink the nextLink value to set. + * @return the ServiceReplicaDescriptionList object itself. + */ + public ServiceReplicaDescriptionList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ServiceReplicaProperties.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ServiceReplicaProperties.java new file mode 100644 index 0000000000000..c678cd2bc2a24 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ServiceReplicaProperties.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.servicefabricmesh.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Describes the properties of a service replica. */ +@Fluent +public class ServiceReplicaProperties { + /* + * The operation system required by the code in service. + */ + @JsonProperty(value = "osType", required = true) + private OperatingSystemType osType; + + /* + * Describes the set of code packages that forms the service. A code + * package describes the container and the properties for running it. All + * the code packages are started together on the same host and share the + * same context (network, process etc.). + */ + @JsonProperty(value = "codePackages", required = true) + private List codePackages; + + /* + * The names of the private networks that this service needs to be part of. + */ + @JsonProperty(value = "networkRefs") + private List networkRefs; + + /* + * Reference to sinks in DiagnosticsDescription. + */ + @JsonProperty(value = "diagnostics") + private DiagnosticsRef diagnostics; + + /** + * Get the osType property: The operation system required by the code in service. + * + * @return the osType value. + */ + public OperatingSystemType osType() { + return this.osType; + } + + /** + * Set the osType property: The operation system required by the code in service. + * + * @param osType the osType value to set. + * @return the ServiceReplicaProperties object itself. + */ + public ServiceReplicaProperties withOsType(OperatingSystemType osType) { + this.osType = osType; + return this; + } + + /** + * Get the codePackages property: Describes the set of code packages that forms the service. A code package + * describes the container and the properties for running it. All the code packages are started together on the same + * host and share the same context (network, process etc.). + * + * @return the codePackages value. + */ + public List codePackages() { + return this.codePackages; + } + + /** + * Set the codePackages property: Describes the set of code packages that forms the service. A code package + * describes the container and the properties for running it. All the code packages are started together on the same + * host and share the same context (network, process etc.). + * + * @param codePackages the codePackages value to set. + * @return the ServiceReplicaProperties object itself. + */ + public ServiceReplicaProperties withCodePackages(List codePackages) { + this.codePackages = codePackages; + return this; + } + + /** + * Get the networkRefs property: The names of the private networks that this service needs to be part of. + * + * @return the networkRefs value. + */ + public List networkRefs() { + return this.networkRefs; + } + + /** + * Set the networkRefs property: The names of the private networks that this service needs to be part of. + * + * @param networkRefs the networkRefs value to set. + * @return the ServiceReplicaProperties object itself. + */ + public ServiceReplicaProperties withNetworkRefs(List networkRefs) { + this.networkRefs = networkRefs; + return this; + } + + /** + * Get the diagnostics property: Reference to sinks in DiagnosticsDescription. + * + * @return the diagnostics value. + */ + public DiagnosticsRef diagnostics() { + return this.diagnostics; + } + + /** + * Set the diagnostics property: Reference to sinks in DiagnosticsDescription. + * + * @param diagnostics the diagnostics value to set. + * @return the ServiceReplicaProperties object itself. + */ + public ServiceReplicaProperties withDiagnostics(DiagnosticsRef diagnostics) { + this.diagnostics = diagnostics; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (osType() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property osType in model ServiceReplicaProperties")); + } + if (codePackages() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property codePackages in model ServiceReplicaProperties")); + } else { + codePackages().forEach(e -> e.validate()); + } + if (networkRefs() != null) { + networkRefs().forEach(e -> e.validate()); + } + if (diagnostics() != null) { + diagnostics().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ServiceReplicaProperties.class); +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ServiceReplicas.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ServiceReplicas.java new file mode 100644 index 0000000000000..7b65e168b0cba --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ServiceReplicas.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.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 ServiceReplicas. */ +public interface ServiceReplicas { + /** + * Gets the information about the service replica with the given name. The information include the description and + * other properties of the service replica. + * + * @param resourceGroupName Azure resource group name. + * @param applicationResourceName The identity of the application. + * @param serviceResourceName The identity of the service. + * @param replicaName Service Fabric replica name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about the service replica with the given name. + */ + ServiceReplicaDescription get( + String resourceGroupName, String applicationResourceName, String serviceResourceName, String replicaName); + + /** + * Gets the information about the service replica with the given name. The information include the description and + * other properties of the service replica. + * + * @param resourceGroupName Azure resource group name. + * @param applicationResourceName The identity of the application. + * @param serviceResourceName The identity of the service. + * @param replicaName Service Fabric replica name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about the service replica with the given name along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, + String applicationResourceName, + String serviceResourceName, + String replicaName, + Context context); + + /** + * Gets the information about all replicas of a given service of an application. The information includes the + * runtime properties of the replica instance. + * + * @param resourceGroupName Azure resource group name. + * @param applicationResourceName The identity of the application. + * @param serviceResourceName The identity of the service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all replicas of a given service of an application as paginated response with {@link + * PagedIterable}. + */ + PagedIterable list( + String resourceGroupName, String applicationResourceName, String serviceResourceName); + + /** + * Gets the information about all replicas of a given service of an application. The information includes the + * runtime properties of the replica instance. + * + * @param resourceGroupName Azure resource group name. + * @param applicationResourceName The identity of the application. + * @param serviceResourceName The identity of the service. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all replicas of a given service of an application as paginated response with {@link + * PagedIterable}. + */ + PagedIterable list( + String resourceGroupName, String applicationResourceName, String serviceResourceName, Context context); +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ServiceResourceDescription.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ServiceResourceDescription.java new file mode 100644 index 0000000000000..2de67993fb01b --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ServiceResourceDescription.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.models; + +import com.azure.resourcemanager.servicefabricmesh.fluent.models.ServiceResourceDescriptionInner; +import java.util.List; + +/** An immutable client-side representation of ServiceResourceDescription. */ +public interface ServiceResourceDescription { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the osType property: The operation system required by the code in service. + * + * @return the osType value. + */ + OperatingSystemType osType(); + + /** + * Gets the codePackages property: Describes the set of code packages that forms the service. A code package + * describes the container and the properties for running it. All the code packages are started together on the same + * host and share the same context (network, process etc.). + * + * @return the codePackages value. + */ + List codePackages(); + + /** + * Gets the networkRefs property: The names of the private networks that this service needs to be part of. + * + * @return the networkRefs value. + */ + List networkRefs(); + + /** + * Gets the diagnostics property: Reference to sinks in DiagnosticsDescription. + * + * @return the diagnostics value. + */ + DiagnosticsRef diagnostics(); + + /** + * Gets the description property: User readable description of the service. + * + * @return the description value. + */ + String description(); + + /** + * Gets the replicaCount property: The number of replicas of the service to create. Defaults to 1 if not specified. + * + * @return the replicaCount value. + */ + Integer replicaCount(); + + /** + * Gets the autoScalingPolicies property: Auto scaling policies. + * + * @return the autoScalingPolicies value. + */ + List autoScalingPolicies(); + + /** + * Gets the status property: Status of the service. + * + * @return the status value. + */ + ResourceStatus status(); + + /** + * Gets the statusDetails property: Gives additional information about the current status of the service. + * + * @return the statusDetails value. + */ + String statusDetails(); + + /** + * Gets the healthState property: Describes the health state of an application resource. + * + * @return the healthState value. + */ + HealthState healthState(); + + /** + * Gets the unhealthyEvaluation property: When the service's health state is not 'Ok', this additional details from + * service fabric Health Manager for the user to know why the service is marked unhealthy. + * + * @return the unhealthyEvaluation value. + */ + String unhealthyEvaluation(); + + /** + * Gets the provisioningState property: State of the resource. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the inner com.azure.resourcemanager.servicefabricmesh.fluent.models.ServiceResourceDescriptionInner object. + * + * @return the inner object. + */ + ServiceResourceDescriptionInner innerModel(); +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ServiceResourceDescriptionList.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ServiceResourceDescriptionList.java new file mode 100644 index 0000000000000..14f54cc84e1eb --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/ServiceResourceDescriptionList.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.servicefabricmesh.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.servicefabricmesh.fluent.models.ServiceResourceDescriptionInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A pageable list of service resources. */ +@Fluent +public final class ServiceResourceDescriptionList { + /* + * One page of the list. + */ + @JsonProperty(value = "value") + private List value; + + /* + * URI to fetch the next page of the list. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: One page of the list. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: One page of the list. + * + * @param value the value value to set. + * @return the ServiceResourceDescriptionList object itself. + */ + public ServiceResourceDescriptionList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: URI to fetch the next page of the list. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: URI to fetch the next page of the list. + * + * @param nextLink the nextLink value to set. + * @return the ServiceResourceDescriptionList object itself. + */ + public ServiceResourceDescriptionList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/Services.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/Services.java new file mode 100644 index 0000000000000..bf5ddf2ae57f1 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/Services.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.servicefabricmesh.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 Services. */ +public interface Services { + /** + * Gets the information about the service resource with the given name. The information include the description and + * other properties of the service. + * + * @param resourceGroupName Azure resource group name. + * @param applicationResourceName The identity of the application. + * @param serviceResourceName The identity of the service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about the service resource with the given name. + */ + ServiceResourceDescription get( + String resourceGroupName, String applicationResourceName, String serviceResourceName); + + /** + * Gets the information about the service resource with the given name. The information include the description and + * other properties of the service. + * + * @param resourceGroupName Azure resource group name. + * @param applicationResourceName The identity of the application. + * @param serviceResourceName The identity of the service. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about the service resource with the given name along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String applicationResourceName, String serviceResourceName, Context context); + + /** + * Gets the information about all services of an application resource. The information include the description and + * other properties of the Service. + * + * @param resourceGroupName Azure resource group name. + * @param applicationResourceName The identity of the application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all services of an application resource as paginated response with {@link + * PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String applicationResourceName); + + /** + * Gets the information about all services of an application resource. The information include the description and + * other properties of the Service. + * + * @param resourceGroupName Azure resource group name. + * @param applicationResourceName The identity of the application. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all services of an application resource as paginated response with {@link + * PagedIterable}. + */ + PagedIterable list( + String resourceGroupName, String applicationResourceName, Context context); +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/Setting.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/Setting.java new file mode 100644 index 0000000000000..fc0ff06da0a2b --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/Setting.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.servicefabricmesh.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Describes a setting for the container. The setting file path can be fetched from environment variable + * "Fabric_SettingPath". The path for Windows container is "C:\\secrets". The path for Linux container is + * "/var/secrets". + */ +@Fluent +public final class Setting { + /* + * The name of the setting. + */ + @JsonProperty(value = "name") + private String name; + + /* + * The value of the setting. + */ + @JsonProperty(value = "value") + private String value; + + /** + * Get the name property: The name of the setting. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the setting. + * + * @param name the name value to set. + * @return the Setting object itself. + */ + public Setting withName(String name) { + this.name = name; + return this; + } + + /** + * Get the value property: The value of the setting. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Set the value property: The value of the setting. + * + * @param value the value value to set. + * @return the Setting object itself. + */ + public Setting 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/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/SizeTypes.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/SizeTypes.java new file mode 100644 index 0000000000000..34f6b1cb59d9a --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/SizeTypes.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.servicefabricmesh.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for SizeTypes. */ +public final class SizeTypes extends ExpandableStringEnum { + /** Static value Small for SizeTypes. */ + public static final SizeTypes SMALL = fromString("Small"); + + /** Static value Medium for SizeTypes. */ + public static final SizeTypes MEDIUM = fromString("Medium"); + + /** Static value Large for SizeTypes. */ + public static final SizeTypes LARGE = fromString("Large"); + + /** + * Creates or finds a SizeTypes from its string representation. + * + * @param name a name to look for. + * @return the corresponding SizeTypes. + */ + @JsonCreator + public static SizeTypes fromString(String name) { + return fromString(name, SizeTypes.class); + } + + /** + * Gets known SizeTypes values. + * + * @return known SizeTypes values. + */ + public static Collection values() { + return values(SizeTypes.class); + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/TcpConfig.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/TcpConfig.java new file mode 100644 index 0000000000000..0d316a3764d2c --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/TcpConfig.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.servicefabricmesh.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes the tcp configuration for external connectivity for this network. */ +@Fluent +public final class TcpConfig { + /* + * tcp gateway config name. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * Specifies the port at which the service endpoint below needs to be + * exposed. + */ + @JsonProperty(value = "port", required = true) + private int port; + + /* + * Describes destination endpoint for routing traffic. + */ + @JsonProperty(value = "destination", required = true) + private GatewayDestination destination; + + /** + * Get the name property: tcp gateway config name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: tcp gateway config name. + * + * @param name the name value to set. + * @return the TcpConfig object itself. + */ + public TcpConfig withName(String name) { + this.name = name; + return this; + } + + /** + * Get the port property: Specifies the port at which the service endpoint below needs to be exposed. + * + * @return the port value. + */ + public int port() { + return this.port; + } + + /** + * Set the port property: Specifies the port at which the service endpoint below needs to be exposed. + * + * @param port the port value to set. + * @return the TcpConfig object itself. + */ + public TcpConfig withPort(int port) { + this.port = port; + return this; + } + + /** + * Get the destination property: Describes destination endpoint for routing traffic. + * + * @return the destination value. + */ + public GatewayDestination destination() { + return this.destination; + } + + /** + * Set the destination property: Describes destination endpoint for routing traffic. + * + * @param destination the destination value to set. + * @return the TcpConfig object itself. + */ + public TcpConfig withDestination(GatewayDestination destination) { + this.destination = destination; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw LOGGER + .logExceptionAsError(new IllegalArgumentException("Missing required property name in model TcpConfig")); + } + if (destination() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property destination in model TcpConfig")); + } else { + destination().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(TcpConfig.class); +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/VolumeProperties.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/VolumeProperties.java new file mode 100644 index 0000000000000..37418e06163f4 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/VolumeProperties.java @@ -0,0 +1,139 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes properties of a volume resource. */ +@Fluent +public class VolumeProperties { + /* + * User readable description of the volume. + */ + @JsonProperty(value = "description") + private String description; + + /* + * Status of the volume. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private ResourceStatus status; + + /* + * Gives additional information about the current status of the volume. + */ + @JsonProperty(value = "statusDetails", access = JsonProperty.Access.WRITE_ONLY) + private String statusDetails; + + /* + * Provider of the volume. + */ + @JsonProperty(value = "provider", required = true) + private VolumeProvider provider; + + /* + * This type describes a volume provided by an Azure Files file share. + */ + @JsonProperty(value = "azureFileParameters") + private VolumeProviderParametersAzureFile azureFileParameters; + + /** + * Get the description property: User readable description of the volume. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: User readable description of the volume. + * + * @param description the description value to set. + * @return the VolumeProperties object itself. + */ + public VolumeProperties withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the status property: Status of the volume. + * + * @return the status value. + */ + public ResourceStatus status() { + return this.status; + } + + /** + * Get the statusDetails property: Gives additional information about the current status of the volume. + * + * @return the statusDetails value. + */ + public String statusDetails() { + return this.statusDetails; + } + + /** + * Get the provider property: Provider of the volume. + * + * @return the provider value. + */ + public VolumeProvider provider() { + return this.provider; + } + + /** + * Set the provider property: Provider of the volume. + * + * @param provider the provider value to set. + * @return the VolumeProperties object itself. + */ + public VolumeProperties withProvider(VolumeProvider provider) { + this.provider = provider; + return this; + } + + /** + * Get the azureFileParameters property: This type describes a volume provided by an Azure Files file share. + * + * @return the azureFileParameters value. + */ + public VolumeProviderParametersAzureFile azureFileParameters() { + return this.azureFileParameters; + } + + /** + * Set the azureFileParameters property: This type describes a volume provided by an Azure Files file share. + * + * @param azureFileParameters the azureFileParameters value to set. + * @return the VolumeProperties object itself. + */ + public VolumeProperties withAzureFileParameters(VolumeProviderParametersAzureFile azureFileParameters) { + this.azureFileParameters = azureFileParameters; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (provider() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property provider in model VolumeProperties")); + } + if (azureFileParameters() != null) { + azureFileParameters().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(VolumeProperties.class); +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/VolumeProvider.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/VolumeProvider.java new file mode 100644 index 0000000000000..702fac0365b9b --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/VolumeProvider.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for VolumeProvider. */ +public final class VolumeProvider extends ExpandableStringEnum { + /** Static value SFAzureFile for VolumeProvider. */ + public static final VolumeProvider SFAZURE_FILE = fromString("SFAzureFile"); + + /** + * Creates or finds a VolumeProvider from its string representation. + * + * @param name a name to look for. + * @return the corresponding VolumeProvider. + */ + @JsonCreator + public static VolumeProvider fromString(String name) { + return fromString(name, VolumeProvider.class); + } + + /** + * Gets known VolumeProvider values. + * + * @return known VolumeProvider values. + */ + public static Collection values() { + return values(VolumeProvider.class); + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/VolumeProviderParametersAzureFile.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/VolumeProviderParametersAzureFile.java new file mode 100644 index 0000000000000..717d8d9e4fcf1 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/VolumeProviderParametersAzureFile.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.servicefabricmesh.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** This type describes a volume provided by an Azure Files file share. */ +@Fluent +public final class VolumeProviderParametersAzureFile { + /* + * Name of the Azure storage account for the File Share. + */ + @JsonProperty(value = "accountName", required = true) + private String accountName; + + /* + * Access key of the Azure storage account for the File Share. + */ + @JsonProperty(value = "accountKey") + private String accountKey; + + /* + * Name of the Azure Files file share that provides storage for the volume. + */ + @JsonProperty(value = "shareName", required = true) + private String shareName; + + /** + * Get the accountName property: Name of the Azure storage account for the File Share. + * + * @return the accountName value. + */ + public String accountName() { + return this.accountName; + } + + /** + * Set the accountName property: Name of the Azure storage account for the File Share. + * + * @param accountName the accountName value to set. + * @return the VolumeProviderParametersAzureFile object itself. + */ + public VolumeProviderParametersAzureFile withAccountName(String accountName) { + this.accountName = accountName; + return this; + } + + /** + * Get the accountKey property: Access key of the Azure storage account for the File Share. + * + * @return the accountKey value. + */ + public String accountKey() { + return this.accountKey; + } + + /** + * Set the accountKey property: Access key of the Azure storage account for the File Share. + * + * @param accountKey the accountKey value to set. + * @return the VolumeProviderParametersAzureFile object itself. + */ + public VolumeProviderParametersAzureFile withAccountKey(String accountKey) { + this.accountKey = accountKey; + return this; + } + + /** + * Get the shareName property: Name of the Azure Files file share that provides storage for the volume. + * + * @return the shareName value. + */ + public String shareName() { + return this.shareName; + } + + /** + * Set the shareName property: Name of the Azure Files file share that provides storage for the volume. + * + * @param shareName the shareName value to set. + * @return the VolumeProviderParametersAzureFile object itself. + */ + public VolumeProviderParametersAzureFile withShareName(String shareName) { + this.shareName = shareName; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (accountName() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property accountName in model VolumeProviderParametersAzureFile")); + } + if (shareName() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property shareName in model VolumeProviderParametersAzureFile")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(VolumeProviderParametersAzureFile.class); +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/VolumeReference.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/VolumeReference.java new file mode 100644 index 0000000000000..cc928dfe93e0d --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/VolumeReference.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.servicefabricmesh.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes a reference to a volume resource. */ +@Fluent +public class VolumeReference { + /* + * Name of the volume being referenced. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * The flag indicating whether the volume is read only. Default is 'false'. + */ + @JsonProperty(value = "readOnly") + private Boolean readOnly; + + /* + * The path within the container at which the volume should be mounted. + * Only valid path characters are allowed. + */ + @JsonProperty(value = "destinationPath", required = true) + private String destinationPath; + + /** + * Get the name property: Name of the volume being referenced. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name of the volume being referenced. + * + * @param name the name value to set. + * @return the VolumeReference object itself. + */ + public VolumeReference withName(String name) { + this.name = name; + return this; + } + + /** + * Get the readOnly property: The flag indicating whether the volume is read only. Default is 'false'. + * + * @return the readOnly value. + */ + public Boolean readOnly() { + return this.readOnly; + } + + /** + * Set the readOnly property: The flag indicating whether the volume is read only. Default is 'false'. + * + * @param readOnly the readOnly value to set. + * @return the VolumeReference object itself. + */ + public VolumeReference withReadOnly(Boolean readOnly) { + this.readOnly = readOnly; + return this; + } + + /** + * Get the destinationPath property: The path within the container at which the volume should be mounted. Only valid + * path characters are allowed. + * + * @return the destinationPath value. + */ + public String destinationPath() { + return this.destinationPath; + } + + /** + * Set the destinationPath property: The path within the container at which the volume should be mounted. Only valid + * path characters are allowed. + * + * @param destinationPath the destinationPath value to set. + * @return the VolumeReference object itself. + */ + public VolumeReference withDestinationPath(String destinationPath) { + this.destinationPath = destinationPath; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property name in model VolumeReference")); + } + if (destinationPath() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property destinationPath in model VolumeReference")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(VolumeReference.class); +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/VolumeResourceDescription.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/VolumeResourceDescription.java new file mode 100644 index 0000000000000..6ba8f4926bb98 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/VolumeResourceDescription.java @@ -0,0 +1,232 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.servicefabricmesh.fluent.models.VolumeResourceDescriptionInner; +import java.util.Map; + +/** An immutable client-side representation of VolumeResourceDescription. */ +public interface VolumeResourceDescription { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the description property: User readable description of the volume. + * + * @return the description value. + */ + String description(); + + /** + * Gets the status property: Status of the volume. + * + * @return the status value. + */ + ResourceStatus status(); + + /** + * Gets the statusDetails property: Gives additional information about the current status of the volume. + * + * @return the statusDetails value. + */ + String statusDetails(); + + /** + * Gets the provider property: Provider of the volume. + * + * @return the provider value. + */ + VolumeProvider provider(); + + /** + * Gets the azureFileParameters property: This type describes a volume provided by an Azure Files file share. + * + * @return the azureFileParameters value. + */ + VolumeProviderParametersAzureFile azureFileParameters(); + + /** + * Gets the provisioningState property: State of the resource. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.servicefabricmesh.fluent.models.VolumeResourceDescriptionInner object. + * + * @return the inner object. + */ + VolumeResourceDescriptionInner innerModel(); + + /** The entirety of the VolumeResourceDescription definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithProvider, + DefinitionStages.WithCreate { + } + /** The VolumeResourceDescription definition stages. */ + interface DefinitionStages { + /** The first stage of the VolumeResourceDescription definition. */ + interface Blank extends WithLocation { + } + /** The stage of the VolumeResourceDescription definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + /** The stage of the VolumeResourceDescription definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName Azure resource group name. + * @return the next definition stage. + */ + WithProvider withExistingResourceGroup(String resourceGroupName); + } + /** The stage of the VolumeResourceDescription definition allowing to specify provider. */ + interface WithProvider { + /** + * Specifies the provider property: Provider of the volume.. + * + * @param provider Provider of the volume. + * @return the next definition stage. + */ + WithCreate withProvider(VolumeProvider provider); + } + /** + * The stage of the VolumeResourceDescription definition which contains all the minimum required properties for + * the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, + DefinitionStages.WithDescription, + DefinitionStages.WithAzureFileParameters { + /** + * Executes the create request. + * + * @return the created resource. + */ + VolumeResourceDescription create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + VolumeResourceDescription create(Context context); + } + /** The stage of the VolumeResourceDescription definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the VolumeResourceDescription definition allowing to specify description. */ + interface WithDescription { + /** + * Specifies the description property: User readable description of the volume.. + * + * @param description User readable description of the volume. + * @return the next definition stage. + */ + WithCreate withDescription(String description); + } + /** The stage of the VolumeResourceDescription definition allowing to specify azureFileParameters. */ + interface WithAzureFileParameters { + /** + * Specifies the azureFileParameters property: This type describes a volume provided by an Azure Files file + * share.. + * + * @param azureFileParameters This type describes a volume provided by an Azure Files file share. + * @return the next definition stage. + */ + WithCreate withAzureFileParameters(VolumeProviderParametersAzureFile azureFileParameters); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + VolumeResourceDescription refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + VolumeResourceDescription refresh(Context context); +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/VolumeResourceDescriptionList.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/VolumeResourceDescriptionList.java new file mode 100644 index 0000000000000..4e388c1f2623f --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/VolumeResourceDescriptionList.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.servicefabricmesh.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.servicefabricmesh.fluent.models.VolumeResourceDescriptionInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A pageable list of volume resources. */ +@Fluent +public final class VolumeResourceDescriptionList { + /* + * One page of the list. + */ + @JsonProperty(value = "value") + private List value; + + /* + * URI to fetch the next page of the list. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: One page of the list. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: One page of the list. + * + * @param value the value value to set. + * @return the VolumeResourceDescriptionList object itself. + */ + public VolumeResourceDescriptionList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: URI to fetch the next page of the list. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: URI to fetch the next page of the list. + * + * @param nextLink the nextLink value to set. + * @return the VolumeResourceDescriptionList object itself. + */ + public VolumeResourceDescriptionList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/Volumes.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/Volumes.java new file mode 100644 index 0000000000000..2940672f47b6b --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/Volumes.java @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.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 Volumes. */ +public interface Volumes { + /** + * Gets the information about the volume resource with the given name. The information include the description and + * other properties of the volume. + * + * @param resourceGroupName Azure resource group name. + * @param volumeResourceName The identity of the volume. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about the volume resource with the given name. + */ + VolumeResourceDescription getByResourceGroup(String resourceGroupName, String volumeResourceName); + + /** + * Gets the information about the volume resource with the given name. The information include the description and + * other properties of the volume. + * + * @param resourceGroupName Azure resource group name. + * @param volumeResourceName The identity of the volume. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about the volume resource with the given name along with {@link Response}. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String volumeResourceName, Context context); + + /** + * Deletes the volume resource identified by the name. + * + * @param resourceGroupName Azure resource group name. + * @param volumeResourceName The identity of the volume. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String volumeResourceName); + + /** + * Deletes the volume resource identified by the name. + * + * @param resourceGroupName Azure resource group name. + * @param volumeResourceName The identity of the volume. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException 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 volumeResourceName, Context context); + + /** + * Gets the information about all volume resources in a given resource group. The information include the + * description and other properties of the Volume. + * + * @param resourceGroupName Azure resource group name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all volume resources in a given resource group as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Gets the information about all volume resources in a given resource group. The information include the + * description and other properties of the Volume. + * + * @param resourceGroupName Azure resource group name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all volume resources in a given resource group as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Gets the information about all volume resources in a given resource group. The information include the + * description and other properties of the volume. + * + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all volume resources in a given resource group as paginated response with {@link + * PagedIterable}. + */ + PagedIterable list(); + + /** + * Gets the information about all volume resources in a given resource group. The information include the + * description and other properties of the volume. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about all volume resources in a given resource group as paginated response with {@link + * PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Gets the information about the volume resource with the given name. The information include the description and + * other properties of the volume. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about the volume resource with the given name along with {@link Response}. + */ + VolumeResourceDescription getById(String id); + + /** + * Gets the information about the volume resource with the given name. The information include the description and + * other properties of the volume. + * + * @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.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information about the volume resource with the given name along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes the volume resource identified by the name. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.servicefabricmesh.models.ErrorErrorModelException thrown if the request is + * rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes the volume resource identified by the name. + * + * @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.resourcemanager.servicefabricmesh.models.ErrorErrorModelException 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 VolumeResourceDescription resource. + * + * @param name resource name. + * @return the first stage of the new VolumeResourceDescription definition. + */ + VolumeResourceDescription.DefinitionStages.Blank define(String name); +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/package-info.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/package-info.java new file mode 100644 index 0000000000000..07b708af72f0f --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/models/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the data models for ServiceFabricMeshManagementClient. Service Fabric Mesh Management Client. */ +package com.azure.resourcemanager.servicefabricmesh.models; diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/package-info.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/package-info.java new file mode 100644 index 0000000000000..fd8c00e16b7d1 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/com/azure/resourcemanager/servicefabricmesh/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the classes for ServiceFabricMeshManagementClient. Service Fabric Mesh Management Client. */ +package com.azure.resourcemanager.servicefabricmesh; diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/module-info.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/module-info.java new file mode 100644 index 0000000000000..8d1f55da70f4a --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/main/java/module-info.java @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +module com.azure.resourcemanager.servicefabricmesh { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.servicefabricmesh; + exports com.azure.resourcemanager.servicefabricmesh.fluent; + exports com.azure.resourcemanager.servicefabricmesh.fluent.models; + exports com.azure.resourcemanager.servicefabricmesh.models; + + opens com.azure.resourcemanager.servicefabricmesh.fluent.models to + com.azure.core, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.servicefabricmesh.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/ApplicationCreateSamples.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/ApplicationCreateSamples.java new file mode 100644 index 0000000000000..88cab863b7209 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/ApplicationCreateSamples.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.generated; + +import com.azure.resourcemanager.servicefabricmesh.fluent.models.ServiceResourceDescriptionInner; +import com.azure.resourcemanager.servicefabricmesh.models.ContainerCodePackageProperties; +import com.azure.resourcemanager.servicefabricmesh.models.EndpointProperties; +import com.azure.resourcemanager.servicefabricmesh.models.EndpointRef; +import com.azure.resourcemanager.servicefabricmesh.models.NetworkRef; +import com.azure.resourcemanager.servicefabricmesh.models.OperatingSystemType; +import com.azure.resourcemanager.servicefabricmesh.models.ResourceRequests; +import com.azure.resourcemanager.servicefabricmesh.models.ResourceRequirements; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Application Create. */ +public final class ApplicationCreateSamples { + /* + * x-ms-original-file: specification/servicefabricmesh/resource-manager/Microsoft.ServiceFabricMesh/preview/2018-09-01-preview/examples/applications/create_update.json + */ + /** + * Sample code: CreateOrUpdateApplication. + * + * @param manager Entry point to ServiceFabricMeshManager. + */ + public static void createOrUpdateApplication( + com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager) { + manager + .applications() + .define("sampleApplication") + .withRegion("EastUS") + .withExistingResourceGroup("sbz_demo") + .withTags(mapOf()) + .withDescription("Service Fabric Mesh sample application.") + .withServices( + Arrays + .asList( + new ServiceResourceDescriptionInner() + .withName("helloWorldService") + .withOsType(OperatingSystemType.LINUX) + .withCodePackages( + Arrays + .asList( + new ContainerCodePackageProperties() + .withName("helloWorldCode") + .withImage("seabreeze/sbz-helloworld:1.0-alpine") + .withEndpoints( + Arrays + .asList( + new EndpointProperties() + .withName("helloWorldListener") + .withPort(80))) + .withResources( + new ResourceRequirements() + .withRequests( + new ResourceRequests().withMemoryInGB(1.0).withCpu(1.0))))) + .withNetworkRefs( + Arrays + .asList( + new NetworkRef() + .withName( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/sbz_demo/providers/Microsoft.ServiceFabricMesh/networks/sampleNetwork") + .withEndpointRefs( + Arrays.asList(new EndpointRef().withName("helloWorldListener"))))) + .withDescription("SeaBreeze Hello World Service.") + .withReplicaCount(1))) + .create(); + } + + @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/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/ApplicationDeleteSamples.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/ApplicationDeleteSamples.java new file mode 100644 index 0000000000000..7ec6c2de1e300 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/ApplicationDeleteSamples.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.servicefabricmesh.generated; + +import com.azure.core.util.Context; + +/** Samples for Application Delete. */ +public final class ApplicationDeleteSamples { + /* + * x-ms-original-file: specification/servicefabricmesh/resource-manager/Microsoft.ServiceFabricMesh/preview/2018-09-01-preview/examples/applications/delete.json + */ + /** + * Sample code: DeleteApplication. + * + * @param manager Entry point to ServiceFabricMeshManager. + */ + public static void deleteApplication(com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager) { + manager.applications().deleteWithResponse("sbz_demo", "sampleApplication", Context.NONE); + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/ApplicationGetByResourceGroupSamples.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/ApplicationGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..c83c10dcb7d1d --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/ApplicationGetByResourceGroupSamples.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.servicefabricmesh.generated; + +import com.azure.core.util.Context; + +/** Samples for Application GetByResourceGroup. */ +public final class ApplicationGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/servicefabricmesh/resource-manager/Microsoft.ServiceFabricMesh/preview/2018-09-01-preview/examples/applications/get.json + */ + /** + * Sample code: GetApplication. + * + * @param manager Entry point to ServiceFabricMeshManager. + */ + public static void getApplication(com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager) { + manager.applications().getByResourceGroupWithResponse("sbz_demo", "sampleApplication", Context.NONE); + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/ApplicationListByResourceGroupSamples.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/ApplicationListByResourceGroupSamples.java new file mode 100644 index 0000000000000..2eee6bc217317 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/ApplicationListByResourceGroupSamples.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.servicefabricmesh.generated; + +import com.azure.core.util.Context; + +/** Samples for Application ListByResourceGroup. */ +public final class ApplicationListByResourceGroupSamples { + /* + * x-ms-original-file: specification/servicefabricmesh/resource-manager/Microsoft.ServiceFabricMesh/preview/2018-09-01-preview/examples/applications/list_byResourceGroup.json + */ + /** + * Sample code: ListApplicationsByResourceGroup. + * + * @param manager Entry point to ServiceFabricMeshManager. + */ + public static void listApplicationsByResourceGroup( + com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager) { + manager.applications().listByResourceGroup("sbz_demo", Context.NONE); + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/ApplicationListSamples.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/ApplicationListSamples.java new file mode 100644 index 0000000000000..d6e3355774ba1 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/ApplicationListSamples.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.servicefabricmesh.generated; + +import com.azure.core.util.Context; + +/** Samples for Application List. */ +public final class ApplicationListSamples { + /* + * x-ms-original-file: specification/servicefabricmesh/resource-manager/Microsoft.ServiceFabricMesh/preview/2018-09-01-preview/examples/applications/list_bySubscriptionId.json + */ + /** + * Sample code: ListApplicationsBySubscriptionId. + * + * @param manager Entry point to ServiceFabricMeshManager. + */ + public static void listApplicationsBySubscriptionId( + com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager) { + manager.applications().list(Context.NONE); + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/CodePackageGetContainerLogsSamples.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/CodePackageGetContainerLogsSamples.java new file mode 100644 index 0000000000000..9f91c125b2788 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/CodePackageGetContainerLogsSamples.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.servicefabricmesh.generated; + +import com.azure.core.util.Context; + +/** Samples for CodePackage GetContainerLogs. */ +public final class CodePackageGetContainerLogsSamples { + /* + * x-ms-original-file: specification/servicefabricmesh/resource-manager/Microsoft.ServiceFabricMesh/preview/2018-09-01-preview/examples/applications/services/replicas/codepackages/get_logs.json + */ + /** + * Sample code: GetContainerLogs. + * + * @param manager Entry point to ServiceFabricMeshManager. + */ + public static void getContainerLogs(com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager) { + manager + .codePackages() + .getContainerLogsWithResponse( + "sbz_demo", "sbzDocApp", "sbzDocService", "0", "sbzDocCode", null, Context.NONE); + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/GatewayCreateSamples.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/GatewayCreateSamples.java new file mode 100644 index 0000000000000..46285e9b5f854 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/GatewayCreateSamples.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.servicefabricmesh.generated; + +import com.azure.resourcemanager.servicefabricmesh.models.GatewayDestination; +import com.azure.resourcemanager.servicefabricmesh.models.HeaderMatchType; +import com.azure.resourcemanager.servicefabricmesh.models.HttpConfig; +import com.azure.resourcemanager.servicefabricmesh.models.HttpHostConfig; +import com.azure.resourcemanager.servicefabricmesh.models.HttpRouteConfig; +import com.azure.resourcemanager.servicefabricmesh.models.HttpRouteMatchHeader; +import com.azure.resourcemanager.servicefabricmesh.models.HttpRouteMatchPath; +import com.azure.resourcemanager.servicefabricmesh.models.HttpRouteMatchRule; +import com.azure.resourcemanager.servicefabricmesh.models.NetworkRef; +import com.azure.resourcemanager.servicefabricmesh.models.PathMatchType; +import com.azure.resourcemanager.servicefabricmesh.models.TcpConfig; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Gateway Create. */ +public final class GatewayCreateSamples { + /* + * x-ms-original-file: specification/servicefabricmesh/resource-manager/Microsoft.ServiceFabricMesh/preview/2018-09-01-preview/examples/gateways/create_update.json + */ + /** + * Sample code: CreateOrUpdateGateway. + * + * @param manager Entry point to ServiceFabricMeshManager. + */ + public static void createOrUpdateGateway( + com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager) { + manager + .gateways() + .define("sampleGateway") + .withRegion("EastUS") + .withExistingResourceGroup("sbz_demo") + .withSourceNetwork(new NetworkRef().withName("Open")) + .withDestinationNetwork(new NetworkRef().withName("helloWorldNetwork")) + .withTags(mapOf()) + .withDescription("Service Fabric Mesh sample gateway.") + .withTcp( + Arrays + .asList( + new TcpConfig() + .withName("web") + .withPort(80) + .withDestination( + new GatewayDestination() + .withApplicationName("helloWorldApp") + .withServiceName("helloWorldService") + .withEndpointName("helloWorldListener")))) + .withHttp( + Arrays + .asList( + new HttpConfig() + .withName("contosoWebsite") + .withPort(8081) + .withHosts( + Arrays + .asList( + new HttpHostConfig() + .withName("contoso.com") + .withRoutes( + Arrays + .asList( + new HttpRouteConfig() + .withName("index") + .withMatch( + new HttpRouteMatchRule() + .withPath( + new HttpRouteMatchPath() + .withValue("/index") + .withRewrite("/") + .withType(PathMatchType.PREFIX)) + .withHeaders( + Arrays + .asList( + new HttpRouteMatchHeader() + .withName("accept") + .withValue("application/json") + .withType(HeaderMatchType.EXACT)))) + .withDestination( + new GatewayDestination() + .withApplicationName("httpHelloWorldApp") + .withServiceName("indexService") + .withEndpointName("indexHttpEndpoint")))))))) + .create(); + } + + @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/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/GatewayDeleteSamples.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/GatewayDeleteSamples.java new file mode 100644 index 0000000000000..47c99cf65c777 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/GatewayDeleteSamples.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.servicefabricmesh.generated; + +import com.azure.core.util.Context; + +/** Samples for Gateway Delete. */ +public final class GatewayDeleteSamples { + /* + * x-ms-original-file: specification/servicefabricmesh/resource-manager/Microsoft.ServiceFabricMesh/preview/2018-09-01-preview/examples/gateways/delete.json + */ + /** + * Sample code: DeleteGateway. + * + * @param manager Entry point to ServiceFabricMeshManager. + */ + public static void deleteGateway(com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager) { + manager.gateways().deleteWithResponse("sbz_demo", "sampleGateway", Context.NONE); + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/GatewayGetByResourceGroupSamples.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/GatewayGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..0ee37ad3f5d34 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/GatewayGetByResourceGroupSamples.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.servicefabricmesh.generated; + +import com.azure.core.util.Context; + +/** Samples for Gateway GetByResourceGroup. */ +public final class GatewayGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/servicefabricmesh/resource-manager/Microsoft.ServiceFabricMesh/preview/2018-09-01-preview/examples/gateways/get.json + */ + /** + * Sample code: GetGateway. + * + * @param manager Entry point to ServiceFabricMeshManager. + */ + public static void getGateway(com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager) { + manager.gateways().getByResourceGroupWithResponse("sbz_demo", "sampleGateway", Context.NONE); + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/GatewayListByResourceGroupSamples.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/GatewayListByResourceGroupSamples.java new file mode 100644 index 0000000000000..f3048f00a4ae6 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/GatewayListByResourceGroupSamples.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.servicefabricmesh.generated; + +import com.azure.core.util.Context; + +/** Samples for Gateway ListByResourceGroup. */ +public final class GatewayListByResourceGroupSamples { + /* + * x-ms-original-file: specification/servicefabricmesh/resource-manager/Microsoft.ServiceFabricMesh/preview/2018-09-01-preview/examples/gateways/list_byResourceGroup.json + */ + /** + * Sample code: ListGatewaysByResourceGroup. + * + * @param manager Entry point to ServiceFabricMeshManager. + */ + public static void listGatewaysByResourceGroup( + com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager) { + manager.gateways().listByResourceGroup("sbz_demo", Context.NONE); + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/GatewayListSamples.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/GatewayListSamples.java new file mode 100644 index 0000000000000..dae32b89c1e64 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/GatewayListSamples.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.servicefabricmesh.generated; + +import com.azure.core.util.Context; + +/** Samples for Gateway List. */ +public final class GatewayListSamples { + /* + * x-ms-original-file: specification/servicefabricmesh/resource-manager/Microsoft.ServiceFabricMesh/preview/2018-09-01-preview/examples/gateways/list_bySubscriptionId.json + */ + /** + * Sample code: ListGatewaysBySubscriptionId. + * + * @param manager Entry point to ServiceFabricMeshManager. + */ + public static void listGatewaysBySubscriptionId( + com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager) { + manager.gateways().list(Context.NONE); + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/NetworkCreateSamples.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/NetworkCreateSamples.java new file mode 100644 index 0000000000000..057cac16a8225 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/NetworkCreateSamples.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.servicefabricmesh.generated; + +import com.azure.resourcemanager.servicefabricmesh.models.LocalNetworkResourceProperties; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Network Create. */ +public final class NetworkCreateSamples { + /* + * x-ms-original-file: specification/servicefabricmesh/resource-manager/Microsoft.ServiceFabricMesh/preview/2018-09-01-preview/examples/networks/create_update.json + */ + /** + * Sample code: CreateOrUpdateNetwork. + * + * @param manager Entry point to ServiceFabricMeshManager. + */ + public static void createOrUpdateNetwork( + com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager) { + manager + .networks() + .define("sampleNetwork") + .withRegion("EastUS") + .withExistingResourceGroup("sbz_demo") + .withProperties( + new LocalNetworkResourceProperties() + .withDescription("Service Fabric Mesh sample network.") + .withNetworkAddressPrefix("2.0.0.0/16")) + .withTags(mapOf()) + .create(); + } + + @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/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/NetworkDeleteSamples.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/NetworkDeleteSamples.java new file mode 100644 index 0000000000000..550fbd3ba4adb --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/NetworkDeleteSamples.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.servicefabricmesh.generated; + +import com.azure.core.util.Context; + +/** Samples for Network Delete. */ +public final class NetworkDeleteSamples { + /* + * x-ms-original-file: specification/servicefabricmesh/resource-manager/Microsoft.ServiceFabricMesh/preview/2018-09-01-preview/examples/networks/delete.json + */ + /** + * Sample code: DeleteNetwork. + * + * @param manager Entry point to ServiceFabricMeshManager. + */ + public static void deleteNetwork(com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager) { + manager.networks().deleteWithResponse("sbz_demo", "sampleNetwork", Context.NONE); + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/NetworkGetByResourceGroupSamples.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/NetworkGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..bf043a45c9554 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/NetworkGetByResourceGroupSamples.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.servicefabricmesh.generated; + +import com.azure.core.util.Context; + +/** Samples for Network GetByResourceGroup. */ +public final class NetworkGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/servicefabricmesh/resource-manager/Microsoft.ServiceFabricMesh/preview/2018-09-01-preview/examples/networks/get.json + */ + /** + * Sample code: GetNetwork. + * + * @param manager Entry point to ServiceFabricMeshManager. + */ + public static void getNetwork(com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager) { + manager.networks().getByResourceGroupWithResponse("sbz_demo", "sampleNetwork", Context.NONE); + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/NetworkListByResourceGroupSamples.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/NetworkListByResourceGroupSamples.java new file mode 100644 index 0000000000000..0192d145e1321 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/NetworkListByResourceGroupSamples.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.servicefabricmesh.generated; + +import com.azure.core.util.Context; + +/** Samples for Network ListByResourceGroup. */ +public final class NetworkListByResourceGroupSamples { + /* + * x-ms-original-file: specification/servicefabricmesh/resource-manager/Microsoft.ServiceFabricMesh/preview/2018-09-01-preview/examples/networks/list_byResourceGroup.json + */ + /** + * Sample code: ListNetworksByResourceGroup. + * + * @param manager Entry point to ServiceFabricMeshManager. + */ + public static void listNetworksByResourceGroup( + com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager) { + manager.networks().listByResourceGroup("sbz_demo", Context.NONE); + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/NetworkListSamples.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/NetworkListSamples.java new file mode 100644 index 0000000000000..7840594d7c8e0 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/NetworkListSamples.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.servicefabricmesh.generated; + +import com.azure.core.util.Context; + +/** Samples for Network List. */ +public final class NetworkListSamples { + /* + * x-ms-original-file: specification/servicefabricmesh/resource-manager/Microsoft.ServiceFabricMesh/preview/2018-09-01-preview/examples/networks/list_bySubscriptionId.json + */ + /** + * Sample code: ListNetworksBySubscriptionId. + * + * @param manager Entry point to ServiceFabricMeshManager. + */ + public static void listNetworksBySubscriptionId( + com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager) { + manager.networks().list(Context.NONE); + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/SecretCreateSamples.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/SecretCreateSamples.java new file mode 100644 index 0000000000000..259ff5cd21468 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/SecretCreateSamples.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.servicefabricmesh.generated; + +import com.azure.resourcemanager.servicefabricmesh.models.InlinedValueSecretResourceProperties; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Secret Create. */ +public final class SecretCreateSamples { + /* + * x-ms-original-file: specification/servicefabricmesh/resource-manager/Microsoft.ServiceFabricMesh/preview/2018-09-01-preview/examples/secrets/create_update.json + */ + /** + * Sample code: CreateOrUpdateSecret. + * + * @param manager Entry point to ServiceFabricMeshManager. + */ + public static void createOrUpdateSecret( + com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager) { + manager + .secrets() + .define("dbConnectionString") + .withRegion("EastUS") + .withExistingResourceGroup("sbz_demo") + .withProperties( + new InlinedValueSecretResourceProperties() + .withDescription("Mongo DB connection string for backend database!") + .withContentType("text/plain")) + .withTags(mapOf()) + .create(); + } + + @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/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/SecretDeleteSamples.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/SecretDeleteSamples.java new file mode 100644 index 0000000000000..877fe2e03da13 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/SecretDeleteSamples.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.servicefabricmesh.generated; + +import com.azure.core.util.Context; + +/** Samples for Secret Delete. */ +public final class SecretDeleteSamples { + /* + * x-ms-original-file: specification/servicefabricmesh/resource-manager/Microsoft.ServiceFabricMesh/preview/2018-09-01-preview/examples/secrets/delete.json + */ + /** + * Sample code: DeleteSecret. + * + * @param manager Entry point to ServiceFabricMeshManager. + */ + public static void deleteSecret(com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager) { + manager.secrets().deleteWithResponse("sbz_demo", "dbConnectionString", Context.NONE); + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/SecretGetByResourceGroupSamples.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/SecretGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..4ba6a7baaae2f --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/SecretGetByResourceGroupSamples.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.servicefabricmesh.generated; + +import com.azure.core.util.Context; + +/** Samples for Secret GetByResourceGroup. */ +public final class SecretGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/servicefabricmesh/resource-manager/Microsoft.ServiceFabricMesh/preview/2018-09-01-preview/examples/secrets/get.json + */ + /** + * Sample code: GetSecret. + * + * @param manager Entry point to ServiceFabricMeshManager. + */ + public static void getSecret(com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager) { + manager.secrets().getByResourceGroupWithResponse("sbz_demo", "dbConnectionString", Context.NONE); + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/SecretListByResourceGroupSamples.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/SecretListByResourceGroupSamples.java new file mode 100644 index 0000000000000..d6167ecf08c07 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/SecretListByResourceGroupSamples.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.servicefabricmesh.generated; + +import com.azure.core.util.Context; + +/** Samples for Secret ListByResourceGroup. */ +public final class SecretListByResourceGroupSamples { + /* + * x-ms-original-file: specification/servicefabricmesh/resource-manager/Microsoft.ServiceFabricMesh/preview/2018-09-01-preview/examples/secrets/list_byResourceGroup.json + */ + /** + * Sample code: ListSecretsByResourceGroup. + * + * @param manager Entry point to ServiceFabricMeshManager. + */ + public static void listSecretsByResourceGroup( + com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager) { + manager.secrets().listByResourceGroup("sbz_demo", Context.NONE); + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/SecretListSamples.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/SecretListSamples.java new file mode 100644 index 0000000000000..c9bdc8b5fbf4e --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/SecretListSamples.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.servicefabricmesh.generated; + +import com.azure.core.util.Context; + +/** Samples for Secret List. */ +public final class SecretListSamples { + /* + * x-ms-original-file: specification/servicefabricmesh/resource-manager/Microsoft.ServiceFabricMesh/preview/2018-09-01-preview/examples/secrets/list_bySubscriptionId.json + */ + /** + * Sample code: ListSecretsBySubscriptionId. + * + * @param manager Entry point to ServiceFabricMeshManager. + */ + public static void listSecretsBySubscriptionId( + com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager) { + manager.secrets().list(Context.NONE); + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/SecretValueCreateSamples.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/SecretValueCreateSamples.java new file mode 100644 index 0000000000000..86773e87b47fb --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/SecretValueCreateSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.servicefabricmesh.generated; + +/** Samples for SecretValue Create. */ +public final class SecretValueCreateSamples { + /* + * x-ms-original-file: specification/servicefabricmesh/resource-manager/Microsoft.ServiceFabricMesh/preview/2018-09-01-preview/examples/secrets/values/create.json + */ + /** + * Sample code: CreateSecretValue. + * + * @param manager Entry point to ServiceFabricMeshManager. + */ + public static void createSecretValue(com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager) { + manager + .secretValues() + .define("v1") + .withRegion("West US") + .withExistingSecret("sbz_demo", "dbConnectionString") + .withValue( + "mongodb://contoso123:0Fc3IolnL12312asdfawejunASDF@asdfYXX2t8a97kghVcUzcDv98hawelufhawefafnoQRGwNj2nMPL1Y9qsIr9Srdw==@contoso123.documents.azure.com:10255/mydatabase?ssl=true") + .create(); + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/SecretValueDeleteSamples.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/SecretValueDeleteSamples.java new file mode 100644 index 0000000000000..e760816bc6a99 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/SecretValueDeleteSamples.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.servicefabricmesh.generated; + +import com.azure.core.util.Context; + +/** Samples for SecretValue Delete. */ +public final class SecretValueDeleteSamples { + /* + * x-ms-original-file: specification/servicefabricmesh/resource-manager/Microsoft.ServiceFabricMesh/preview/2018-09-01-preview/examples/secrets/values/delete.json + */ + /** + * Sample code: DeleteSecretValue. + * + * @param manager Entry point to ServiceFabricMeshManager. + */ + public static void deleteSecretValue(com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager) { + manager.secretValues().deleteWithResponse("sbz_demo", "dbConnectionString", "v1", Context.NONE); + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/SecretValueGetSamples.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/SecretValueGetSamples.java new file mode 100644 index 0000000000000..297cf75b01687 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/SecretValueGetSamples.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.servicefabricmesh.generated; + +import com.azure.core.util.Context; + +/** Samples for SecretValue Get. */ +public final class SecretValueGetSamples { + /* + * x-ms-original-file: specification/servicefabricmesh/resource-manager/Microsoft.ServiceFabricMesh/preview/2018-09-01-preview/examples/secrets/values/get.json + */ + /** + * Sample code: GetSecretValue. + * + * @param manager Entry point to ServiceFabricMeshManager. + */ + public static void getSecretValue(com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager) { + manager.secretValues().getWithResponse("sbz_demo", "dbConnectionString", "v1", Context.NONE); + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/SecretValueListSamples.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/SecretValueListSamples.java new file mode 100644 index 0000000000000..e8c08461601c9 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/SecretValueListSamples.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.servicefabricmesh.generated; + +import com.azure.core.util.Context; + +/** Samples for SecretValue List. */ +public final class SecretValueListSamples { + /* + * x-ms-original-file: specification/servicefabricmesh/resource-manager/Microsoft.ServiceFabricMesh/preview/2018-09-01-preview/examples/secrets/values/list.json + */ + /** + * Sample code: ListSecretValues. + * + * @param manager Entry point to ServiceFabricMeshManager. + */ + public static void listSecretValues(com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager) { + manager.secretValues().list("sbz_demo", "dbConnectionString", Context.NONE); + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/SecretValueListValueSamples.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/SecretValueListValueSamples.java new file mode 100644 index 0000000000000..522453b5eccbd --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/SecretValueListValueSamples.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.servicefabricmesh.generated; + +import com.azure.core.util.Context; + +/** Samples for SecretValue ListValue. */ +public final class SecretValueListValueSamples { + /* + * x-ms-original-file: specification/servicefabricmesh/resource-manager/Microsoft.ServiceFabricMesh/preview/2018-09-01-preview/examples/secrets/values/list_value.json + */ + /** + * Sample code: ListSecretValue. + * + * @param manager Entry point to ServiceFabricMeshManager. + */ + public static void listSecretValue(com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager) { + manager.secretValues().listValueWithResponse("sbz_demo", "dbConnectionString", "v1", Context.NONE); + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/ServiceGetSamples.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/ServiceGetSamples.java new file mode 100644 index 0000000000000..46ae6c1140bbd --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/ServiceGetSamples.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.servicefabricmesh.generated; + +import com.azure.core.util.Context; + +/** Samples for Service Get. */ +public final class ServiceGetSamples { + /* + * x-ms-original-file: specification/servicefabricmesh/resource-manager/Microsoft.ServiceFabricMesh/preview/2018-09-01-preview/examples/applications/services/get.json + */ + /** + * Sample code: GetService. + * + * @param manager Entry point to ServiceFabricMeshManager. + */ + public static void getService(com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager) { + manager.services().getWithResponse("sbz_demo", "sampleApplication", "helloWorldService", Context.NONE); + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/ServiceListSamples.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/ServiceListSamples.java new file mode 100644 index 0000000000000..bbcd3b2e8ea46 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/ServiceListSamples.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.servicefabricmesh.generated; + +import com.azure.core.util.Context; + +/** Samples for Service List. */ +public final class ServiceListSamples { + /* + * x-ms-original-file: specification/servicefabricmesh/resource-manager/Microsoft.ServiceFabricMesh/preview/2018-09-01-preview/examples/applications/services/list.json + */ + /** + * Sample code: ListServices. + * + * @param manager Entry point to ServiceFabricMeshManager. + */ + public static void listServices(com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager) { + manager.services().list("sbz_demo", "sampleApplication", Context.NONE); + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/ServiceReplicaGetSamples.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/ServiceReplicaGetSamples.java new file mode 100644 index 0000000000000..e638ec94a1ad9 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/ServiceReplicaGetSamples.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.servicefabricmesh.generated; + +import com.azure.core.util.Context; + +/** Samples for ServiceReplica Get. */ +public final class ServiceReplicaGetSamples { + /* + * x-ms-original-file: specification/servicefabricmesh/resource-manager/Microsoft.ServiceFabricMesh/preview/2018-09-01-preview/examples/applications/services/replicas/get.json + */ + /** + * Sample code: ReplicaGet. + * + * @param manager Entry point to ServiceFabricMeshManager. + */ + public static void replicaGet(com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager) { + manager.serviceReplicas().getWithResponse("sbz_demo", "helloWorldApp", "helloWorldService", "0", Context.NONE); + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/ServiceReplicaListSamples.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/ServiceReplicaListSamples.java new file mode 100644 index 0000000000000..1f25a16eefa0a --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/ServiceReplicaListSamples.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.servicefabricmesh.generated; + +import com.azure.core.util.Context; + +/** Samples for ServiceReplica List. */ +public final class ServiceReplicaListSamples { + /* + * x-ms-original-file: specification/servicefabricmesh/resource-manager/Microsoft.ServiceFabricMesh/preview/2018-09-01-preview/examples/applications/services/replicas/list.json + */ + /** + * Sample code: ReplicasGetAll. + * + * @param manager Entry point to ServiceFabricMeshManager. + */ + public static void replicasGetAll(com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager) { + manager.serviceReplicas().list("sbz_demo", "sampleApplication", "helloWorldService", Context.NONE); + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/VolumeCreateSamples.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/VolumeCreateSamples.java new file mode 100644 index 0000000000000..f511ba79ac967 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/VolumeCreateSamples.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.servicefabricmesh.generated; + +import com.azure.resourcemanager.servicefabricmesh.models.VolumeProvider; +import com.azure.resourcemanager.servicefabricmesh.models.VolumeProviderParametersAzureFile; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Volume Create. */ +public final class VolumeCreateSamples { + /* + * x-ms-original-file: specification/servicefabricmesh/resource-manager/Microsoft.ServiceFabricMesh/preview/2018-09-01-preview/examples/volumes/create_update.json + */ + /** + * Sample code: CreateOrUpdateVolume. + * + * @param manager Entry point to ServiceFabricMeshManager. + */ + public static void createOrUpdateVolume( + com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager) { + manager + .volumes() + .define("sampleVolume") + .withRegion("EastUS") + .withExistingResourceGroup("sbz_demo") + .withProvider(VolumeProvider.SFAZURE_FILE) + .withTags(mapOf()) + .withDescription("Service Fabric Mesh sample volume.") + .withAzureFileParameters( + new VolumeProviderParametersAzureFile() + .withAccountName("sbzdemoaccount") + .withAccountKey("provide-account-key-here") + .withShareName("sharel")) + .create(); + } + + @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/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/VolumeDeleteSamples.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/VolumeDeleteSamples.java new file mode 100644 index 0000000000000..7d0c4018e3cdb --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/VolumeDeleteSamples.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.servicefabricmesh.generated; + +import com.azure.core.util.Context; + +/** Samples for Volume Delete. */ +public final class VolumeDeleteSamples { + /* + * x-ms-original-file: specification/servicefabricmesh/resource-manager/Microsoft.ServiceFabricMesh/preview/2018-09-01-preview/examples/volumes/delete.json + */ + /** + * Sample code: DeleteVolume. + * + * @param manager Entry point to ServiceFabricMeshManager. + */ + public static void deleteVolume(com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager) { + manager.volumes().deleteWithResponse("sbz_demo", "sampleVolume", Context.NONE); + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/VolumeGetByResourceGroupSamples.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/VolumeGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..e4e7b7174a91d --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/VolumeGetByResourceGroupSamples.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.servicefabricmesh.generated; + +import com.azure.core.util.Context; + +/** Samples for Volume GetByResourceGroup. */ +public final class VolumeGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/servicefabricmesh/resource-manager/Microsoft.ServiceFabricMesh/preview/2018-09-01-preview/examples/volumes/get.json + */ + /** + * Sample code: GetVolume. + * + * @param manager Entry point to ServiceFabricMeshManager. + */ + public static void getVolume(com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager) { + manager.volumes().getByResourceGroupWithResponse("sbz_demo", "sampleVolume", Context.NONE); + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/VolumeListByResourceGroupSamples.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/VolumeListByResourceGroupSamples.java new file mode 100644 index 0000000000000..43afd5a477d14 --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/VolumeListByResourceGroupSamples.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.servicefabricmesh.generated; + +import com.azure.core.util.Context; + +/** Samples for Volume ListByResourceGroup. */ +public final class VolumeListByResourceGroupSamples { + /* + * x-ms-original-file: specification/servicefabricmesh/resource-manager/Microsoft.ServiceFabricMesh/preview/2018-09-01-preview/examples/volumes/list_byResourceGroup.json + */ + /** + * Sample code: ListVolumesByResourceGroup. + * + * @param manager Entry point to ServiceFabricMeshManager. + */ + public static void listVolumesByResourceGroup( + com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager) { + manager.volumes().listByResourceGroup("sbz_demo", Context.NONE); + } +} diff --git a/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/VolumeListSamples.java b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/VolumeListSamples.java new file mode 100644 index 0000000000000..b7e9207ab99eb --- /dev/null +++ b/sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/src/samples/java/com/azure/resourcemanager/servicefabricmesh/generated/VolumeListSamples.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.servicefabricmesh.generated; + +import com.azure.core.util.Context; + +/** Samples for Volume List. */ +public final class VolumeListSamples { + /* + * x-ms-original-file: specification/servicefabricmesh/resource-manager/Microsoft.ServiceFabricMesh/preview/2018-09-01-preview/examples/volumes/list_bySubscriptionId.json + */ + /** + * Sample code: ListVolumesBySubscriptionId. + * + * @param manager Entry point to ServiceFabricMeshManager. + */ + public static void listVolumesBySubscriptionId( + com.azure.resourcemanager.servicefabricmesh.ServiceFabricMeshManager manager) { + manager.volumes().list(Context.NONE); + } +} diff --git a/sdk/servicefabricmesh/ci.yml b/sdk/servicefabricmesh/ci.yml new file mode 100644 index 0000000000000..b4a8aa5dbf827 --- /dev/null +++ b/sdk/servicefabricmesh/ci.yml @@ -0,0 +1,39 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + paths: + include: + - sdk/servicefabricmesh/ci.yml + - sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/ + exclude: + - sdk/servicefabricmesh/pom.xml + - sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/pom.xml + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/servicefabricmesh/ci.yml + - sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/ + exclude: + - sdk/servicefabricmesh/pom.xml + - sdk/servicefabricmesh/azure-resourcemanager-servicefabricmesh/pom.xml + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: servicefabricmesh + Artifacts: + - name: azure-resourcemanager-servicefabricmesh + groupId: com.azure.resourcemanager + safeName: azureresourcemanagerservicefabricmesh diff --git a/sdk/servicefabricmesh/pom.xml b/sdk/servicefabricmesh/pom.xml new file mode 100644 index 0000000000000..ee1d893f4cac0 --- /dev/null +++ b/sdk/servicefabricmesh/pom.xml @@ -0,0 +1,53 @@ + + + 4.0.0 + com.azure + azure-servicefabricmesh-service + pom + 1.0.0 + + + + coverage + + + + + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.5 + + + report-aggregate + verify + + report-aggregate + + + ${project.reporting.outputDirectory}/test-coverage + + + + + + + + + default + + true + + + azure-resourcemanager-servicefabricmesh + + + +