some changes

This commit is contained in:
2022-02-13 15:37:40 -06:00
parent 5dc3d49f94
commit ac880d01b7
8 changed files with 246 additions and 16 deletions

View File

@@ -13,16 +13,16 @@ using Newtonsoft.Json;
namespace forgetmenot_api
{
public class Function1
public class Bookmarks
{
private readonly ILogger<Function1> _logger;
private readonly ILogger<Bookmarks> _logger;
public Function1(ILogger<Function1> log)
public Bookmarks(ILogger<Bookmarks> log)
{
_logger = log;
}
[FunctionName("Function1")]
[FunctionName("bookmarks")]
[OpenApiOperation(operationId: "Run", tags: new[] { "name" })]
[OpenApiSecurity("function_key", SecuritySchemeType.ApiKey, Name = "code", In = OpenApiSecurityLocationType.Query)]
[OpenApiParameter(name: "name", In = ParameterLocation.Query, Required = true, Type = typeof(string), Description = "The **Name** parameter")]
@@ -31,6 +31,7 @@ namespace forgetmenot_api
[HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequest req)
{
_logger.LogInformation("C# HTTP trigger function processed a request.");
_logger.LogInformation("Just log something");
string name = req.Query["name"];

View File

@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<UserName>$forgetmenot-api20220213151332</UserName>
<WebPublishMethod>ZipDeploy</WebPublishMethod>
<PublishProvider>AzureWebSite</PublishProvider>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish>https://forgetmenot-api20220213151332.azurewebsites.net</SiteUrlToLaunchAfterPublish>
<LaunchSiteAfterPublish>False</LaunchSiteAfterPublish>
<ResourceId>/subscriptions/dc238150-9fba-4c6a-be71-395acd1749a9/resourcegroups/rg-forgetmenot/providers/Microsoft.Web/sites/forgetmenot-api20220213151332</ResourceId>
<_SavePWD>True</_SavePWD>
<IsLinux>true</IsLinux>
<ApiResourceId>/subscriptions/dc238150-9fba-4c6a-be71-395acd1749a9/resourceGroups/rg-forgetmenot/providers/Microsoft.ApiManagement/service/forgetmenot-apiservice/apis/forgetmenot-api</ApiResourceId>
<PublishUrl>https://forgetmenot-api20220213151332.scm.azurewebsites.net/</PublishUrl>
<UpdateApiOnPublish>true</UpdateApiOnPublish>
<TargetFramework>net6.0</TargetFramework>
<SelfContained>false</SelfContained>
<SkipExtraFilesOnServer>False</SkipExtraFilesOnServer>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,131 @@
{
"$schema": "https://schema.management.azure.com/schemas/2018-05-01/subscriptionDeploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"resourceGroupName": {
"type": "string",
"defaultValue": "rg-forgetmenot",
"metadata": {
"_parameterType": "resourceGroup",
"description": "Name of the resource group for the resource. It is recommended to put resources under same resource group for better tracking."
}
},
"resourceGroupLocation": {
"type": "string",
"defaultValue": "centralus",
"metadata": {
"_parameterType": "location",
"description": "Location of the resource group. Resource groups could have different location than resources."
}
},
"resourceLocation": {
"type": "string",
"defaultValue": "[parameters('resourceGroupLocation')]",
"metadata": {
"_parameterType": "location",
"description": "Location of the resource. By default use resource group's location, unless the resource provider is not supported there."
}
}
},
"resources": [
{
"type": "Microsoft.Resources/resourceGroups",
"name": "[parameters('resourceGroupName')]",
"location": "[parameters('resourceGroupLocation')]",
"apiVersion": "2019-10-01"
},
{
"type": "Microsoft.Resources/deployments",
"name": "[concat(parameters('resourceGroupName'), 'Deployment', uniqueString(concat('forgetmenot-api', subscription().subscriptionId)))]",
"resourceGroup": "[parameters('resourceGroupName')]",
"apiVersion": "2019-10-01",
"dependsOn": [
"[parameters('resourceGroupName')]"
],
"properties": {
"mode": "Incremental",
"template": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": [
{
"name": "forgetmenot-apiservice",
"type": "Microsoft.ApiManagement/service",
"location": "[parameters('resourceLocation')]",
"properties": {
"publisherEmail": "benramey@fastmail.com",
"publisherName": "Ben Ramey",
"notificationSenderEmail": "apimgmt-noreply@mail.windowsazure.com",
"hostnameConfigurations": [
{
"type": "Proxy",
"hostName": "forgetmenot-apiservice.azure-api.net",
"encodedCertificate": null,
"keyVaultId": null,
"certificatePassword": null,
"negotiateClientCertificate": false,
"certificate": null,
"defaultSslBinding": true
}
],
"publicIPAddresses": null,
"privateIPAddresses": null,
"additionalLocations": null,
"virtualNetworkConfiguration": null,
"customProperties": {
"Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10": "False",
"Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11": "False",
"Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls10": "False",
"Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls11": "False",
"Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Ssl30": "False",
"Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2": "False"
},
"virtualNetworkType": "None",
"certificates": null,
"apiVersionConstraint": {
"minApiVersion": null
}
},
"sku": {
"name": "Consumption",
"capacity": 0
},
"apiVersion": "2019-12-01"
},
{
"type": "Microsoft.ApiManagement/service/apis",
"name": "forgetmenot-apiservice/forgetmenot-api",
"properties": {
"displayName": "forgetmenot-api",
"apiRevision": "1",
"description": null,
"subscriptionRequired": true,
"serviceUrl": null,
"path": "",
"protocols": [
"https"
],
"authenticationSettings": {
"oAuth2": null,
"openid": null
},
"subscriptionKeyParameterNames": {
"header": "Ocp-Apim-Subscription-Key",
"query": "subscription-key"
},
"isCurrent": true
},
"apiVersion": "2019-12-01",
"dependsOn": [
"forgetmenot-apiservice"
]
}
]
}
}
}
],
"metadata": {
"_dependencyType": "apis.azure"
}
}

View File

@@ -0,0 +1,70 @@
{
"$schema": "https://schema.management.azure.com/schemas/2018-05-01/subscriptionDeploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"resourceGroupName": {
"type": "string",
"defaultValue": "rg-forgetmenot",
"metadata": {
"_parameterType": "resourceGroup",
"description": "Name of the resource group for the resource. It is recommended to put resources under same resource group for better tracking."
}
},
"resourceGroupLocation": {
"type": "string",
"defaultValue": "centralus",
"metadata": {
"_parameterType": "location",
"description": "Location of the resource group. Resource groups could have different location than resources."
}
},
"resourceLocation": {
"type": "string",
"defaultValue": "[parameters('resourceGroupLocation')]",
"metadata": {
"_parameterType": "location",
"description": "Location of the resource. By default use resource group's location, unless the resource provider is not supported there."
}
}
},
"resources": [
{
"type": "Microsoft.Resources/resourceGroups",
"name": "[parameters('resourceGroupName')]",
"location": "[parameters('resourceGroupLocation')]",
"apiVersion": "2019-10-01"
},
{
"type": "Microsoft.Resources/deployments",
"name": "[concat(parameters('resourceGroupName'), 'Deployment', uniqueString(concat('forgetmenotstorage', subscription().subscriptionId)))]",
"resourceGroup": "[parameters('resourceGroupName')]",
"apiVersion": "2019-10-01",
"dependsOn": [
"[parameters('resourceGroupName')]"
],
"properties": {
"mode": "Incremental",
"template": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": [
{
"sku": {
"name": "Standard_LRS",
"tier": "Standard"
},
"kind": "Storage",
"name": "forgetmenotstorage",
"type": "Microsoft.Storage/storageAccounts",
"location": "[parameters('resourceLocation')]",
"apiVersion": "2017-10-01"
}
]
}
}
}
],
"metadata": {
"_dependencyType": "storage.azure"
}
}

View File

@@ -0,0 +1,13 @@
{
"dependencies": {
"storage1": {
"resourceId": "/subscriptions/[parameters('subscriptionId')]/resourceGroups/[parameters('resourceGroupName')]/providers/Microsoft.Storage/storageAccounts/forgetmenotstorage",
"type": "storage.azure",
"connectionId": "AzureWebJobsStorage"
},
"apis1": {
"resourceId": "/subscriptions/[parameters('subscriptionId')]/resourceGroups/[parameters('resourceGroupName')]/providers/Microsoft.ApiManagement/service/forgetmenot-apiservice/apis/forgetmenot-api",
"type": "apis.azure"
}
}
}

View File

@@ -1,11 +1,11 @@
{
"dependencies": {
"appInsights1": {
"type": "appInsights"
},
"storage1": {
"type": "storage",
"connectionId": "AzureWebJobsStorage"
},
"apis1": {
"type": "apis"
}
}
}

View File

@@ -1,8 +1,5 @@
{
"dependencies": {
"appInsights1": {
"type": "appInsights.sdk"
},
"storage1": {
"resourceId": "/subscriptions/[parameters('subscriptionId')]/resourcegroups/[parameters('resourceGroupName')]/providers/Microsoft.Storage/storageAccounts/forgetmenotstorage",
"type": "storage.azure",

View File

@@ -1,11 +1,5 @@
{
"version": "2.0",
"logging": {
"applicationInsights": {
"samplingSettings": {
"isEnabled": true,
"excludedTypes": "Request"
}
}
}
}