Skip to content

Commit

Permalink
main + examples
Browse files Browse the repository at this point in the history
  • Loading branch information
Shivam Malpani committed Apr 19, 2024
1 parent 43170f0 commit 086d81d
Show file tree
Hide file tree
Showing 45 changed files with 379 additions and 155 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"title": "Delete Association",
"operationId": "AssociationsInterface_Delete",
"parameters": {
"api-version": "2023-11-01",
"api-version": "2024-05-01-preview",
"subscriptionId": "subid",
"resourceGroupName": "rg1",
"trafficControllerName": "tc1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"title": "Get Association",
"operationId": "AssociationsInterface_Get",
"parameters": {
"api-version": "2023-11-01",
"api-version": "2024-05-01-preview",
"subscriptionId": "subid",
"resourceGroupName": "rg1",
"trafficControllerName": "tc1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"title": "Update Association",
"operationId": "AssociationsInterface_Update",
"parameters": {
"api-version": "2023-11-01",
"api-version": "2024-05-01-preview",
"subscriptionId": "subid",
"resourceGroupName": "rg1",
"trafficControllerName": "tc1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"title": "Put Association",
"operationId": "AssociationsInterface_CreateOrUpdate",
"parameters": {
"api-version": "2023-11-01",
"api-version": "2024-05-01-preview",
"subscriptionId": "subid",
"resourceGroupName": "rg1",
"trafficControllerName": "tc1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"title": "Get Associations",
"operationId": "AssociationsInterface_ListByTrafficController",
"parameters": {
"api-version": "2023-11-01",
"api-version": "2024-05-01-preview",
"subscriptionId": "subid",
"resourceGroupName": "rg1",
"trafficControllerName": "tc1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"title": "Delete Frontend",
"operationId": "FrontendsInterface_Delete",
"parameters": {
"api-version": "2023-11-01",
"api-version": "2024-05-01-preview",
"subscriptionId": "subid",
"resourceGroupName": "rg1",
"trafficControllerName": "tc1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"title": "Get Frontend",
"operationId": "FrontendsInterface_Get",
"parameters": {
"api-version": "2023-11-01",
"api-version": "2024-05-01-preview",
"subscriptionId": "subid",
"resourceGroupName": "rg1",
"trafficControllerName": "tc1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"title": "Update Frontend",
"operationId": "FrontendsInterface_Update",
"parameters": {
"api-version": "2023-11-01",
"api-version": "2024-05-01-preview",
"subscriptionId": "subid",
"resourceGroupName": "rg1",
"trafficControllerName": "tc1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"title": "Put Frontend",
"operationId": "FrontendsInterface_CreateOrUpdate",
"parameters": {
"api-version": "2023-11-01",
"api-version": "2024-05-01-preview",
"subscriptionId": "subid",
"resourceGroupName": "rg1",
"trafficControllerName": "tc1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"title": "Get Frontends",
"operationId": "FrontendsInterface_ListByTrafficController",
"parameters": {
"api-version": "2023-11-01",
"api-version": "2024-05-01-preview",
"subscriptionId": "subid",
"resourceGroupName": "rg1",
"trafficControllerName": "tc1"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"title": "Delete SecurityPolicy",
"operationId": "SecurityPoliciesInterface_Delete",
"parameters": {
"api-version": "2024-05-01-preview",
"subscriptionId": "subid",
"resourceGroupName": "rg1",
"trafficControllerName": "tc1",
"securityPolicyName": "sp1"
},
"responses": {
"200": {},
"202": {
"headers": {
"Retry-After": 3,
"location": "https://blobLocation.com"
}
},
"204": {}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"title": "Get SecurityPolicy",
"operationId": "SecurityPoliciesInterface_Get",
"parameters": {
"api-version": "2024-05-01-preview",
"subscriptionId": "subid",
"resourceGroupName": "rg1",
"trafficControllerName": "tc1",
"securityPolicyName": "sp1"
},
"responses": {
"200": {
"body": {
"name": "waf-0",
"type": "Microsoft.ServiceNetworking/trafficControllers/securityPolicies",
"id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/sample-tc/securityPolicies/waf-0",
"location": "eastus",
"properties": {
"policyType": "waf",
"webApplicationFirewallPolicy": {
"id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.Networking/applicationGatewayWebApplicationFirewallPolicies/wp-0"
},
"provisioningState": "Succeeded"
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"title": "Update SecurityPolicy",
"operationId": "SecurityPoliciesInterface_Update",
"parameters": {
"api-version": "2024-05-01-preview",
"subscriptionId": "subid",
"resourceGroupName": "rg1",
"trafficControllerName": "tc1",
"securityPolicyName": "sp1",
"properties": {
"properties": {
"associationType": "subnets",
"subnet": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet-tc/subnets/tc-subnet"
}
}
}
},
"responses": {
"200": {
"body": {
"name": "waf-0",
"type": "Microsoft.ServiceNetworking/trafficControllers/securityPolicies",
"id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/sample-tc/securityPolicies/waf-0",
"location": "eastus",
"properties": {
"policyType": "waf",
"webApplicationFirewallPolicy": {
"id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.Networking/applicationGatewayWebApplicationFirewallPolicies/wp-0"
},
"provisioningState": "Succeeded"
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"title": "Put SecurityPolicy",
"operationId": "SecurityPoliciesInterface_CreateOrUpdate",
"parameters": {
"api-version": "2024-05-01-preview",
"subscriptionId": "subid",
"resourceGroupName": "rg1",
"trafficControllerName": "tc1",
"securityPolicyName": "sp1",
"resource": {
"location": "NorthCentralUS",
"properties": {
"associationType": "subnets",
"subnet": {
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet-tc/subnets/tc-subnet"
}
}
}
},
"responses": {
"200": {
"body": {
"name": "waf-0",
"type": "Microsoft.ServiceNetworking/trafficControllers/securityPolicies",
"id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/sample-tc/securityPolicies/waf-0",
"location": "eastus",
"properties": {
"policyType": "waf",
"webApplicationFirewallPolicy": {
"id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.Networking/applicationGatewayWebApplicationFirewallPolicies/wp-0"
},
"provisioningState": "Succeeded"
}
}
},
"201": {
"body": {
"name": "waf-0",
"type": "Microsoft.ServiceNetworking/trafficControllers/securityPolicies",
"id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/sample-tc/securityPolicies/waf-0",
"location": "eastus",
"properties": {
"policyType": "waf",
"webApplicationFirewallPolicy": {
"id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.Networking/applicationGatewayWebApplicationFirewallPolicies/wp-0"
},
"provisioningState": "Succeeded"
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"title": "Delete Traffic Controller",
"operationId": "TrafficControllerInterface_Delete",
"parameters": {
"api-version": "2023-11-01",
"api-version": "2024-05-01-preview",
"subscriptionId": "subid",
"resourceGroupName": "rg1",
"trafficControllerName": "tc1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"operationId": "TrafficControllerInterface_Get",
"title": "Get Traffic Controller",
"parameters": {
"api-version": "2023-11-01",
"api-version": "2024-05-01-preview",
"subscriptionId": "subid",
"resourceGroupName": "rg1",
"trafficControllerName": "tc1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"operationId": "TrafficControllerInterface_Update",
"title": "Patch Traffic Controller",
"parameters": {
"api-version": "2023-11-01",
"api-version": "2024-05-01-preview",
"subscriptionId": "subid",
"resourceGroupName": "rg1",
"trafficControllerName": "tc1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"operationId": "TrafficControllerInterface_CreateOrUpdate",
"title": "Put Traffic Controller",
"parameters": {
"api-version": "2023-11-01",
"api-version": "2024-05-01-preview",
"subscriptionId": "subid",
"resourceGroupName": "rg1",
"trafficControllerName": "tc1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"operationId": "TrafficControllerInterface_ListByResourceGroup",
"title": "Get Traffic Controllers",
"parameters": {
"api-version": "2023-11-01",
"api-version": "2024-05-01-preview",
"subscriptionId": "subid",
"resourceGroupName": "rg1"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"operationId": "TrafficControllerInterface_ListBySubscription",
"title": "Get Traffic Controllers List",
"parameters": {
"api-version": "2023-11-01",
"api-version": "2024-05-01-preview",
"subscriptionId": "subid"
},
"responses": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ namespace Microsoft.ServiceNetworking;

/** Api versions */
enum Versions {
/** 2023-11-01 preview version */
/** 2024-05-01 preview version */
@useDependency(Azure.ResourceManager.Versions.v1_0_Preview_1)
`2023-11-01`,
`2024-05-01-preview`,
}

using TypeSpec.Http;
Expand Down Expand Up @@ -87,6 +87,52 @@ model AssociationSubnet {
id: string;
}

//----------------------- SecurityPolicy -----------------------
@doc("SecurityPolicy Subresource of Traffic Controller.")
@parentResource(TrafficController)
model SecurityPolicy is TrackedResource<SecurityPolicyProperties> {
@key("securityPolicy")
@doc("SecurityPolicy")
@visibility("read")
@path
@segment("securityPolicy")
@pattern("^[A-Za-z0-9]([A-Za-z0-9-_.]{0,62}[A-Za-z0-9])?$")
name: string;
}

@doc("SecurityPolicy Properties.")
model SecurityPolicyProperties {
@doc("policy Type")
policyType: string;


wafPolicy?: WAFPolicy;

ddosProtectionPlan?: DDOSProtectionPlan;

@visibility("read")
@doc("Provisioning State of Traffic Controller SecurityPolicy Resource")
provisioningState?: ProvisioningState;
}

model DDOSProtectionPlan {
id: string;
}

model WAFPolicy {
id: string;
}

@doc("SecurityPolicyConfigurations Subresource of Traffic Controller.")
@parentResource(TrafficController)
model SecurityPolicyConfigurations {
wafSecurityPolicy?: WafSecurityPolicy
}

model WafSecurityPolicy {
id : string;
}

//----------------------- Traffic Controller -----------------------
@resource("trafficControllers")
model TrafficController is TrackedResource<TrafficControllerProperties> {
Expand All @@ -112,6 +158,13 @@ model TrafficControllerProperties {
@doc("Associations References List")
associations?: ResourceId[];

@visibility("read")
@doc("Security Policies References List ")
securityPolicies?: ResourceId[];

@visibility("read")
securityPolicyConfigurations?: SecurityPolicyConfigurations[];

@visibility("read")
@doc("The status of the last operation.")
provisioningState?: ProvisioningState;
Expand Down Expand Up @@ -147,11 +200,16 @@ interface FrontendsInterface
extends ResourceInstanceOperations<Frontend, FrontendProperties>,
ResourceListByParent<Frontend> {}

@armResourceOperations
interface SecurityPoliciesInterface
extends ResourceInstanceOperations<SecurityPolicy, SecurityPolicyProperties>,
ResourceListByParent<SecurityPolicy> {}

@armResourceOperations
interface TrafficControllerInterface
extends TrackedResourceOperations<
TrafficController,
TrafficControllerProperties
> {}

interface Operations extends Azure.ResourceManager.Operations {}
interface Operations extends Azure.ResourceManager.Operations {}
Loading

0 comments on commit 086d81d

Please sign in to comment.