Skip to content

Commit 63db780

Browse files
committed
Updated documentation and Function App SDK version
1 parent 01af418 commit 63db780

File tree

6 files changed

+73
-66
lines changed

6 files changed

+73
-66
lines changed
95.8 KB
Loading
38.5 KB
Loading

documentation/setup.md

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -730,6 +730,16 @@ For each API, please add a new operation as defined below. Once completed, pleas
730730
| Get Passengers | get-passengers | `GET`/passengers | None | `GetPassengers` Auth Code |
731731
| Get Passenger | get-passenger | `GET`/passengers/{code} | code = passenger code = string | `GetPassenger` Auth Code |
732732

733+
### Publish the RideShare APIM product
734+
735+
Now that you've added your APIs, you need to publish your `RideShare` product. To do this, select **Products** on the left-hand menu of your APIM service. You will see that the `RideShare` product is in the **Not published** state.
736+
737+
![The RideShare product is shown with the current state being Not Published.](media/apim-product-not-published.png "Products")
738+
739+
Select the ellipses (...) on the right-hand side of the `RideShare` product, then select **Publish**.
740+
741+
![The ellipses context menu is shown and the Publish menu item is highlighted.](media/apim-publish-product.png "Products")
742+
733743
### Retrieve the APIM API key
734744

735745
**Please note** that you should have created the [Create the API Management Service](#create-the-api-management-service) as well as [added the RideShare APIM Product](#add-apim-products-and-apis) before you can proceed with this step.
@@ -1343,17 +1353,16 @@ From a PowerShell command, use the following commands for the `Prod` environment
13431353

13441354
## Seeding
13451355

1346-
The .NET `ServerlessMicroservices.Seeder` project contains a seeding command that can be used to seed `drivers` and `passengers` using the `Drivers APIs` and `Passengers APIs` respectively.
1356+
The .NET `ServerlessMicroservices.Seeder` project contains a seeding command that can be used to seed `drivers` and `passengers` using the `Drivers APIs` and `Passengers APIs`, respectively.
1357+
1358+
**Please note** that the `seed` command will seed drivers only if there are no drivers and will seed passengers only if there are no passengers in the solution's database.
13471359

1348-
**Please note** that the `seed` command will seed drivers only if there are no drivers and will seed passengers only if there are no passengers in the solution's database.
1360+
> You must set the **EnableAuth** App Setting on the **Drivers** and **Passengers** Function Apps to `false` for the seeder to work.
13491361
1350-
The `seed` command takes 5 non-optional arguments i.e. `ServerlessMicroservices.Seeder.exe seed https://ridesharetripsfunctionapp.azurewebsites.net getdriversfunctioncode postdriversfunctioncode getpassengersfunctioncode postpassengersfunctioncode`
1362+
The `seed` command takes 5 non-optional arguments i.e. `ServerlessMicroservices.Seeder.exe seed --seeddriversurl https://ridesharedrivers.azurewebsites.net --seedpassengersurl https://ridesharepassengers.azurewebsites.net`
13511363

1352-
- Deployment Base URL
1353-
- GetDrivers Function Code
1354-
- PostDrivers Function Code
1355-
- GetPassengers Function Code
1356-
- PostPassengers Function Code
1364+
- Drivers Function Base URL
1365+
- Passengers Function Base URL
13571366

13581367
## Containers
13591368

dotnet/ServerlessMicroservices.FunctionApp.Trips/ServerlessMicroservices.FunctionApp.Trips.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
<ItemGroup>
77
<PackageReference Include="AzureAdvocates.WebJobs.Extensions.SignalRService" Version="0.3.0-alpha" />
88
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.EventGrid" Version="2.0.0" />
9-
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.Storage" Version="3.0.3" />
10-
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="1.0.24" />
9+
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.Storage" Version="3.0.4" />
10+
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="1.0.26" />
1111
</ItemGroup>
1212
<ItemGroup>
1313
<ProjectReference Include="..\ServerlessMicroservices.Models\ServerlessMicroservices.Models.csproj" />

dotnet/ServerlessMicroservices.Seeder/Program.cs

Lines changed: 53 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,7 @@ static void Main(string[] args)
2020
app.HelpOption("--help");
2121

2222
// `seed` Seed Command
23-
var seedUrlOption = app.Option("-t|--seedbaseurl", "Set seed base url", CommandOptionType.SingleValue, true);
24-
var seedGetDriversFunctionCodeOption = app.Option("-t|--seedgetdriverscode", "Set seed get drivers function cpde", CommandOptionType.SingleValue, true);
25-
var seedPostDriversFunctionCodeOption = app.Option("-t|--seedpostdriverscode", "Set seed post drivers function cpde", CommandOptionType.SingleValue, true);
26-
var seedGetPassengersFunctionCodeOption = app.Option("-t|--seedgetpassengerscode", "Set seed get passengers function cpde", CommandOptionType.SingleValue, true);
27-
var seedPostPassengersFunctionCodeOption = app.Option("-t|--seedpostpassengerscode", "Set seed post passengers function cpde", CommandOptionType.SingleValue, true);
23+
var seedDriversUrlOption = app.Option("-t|--seeddriversurl", "Set seed drivers url", CommandOptionType.SingleValue, true);
2824

2925
// `testTrips` Test Trips Command
3026
var testUrlOption = app.Option("-t|--testurl", "Set test url", CommandOptionType.SingleValue, true);
@@ -40,34 +36,22 @@ static void Main(string[] args)
4036

4137
app.Command("seed", cmd =>
4238
{
43-
cmd.Description = "Seed Drivers & Passengers";
39+
cmd.Description = "Seed Drivers";
4440
cmd.HelpOption("--help");
4541

4642
cmd.OnExecute(async () =>
4743
{
48-
var baseUrl = seedUrlOption.Value();
49-
var getDriversCode = seedGetDriversFunctionCodeOption.Value();
50-
var postDriversCode = seedPostDriversFunctionCodeOption.Value();
51-
var getPassengersCode = seedGetPassengersFunctionCodeOption.Value();
52-
var postPassengersCode = seedPostPassengersFunctionCodeOption.Value();
53-
54-
if (string.IsNullOrEmpty(baseUrl) ||
55-
!seedUrlOption.HasValue() ||
56-
string.IsNullOrEmpty(getDriversCode) ||
57-
!seedGetDriversFunctionCodeOption.HasValue() ||
58-
string.IsNullOrEmpty(postDriversCode) ||
59-
!seedPostDriversFunctionCodeOption.HasValue() ||
60-
string.IsNullOrEmpty(getPassengersCode) ||
61-
!seedGetPassengersFunctionCodeOption.HasValue() ||
62-
string.IsNullOrEmpty(postPassengersCode) ||
63-
!seedPostPassengersFunctionCodeOption.HasValue()
64-
)
44+
var driversUrl = seedDriversUrlOption.Value();
45+
46+
if (string.IsNullOrEmpty(driversUrl) ||
47+
!seedDriversUrlOption.HasValue()
48+
)
6549
{
6650
MissingSeedOptions();
6751
return 0;
6852
}
6953

70-
await Seed(baseUrl, getDriversCode, postDriversCode, getPassengersCode, postPassengersCode);
54+
await Seed(driversUrl);
7155
return 0;
7256
});
7357
});
@@ -127,52 +111,66 @@ static void Main(string[] args)
127111
});
128112

129113
app.Execute(args);
114+
115+
Console.ReadLine();
130116
}
131117

132118
//*** Auxiliary Methods ***//
133119

134120
/*
135121
* Seed
136122
*/
137-
static async Task Seed(string baseUrl, string getDriversFunctionCode, string postDriversFunctionCode, string getPassengersFunctionCodestring, string postPassengersFunctionCode)
123+
static async Task Seed(string driversUrl)
138124
{
139125
// Read existing entities
140-
List<DriverItem> drivers = await Utilities.Get<List<DriverItem>>(null, $"{baseUrl}/api/drivers?code={getDriversFunctionCode}", new Dictionary<string, string>());
141-
List<PassengerItem> passengers = await Utilities.Get<List<PassengerItem>>(null, $"{baseUrl}/api/passengers?code={getPassengersFunctionCodestring}", new Dictionary<string, string>());
126+
var drivers = await Utilities.Get<List<DriverItem>>(null, $"{driversUrl}/api/drivers", new Dictionary<string, string>());
127+
//List<PassengerItem> passengers = await Utilities.Get<List<PassengerItem>>(null, $"{passengersUrl}/api/passengers", new Dictionary<string, string>());
142128

143129
if (drivers == null || drivers.Count == 0)
144130
{
145131
drivers = new List<DriverItem>()
146132
{
147-
new DriverItem() { Code = "AA100", FirstName = "James", LastName = "Beaky", Latitude = 31.7157, Longitude = 117.1611, Car = new CarItem () { DriverCode = "AA100", Make = "BMW", Model = "735", Year = "2015", Color = "Silver", LicensePlate = "CA-91099"} },
148-
new DriverItem() { Code = "AA110", FirstName = "Rod", LastName = "Snow", Latitude = 34.0552, Longitude = 118.2437, Car = new CarItem () { DriverCode = "AA110", Make = "Toyota", Model = "Camry", Year = "2013", Color = "Gray", LicensePlate = "CA-78209"} },
149-
new DriverItem() { Code = "AA120", FirstName = "Sam", LastName = "Imada", Latitude = 37.7749, Longitude = 122.4194, Car = new CarItem () { DriverCode = "AA120", Make = "Honda", Model = "Accord", Year = "2017", Color = "Black", LicensePlate = "CA-76215"} }
133+
new DriverItem() { Code = "AA100", FirstName = "James", LastName = "Beaky", Latitude = 47.6423355, Longitude = -122.1391190, Car = new CarItem () { DriverCode = "AA100", Make = "BMW", Model = "735", Year = "2015", Color = "Silver", LicensePlate = "HGA-9199"} },
134+
new DriverItem() { Code = "AA110", FirstName = "Rod", LastName = "Snow", Latitude = 47.618288, Longitude = -122.201039, Car = new CarItem () { DriverCode = "AA110", Make = "Toyota", Model = "Camry", Year = "2013", Color = "Gray", LicensePlate = "CAL-7820"} },
135+
new DriverItem() { Code = "AA120", FirstName = "Sam", LastName = "Imada", Latitude = 47.62050, Longitude = -122.3489, Car = new CarItem () { DriverCode = "AA120", Make = "Honda", Model = "Accord", Year = "2017", Color = "Black", LicensePlate = "N01DRVR"} },
136+
new DriverItem() { Code = "AA130", FirstName = "Miranda", LastName = "Algernon", Latitude = 47.6131742, Longitude = -122.4821468, Car = new CarItem () { DriverCode = "AA100", Make = "Toyota", Model = "Prius", Year = "2019", Color = "Red", LicensePlate = "YUL-3628"} },
137+
new DriverItem() { Code = "AA140", FirstName = "Ahmed", LastName = "Zohawi", Latitude = 47.5963251, Longitude = -122.1928185, Car = new CarItem () { DriverCode = "AA110", Make = "Ford", Model = "Focus", Year = "2016", Color = "Silver", LicensePlate = "HAL-2000"} },
138+
new DriverItem() { Code = "AA150", FirstName = "Jessica", LastName = "Fosterton", Latitude = 47.6721323, Longitude = -122.1355805, Car = new CarItem () { DriverCode = "AA120", Make = "Dodge", Model = "Challenger", Year = "2018", Color = "Blue", LicensePlate = "CHA11GR"} }
150139
};
151140

152-
foreach(var driver in drivers)
141+
foreach (var driver in drivers)
153142
{
154-
await Utilities.Post<dynamic, dynamic>(null, driver, $"{baseUrl}/api/drivers?code={postDriversFunctionCode}", new Dictionary<string, string>());
143+
await Utilities.Post<dynamic, dynamic>(null, driver, $"{driversUrl}/api/drivers", new Dictionary<string, string>());
155144
}
156145
}
157146
else
158147
Console.WriteLine("No need to seed ...there are drivers in the solution!");
159148

160-
if (passengers == null || passengers.Count == 0)
161-
{
162-
passengers = new List<PassengerItem>()
163-
{
164-
new PassengerItem() { Code = "[email protected]", FirstName = "Joe", LastName = "Kassini", MobileNumber = "3105551212", Email = "[email protected]" },
165-
new PassengerItem() { Code = "[email protected]", FirstName = "Rob", LastName = "Dart", MobileNumber = "7145551313", Email = "[email protected]" },
166-
new PassengerItem() { Code = "[email protected]", FirstName = "Sue", LastName = "Faming", MobileNumber = "7145551414", Email = "[email protected]" }
167-
};
168-
169-
foreach (var passenger in passengers)
170-
{
171-
await Utilities.Post<dynamic, dynamic>(null, passenger, $"{baseUrl}/api/passengers?code={postPassengersFunctionCode}", new Dictionary<string, string>());
172-
}
173-
}
174-
else
175-
Console.WriteLine("No need to seed ...there are passengers in the solution!");
149+
//if (passengers == null || passengers.Count == 0)
150+
//{
151+
// passengers = new List<PassengerItem>()
152+
// {
153+
// new PassengerItem() { Code = "[email protected]", FirstName = "Joe", LastName = "Kassini", MobileNumber = "3105551212", Email = "[email protected]" },
154+
// new PassengerItem() { Code = "[email protected]", FirstName = "Rob", LastName = "Dart", MobileNumber = "7145551313", Email = "[email protected]" },
155+
// new PassengerItem() { Code = "[email protected]", FirstName = "Sue", LastName = "Faming", MobileNumber = "7145551414", Email = "[email protected]" },
156+
// new PassengerItem() { Code = "[email protected]", FirstName = "Mary", LastName = "Almont", MobileNumber = "8195551515", Email = "[email protected]" },
157+
// new PassengerItem() { Code = "[email protected]", FirstName = "Deon", LastName = "Brown", MobileNumber = "7145551616", Email = "[email protected]" },
158+
// new PassengerItem() { Code = "[email protected]", FirstName = "Chung", LastName = "Wang", MobileNumber = "3105551717", Email = "[email protected]" },
159+
// new PassengerItem() { Code = "[email protected]", FirstName = "Saruman", LastName = "Balavadadraman", MobileNumber = "3105551818", Email = "[email protected]" },
160+
// new PassengerItem() { Code = "[email protected]", FirstName = "Forrest", LastName = "Goldenbear", MobileNumber = "7145551919", Email = "[email protected]" },
161+
// new PassengerItem() { Code = "[email protected]", FirstName = "Alexis", LastName = "Trachtenburg", MobileNumber = "3105552020", Email = "[email protected]" },
162+
// new PassengerItem() { Code = "[email protected]", FirstName = "Tremaine", LastName = "Holler", MobileNumber = "8195552121", Email = "[email protected]" },
163+
// new PassengerItem() { Code = "[email protected]", FirstName = "Marilynn", LastName = "Freidenhammer", MobileNumber = "7145552222", Email = "[email protected]" },
164+
// new PassengerItem() { Code = "[email protected]", FirstName = "Cirrilius", LastName = "Eichelman", MobileNumber = "3105552323", Email = "[email protected]" }
165+
// };
166+
167+
// foreach (var passenger in passengers)
168+
// {
169+
// await Utilities.Post<dynamic, dynamic>(null, passenger, $"{passengersUrl}/api/passengers", new Dictionary<string, string>());
170+
// }
171+
//}
172+
//else
173+
// Console.WriteLine("No need to seed ...there are passengers in the solution!");
176174

177175
Console.WriteLine("Seed completed......press any key!");
178176
Console.ReadLine();
@@ -184,7 +182,7 @@ static async Task Seed(string baseUrl, string getDriversFunctionCode, string pos
184182
static async Task TestTrips(string url)
185183
{
186184
// Read the test parameters
187-
var tripTasks = await Utilities.Get<List<TripTestParameters>> (null, url, new Dictionary<string, string>());
185+
var tripTasks = await Utilities.Get<List<TripTestParameters>>(null, url, new Dictionary<string, string>());
188186

189187
// Launch the test tasks
190188
List<Task<TripTestResult>> taskRuns = new List<Task<TripTestResult>>();
@@ -241,7 +239,7 @@ double destinationLongitude
241239
mobileNumber = passengerMobile,
242240
email = passengerEmail
243241
},
244-
source = new
242+
source = new
245243
{
246244
latitude = sourceLatitude,
247245
longitude = sourceLongitude
@@ -285,10 +283,10 @@ static async Task TestSignalR(string url)
285283
return Task.FromResult(singnalRInfo.AccessKey);
286284
};
287285
})
288-
.ConfigureLogging( logging =>
289-
{
290-
logging.AddConsole();
291-
})
286+
.ConfigureLogging(logging =>
287+
{
288+
logging.AddConsole();
289+
})
292290
.Build();
293291

294292
connection.On<TripItem>("tripUpdated", (trip) =>
@@ -334,7 +332,7 @@ static async Task TestSignalR(string url)
334332

335333
private static void MissingSeedOptions()
336334
{
337-
Console.WriteLine("Required options: seedbaseurl, seedgetdriverscode, seedpostdriverscode, seedgetpassengerscode, seedpostpassengerscode");
335+
Console.WriteLine("Required options: seeddriversurl");
338336
}
339337

340338
private static void MissingTestTripsOptions()

dotnet/ServerlessMicroservices.Seeder/Properties/launchSettings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"profiles": {
33
"ServerlessMicroservices.Seeder": {
44
"commandName": "Project",
5-
"commandLineArgs": "testSignalr https://ridesharetripsfunctionappdev.azurewebsites.net/api/signalrinfo"
5+
"commandLineArgs": "seed --seeddriversurl https://ridesharedrivers.azurewebsites.net"
66
}
77
}
88
}

0 commit comments

Comments
 (0)