Skip to content
Draft
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
81 changes: 81 additions & 0 deletions packages/typespec-test/test/EventGrid/spec/CaCertificate.tsp
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 "./Namespace.tsp";

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

namespace Microsoft.EventGrid;
/**
* The CA Certificate resource.
*/
@parentResource(Namespace)
model CaCertificate
is Azure.ResourceManager.ProxyResource<CaCertificateProperties> {
...ResourceNameParameter<
Resource = CaCertificate,
KeyName = "caCertificateName",
SegmentName = "caCertificates",
NamePattern = "^[a-zA-Z0-9-]*$"
>;
}

@armResourceOperations
interface CaCertificates {
/**
* Get properties of a CA certificate.
*/
@summary("Get a CA certificate.")
get is ArmResourceRead<CaCertificate>;

/**
* Create or update a CA certificate with the specified parameters.
*/
@summary("Create or update a CA certificate.")
createOrUpdate is ArmResourceCreateOrReplaceAsync<CaCertificate>;

/**
* Delete an existing CA certificate.
*/
#suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
@summary("Delete a CA certificate.")
delete is ArmResourceDeleteWithoutOkAsync<
CaCertificate,
Response = ArmDeletedResponse | ArmDeleteAcceptedLroResponse | ArmDeletedNoContentResponse
>;

/**
* Get all the CA certificates under a namespace.
*/
@summary("List all CA certificates under a namespace.")
listByNamespace is ArmResourceListByParent<
CaCertificate,
Parameters = {
/**
* The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'.
*/
@query("$filter")
$filter?: string;

/**
* The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page.
*/
@query("$top")
$top?: int32;
},
Response = ArmResponse<CaCertificatesListResult>
>;
}

@@maxLength(CaCertificate.name, 50);
@@minLength(CaCertificate.name, 3);
@@doc(CaCertificate.name, "Name of the CA certificate.");
@@doc(CaCertificate.properties, "The properties of CA certificate.");
@@doc(CaCertificates.createOrUpdate::parameters.resource,
"CA certificate information."
);
99 changes: 99 additions & 0 deletions packages/typespec-test/test/EventGrid/spec/Channel.tsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
import "@azure-tools/typespec-azure-core";
import "@azure-tools/typespec-azure-resource-manager";
import "@typespec/openapi";
import "@typespec/rest";
import "./models.tsp";
import "./PartnerNamespace.tsp";

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

namespace Microsoft.EventGrid;
/**
* Channel info.
*/
@parentResource(PartnerNamespace)
model Channel is Azure.ResourceManager.ProxyResource<ChannelProperties> {
...ResourceNameParameter<
Resource = Channel,
KeyName = "channelName",
SegmentName = "channels",
NamePattern = ""
>;
}

@armResourceOperations
interface Channels {
/**
* Get properties of a channel.
*/
@summary("Get a channel.")
get is ArmResourceRead<Channel>;

/**
* Synchronously creates or updates a new channel with the specified parameters.
*/
@summary("Create or update a channel.")
createOrUpdate is ArmResourceCreateOrReplaceSync<Channel>;

/**
* Synchronously updates a channel with the specified parameters.
*/
#suppress "@azure-tools/typespec-azure-resource-manager/no-response-body" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
@summary("Update a Channel.")
@patch(#{ implicitOptionality: false })
update is ArmCustomPatchSync<
Channel,
PatchModel = ChannelUpdateParameters,
Response = OkResponse
>;

/**
* Delete an existing channel.
*/
#suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
@summary("Delete a channel.")
delete is ArmResourceDeleteWithoutOkAsync<
Channel,
Response = ArmDeletedResponse | ArmDeleteAcceptedLroResponse | ArmDeletedNoContentResponse
>;

/**
* List all the channels in a partner namespace.
*/
@summary("List channels.")
listByPartnerNamespace is ArmResourceListByParent<
Channel,
Parameters = {
/**
* The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'.
*/
@query("$filter")
$filter?: string;

/**
* The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page.
*/
@query("$top")
$top?: int32;
},
Response = ArmResponse<ChannelsListResult>
>;

/**
* Get the full endpoint URL of a partner destination channel.
*/
@summary("Get full URL of partner destination channel.")
getFullUrl is ArmResourceActionSync<
Channel,
void,
ArmResponse<EventSubscriptionFullUrl>
>;
}

@@doc(Channel.name, "Name of the channel.");
@@doc(Channel.properties, "Properties of the Channel.");
@@doc(Channels.createOrUpdate::parameters.resource, "Channel information.");
@@doc(Channels.update::parameters.properties, "Channel update information.");
84 changes: 84 additions & 0 deletions packages/typespec-test/test/EventGrid/spec/Client.tsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
import "@azure-tools/typespec-azure-core";
import "@azure-tools/typespec-azure-resource-manager";
import "@azure-tools/typespec-client-generator-core";
import "@typespec/openapi";
import "@typespec/rest";
import "./models.tsp";
import "./Namespace.tsp";

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

namespace Microsoft.EventGrid;
/**
* The Client resource.
*/
@parentResource(Namespace)
model Client is Azure.ResourceManager.ProxyResource<ClientProperties> {
...ResourceNameParameter<
Resource = Client,
KeyName = "clientName",
SegmentName = "clients",
NamePattern = "^[-a-zA-Z0-9:\\._]*$"
>;
}

@armResourceOperations
interface Clients {
/**
* Get properties of a client.
*/
@summary("Get a client.")
get is ArmResourceRead<Client>;

/**
* Create or update a client with the specified parameters.
*/
@summary("Create or update a client.")
createOrUpdate is ArmResourceCreateOrReplaceAsync<Client>;

/**
* Delete an existing client.
*/
#suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
@summary("Delete a client.")
delete is ArmResourceDeleteWithoutOkAsync<
Client,
Response = ArmDeletedResponse | ArmDeleteAcceptedLroResponse | ArmDeletedNoContentResponse
>;

/**
* Get all the permission bindings under a namespace.
*/
@summary("List all permission bindings under a namespace.")
listByNamespace is ArmResourceListByParent<
Client,
Parameters = {
/**
* The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'.
*/
@query("$filter")
$filter?: string;

/**
* The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page.
*/
@query("$top")
$top?: int32;
},
Response = ArmResponse<ClientsListResult>
>;
}

@@maxLength(Client.name, 128);
@@minLength(Client.name, 1);
@@doc(Client.name, "Name of the client.");
@@doc(Client.properties, "The properties of client.");
@@doc(Clients.createOrUpdate::parameters.resource, "Client information.");

@@clientName(TlsVersion.`1.0`, "One0", "go");
@@clientName(TlsVersion.`1.1`, "One1", "go");
@@clientName(TlsVersion.`1.2`, "One2", "go");
81 changes: 81 additions & 0 deletions packages/typespec-test/test/EventGrid/spec/ClientGroup.tsp
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 "./Namespace.tsp";

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

namespace Microsoft.EventGrid;
/**
* The Client group resource.
*/
@parentResource(Namespace)
model ClientGroup
is Azure.ResourceManager.ProxyResource<ClientGroupProperties> {
...ResourceNameParameter<
Resource = ClientGroup,
KeyName = "clientGroupName",
SegmentName = "clientGroups",
NamePattern = "^[a-zA-Z0-9-]*$"
>;
}

@armResourceOperations
interface ClientGroups {
/**
* Get properties of a client group.
*/
@summary("Get a client group.")
get is ArmResourceRead<ClientGroup>;

/**
* Create or update a client group with the specified parameters.
*/
@summary("Create or update a client group.")
createOrUpdate is ArmResourceCreateOrReplaceAsync<ClientGroup>;

/**
* Delete an existing client group.
*/
#suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
@summary("Delete a client group.")
delete is ArmResourceDeleteWithoutOkAsync<
ClientGroup,
Response = ArmDeletedResponse | ArmDeleteAcceptedLroResponse | ArmDeletedNoContentResponse
>;

/**
* Get all the client groups under a namespace.
*/
@summary("List all client groups under a namespace.")
listByNamespace is ArmResourceListByParent<
ClientGroup,
Parameters = {
/**
* The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq 'westus'.
*/
@query("$filter")
$filter?: string;

/**
* The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results to be returned is 20 items per page.
*/
@query("$top")
$top?: int32;
},
Response = ArmResponse<ClientGroupsListResult>
>;
}

@@maxLength(ClientGroup.name, 50);
@@minLength(ClientGroup.name, 3);
@@doc(ClientGroup.name, "Name of the client group.");
@@doc(ClientGroup.properties, "The properties of client group.");
@@doc(ClientGroups.createOrUpdate::parameters.resource,
"Client group information."
);
Loading
Loading