Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions specification/nginx/Nginx.Management/NginxCertificate.tsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import "@azure-tools/typespec-azure-core";
import "@azure-tools/typespec-azure-resource-manager";
import "@typespec/openapi";
import "@typespec/rest";
import "./models.tsp";
import "./NginxDeployment.tsp";

using TypeSpec.Rest;
using Azure.ResourceManager;
using TypeSpec.Http;
using TypeSpec.OpenAPI;

namespace Nginx.NginxPlus;
/**
* Nginx Certificate
*/
#suppress "@azure-tools/typespec-azure-core/no-legacy-usage" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
@parentResource(NginxDeployment)
model NginxCertificate
is Azure.ResourceManager.ProxyResource<NginxCertificateProperties> {
...ResourceNameParameter<
Resource = NginxCertificate,
KeyName = "certificateName",
SegmentName = "certificates",
NamePattern = "^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$"
>;

/** The geo-location where the resource lives */
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
@visibility(Lifecycle.Read, Lifecycle.Create)
location?: string;
}

@armResourceOperations
interface NginxCertificates {
/**
* Get a certificate of given NGINX deployment
*/
get is ArmResourceRead<NginxCertificate>;

/**
* Create or update the NGINX certificates for given NGINX deployment
*/
createOrUpdate is Azure.ResourceManager.Legacy.Extension.CreateOrUpdateAsync<
Extension.ResourceGroup,
NginxCertificate,
OptionalRequestBody = true
>;

/**
* Deletes a certificate from the NGINX deployment
*/
delete is ArmResourceDeleteWithoutOkAsync<NginxCertificate>;

/**
* List all certificates of given NGINX deployment
*/
list is ArmResourceListByParent<
NginxCertificate,
Response = ArmResponse<NginxCertificateListResponse>
>;
}

@@doc(NginxCertificate.name, "The name of certificate");
@@doc(NginxCertificate.properties, "Nginx Certificate Properties");
@@doc(NginxCertificates.createOrUpdate::parameters.resource, "The certificate");
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
import "@azure-tools/typespec-azure-core";
import "@azure-tools/typespec-azure-resource-manager";
import "@typespec/openapi";
import "@typespec/rest";
import "./models.tsp";
import "./NginxDeployment.tsp";

using TypeSpec.Rest;
using Azure.ResourceManager;
using TypeSpec.Http;
using TypeSpec.OpenAPI;

namespace Nginx.NginxPlus;
/**
* Nginx Configuration Response
*/
@parentResource(NginxDeployment)
model NginxConfigurationResponse
is Azure.ResourceManager.ProxyResource<NginxConfigurationResponseProperties> {
...ResourceNameParameter<
Resource = NginxConfigurationResponse,
KeyName = "configurationName",
SegmentName = "configurations",
NamePattern = "^[a-z][a-z0-9]*$"
>;
}

@armResourceOperations
interface NginxConfigurationResponses {
/**
* Get the NGINX configuration of given NGINX deployment
*/
get is ArmResourceRead<NginxConfigurationResponse>;

/**
* Create or update the NGINX configuration for given NGINX deployment
*/
createOrUpdate is Azure.ResourceManager.Legacy.Extension.CreateOrUpdateAsync<
Extension.ResourceGroup,
NginxConfigurationResponse,
NginxConfigurationRequest,
OptionalRequestBody = true
>;

/**
* Reset the NGINX configuration of given NGINX deployment to default
*/
delete is ArmResourceDeleteWithoutOkAsync<NginxConfigurationResponse>;

/**
* List the NGINX configuration of given NGINX deployment.
*/
list is ArmResourceListByParent<
NginxConfigurationResponse,
Response = ArmResponse<NginxConfigurationListResponse>
>;

/**
* Analyze an NGINX configuration without applying it to the NGINXaaS deployment
*/
@action("analyze")
analysis is ArmResourceActionSync<
NginxConfigurationResponse,
AnalysisCreate,
ArmResponse<AnalysisResult>,
OptionalRequestBody = true
>;
}

@@doc(NginxConfigurationResponse.name,
"The name of configuration, only 'default' is supported value due to the singleton of NGINX conf"
);
@@doc(NginxConfigurationResponse.properties,
"Nginx Configuration Response Properties"
);
@@doc(NginxConfigurationResponses.createOrUpdate::parameters.resource,
"The NGINX configuration"
);
@@doc(NginxConfigurationResponses.analysis::parameters.body,
"The NGINX configuration to analyze"
);
118 changes: 118 additions & 0 deletions specification/nginx/Nginx.Management/NginxDeployment.tsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
import "@azure-tools/typespec-azure-core";
import "@azure-tools/typespec-azure-resource-manager";
import "@typespec/openapi";
import "@typespec/rest";
import "./models.tsp";

using TypeSpec.Rest;
using Azure.ResourceManager;
using TypeSpec.Http;
using TypeSpec.OpenAPI;

namespace Nginx.NginxPlus;
/**
* Nginx Deployment
*/
model NginxDeployment
is Azure.ResourceManager.TrackedResource<NginxDeploymentProperties> {
...ResourceNameParameter<
Resource = NginxDeployment,
KeyName = "deploymentName",
SegmentName = "nginxDeployments",
NamePattern = "^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$"
>;

/**
* Identity Properties
*/
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
identity?: IdentityProperties;

/**
* Resource Sku
*/
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
sku?: ResourceSku;
}

@armResourceOperations
interface NginxDeployments {
/**
* Get the NGINX deployment
*/
get is ArmResourceRead<NginxDeployment>;

/**
* Create or update the NGINX deployment
*/
createOrUpdate is Azure.ResourceManager.Legacy.Extension.CreateOrUpdateAsync<
Extension.ResourceGroup,
NginxDeployment,
OptionalRequestBody = true
>;

/**
* Update the NGINX deployment
*/
#suppress "@azure-tools/typespec-azure-resource-manager/lro-location-header" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
@patch(#{ implicitOptionality: false })
update is Azure.ResourceManager.Legacy.CustomPatchAsync<
NginxDeployment,
PatchModel = NginxDeploymentUpdateParameters,
LroHeaders = ArmAsyncOperationHeader<FinalResult = NginxDeployment> &
Azure.Core.Foundations.RetryAfterHeader,
OptionalRequestBody = true
>;

/**
* Delete the NGINX deployment resource
*/
delete is ArmResourceDeleteWithoutOkAsync<NginxDeployment>;

/**
* List all NGINX deployments under the specified resource group.
*/
listByResourceGroup is ArmResourceListByParent<
NginxDeployment,
Response = ArmResponse<NginxDeploymentListResponse>
>;

/**
* List the NGINX deployments resources
*/
list is ArmListBySubscription<
NginxDeployment,
Response = ArmResponse<NginxDeploymentListResponse>
>;

/**
* List Waf Policies of given Nginx deployment
*/
@get
@list
@action("wafPolicies")
wafPolicyList is ArmResourceActionSync<
NginxDeployment,
void,
ArmResponse<NginxDeploymentWafPolicyListResponse>
>;

/**
* Get the Nginx Waf Policy of given Nginx deployment
*/
@action("listDefaultWafPolicies")
defaultWafPolicyList is ArmResourceActionSync<
NginxDeployment,
void,
ArmResponse<NginxDeploymentDefaultWafPolicyListResponse>
>;
}

@@doc(NginxDeployment.name, "The name of targeted NGINX deployment");
@@doc(NginxDeployment.properties, "Nginx Deployment Properties");
@@doc(NginxDeployments.createOrUpdate::parameters.resource,
"The Nginx deployment"
);
@@doc(NginxDeployments.update::parameters.properties,
"The Nginx deployment update parameters"
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import "@azure-tools/typespec-azure-core";
import "@azure-tools/typespec-azure-resource-manager";
import "@typespec/openapi";
import "@typespec/rest";
import "./models.tsp";
import "./NginxDeployment.tsp";

using TypeSpec.Rest;
using Azure.ResourceManager;
using TypeSpec.Http;
using TypeSpec.OpenAPI;

namespace Nginx.NginxPlus;
/**
* Nginx Deployment Api Key Response
*/
@parentResource(NginxDeployment)
model NginxDeploymentApiKeyResponse
is Azure.ResourceManager.ProxyResource<NginxDeploymentApiKeyResponseProperties> {
...ResourceNameParameter<
Resource = NginxDeploymentApiKeyResponse,
KeyName = "apiKeyName",
SegmentName = "apiKeys",
NamePattern = "^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$"
>;
}

@armResourceOperations
interface NginxDeploymentApiKeyResponses {
/**
* Get the specified API Key of the given Nginx deployment
*/
get is ArmResourceRead<NginxDeploymentApiKeyResponse>;

/**
* Create or update an API Key for the Nginx deployment in order to access the dataplane API endpoint
*/
createOrUpdate is Azure.ResourceManager.Legacy.CreateOrUpdateSync<
NginxDeploymentApiKeyResponse,
Request = NginxDeploymentApiKeyRequest,
OptionalRequestBody = true
>;

/**
* Delete API key for Nginx deployment
*/
delete is ArmResourceDeleteSync<NginxDeploymentApiKeyResponse>;

/**
* List all API Keys of the given Nginx deployment
*/
list is ArmResourceListByParent<
NginxDeploymentApiKeyResponse,
Response = ArmResponse<NginxDeploymentApiKeyListResponse>
>;
}

@@doc(NginxDeploymentApiKeyResponse.name, "The resource name of the API key");
@@doc(NginxDeploymentApiKeyResponse.properties,
"Nginx Deployment Api Key Response Properties"
);
@@doc(NginxDeploymentApiKeyResponses.createOrUpdate::parameters.resource,
"The API Key object containing fields (e.g. secret text, expiration date) to upsert the key."
);
60 changes: 60 additions & 0 deletions specification/nginx/Nginx.Management/NginxDeploymentWafPolicy.tsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import "@azure-tools/typespec-azure-core";
import "@azure-tools/typespec-azure-resource-manager";
import "@typespec/openapi";
import "@typespec/rest";
import "./models.tsp";
import "./NginxDeployment.tsp";

using TypeSpec.Rest;
using Azure.ResourceManager;
using TypeSpec.Http;
using TypeSpec.OpenAPI;

namespace Nginx.NginxPlus;
/**
* Nginx Deployment Waf Policy
*/
@parentResource(NginxDeployment)
model NginxDeploymentWafPolicy
is Azure.ResourceManager.ProxyResource<NginxDeploymentWafPolicyProperties> {
...ResourceNameParameter<
Resource = NginxDeploymentWafPolicy,
KeyName = "wafPolicyName",
SegmentName = "wafPolicies",
NamePattern = "^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$"
>;
}

@armResourceOperations
interface NginxDeploymentWafPolicies {
/**
* Get the Nginx Waf Policy of given Nginx deployment
*/
get is ArmResourceRead<NginxDeploymentWafPolicy>;

/**
* Create or update the Nginx Waf Policy for given Nginx deployment
*/
@Azure.Core.useFinalStateVia("azure-async-operation")
create is Azure.ResourceManager.Legacy.Extension.CreateOrUpdateAsync<
Extension.ResourceGroup,
NginxDeploymentWafPolicy,
LroHeaders = ArmAsyncOperationHeader<FinalResult = NginxDeploymentWafPolicy> &
ArmLroLocationHeader<FinalResult = NginxDeploymentWafPolicy> &
Azure.Core.Foundations.RetryAfterHeader,
OptionalRequestBody = true
>;

/**
* Reset the Nginx Waf Policy of given Nginx deployment to default
*/
delete is ArmResourceDeleteWithoutOkAsync<NginxDeploymentWafPolicy>;
}

@@doc(NginxDeploymentWafPolicy.name, "The name of Waf Policy");
@@doc(NginxDeploymentWafPolicy.properties,
"Nginx Deployment Waf Policy Properties"
);
@@doc(NginxDeploymentWafPolicies.create::parameters.resource,
"The Nginx Deployment Waf Policy"
);
Loading
Loading