public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems) { AmazonGameLiftConfig config = new AmazonGameLiftConfig(); config.RegionEndpoint = region; ConfigureClient(config); AmazonGameLiftClient client = new AmazonGameLiftClient(creds, config); ListBuildsResponse resp = new ListBuildsResponse(); do { ListBuildsRequest req = new ListBuildsRequest { NextToken = resp.NextToken , Limit = maxItems }; resp = client.ListBuilds(req); CheckError(resp.HttpStatusCode, "200"); foreach (var obj in resp.Builds) { AddObject(obj); } }while (!string.IsNullOrEmpty(resp.NextToken)); }
/// <summary> /// Retrieves the build details for all game server executables which are currently defined for the title /// </summary> public static void ListServerBuilds(ListBuildsRequest request, Action <ListBuildsResult> resultCallback, Action <PlayFabError> errorCallback, object customData = null) { if (PlayFabSettings.DeveloperSecretKey == null) { throw new Exception("Must have PlayFabSettings.DeveloperSecretKey set to call this method"); } PlayFabHttp.MakeApiCall("/Admin/ListServerBuilds", request, AuthType.DevSecretKey, resultCallback, errorCallback, customData); }
/// <summary>Snippet for ListBuildsAsync</summary> public async Task ListBuildsRequestObjectAsync() { // Snippet: ListBuildsAsync(ListBuildsRequest, CallSettings) // Create client BuildServiceClient buildServiceClient = await BuildServiceClient.CreateAsync(); // Initialize request argument(s) ListBuildsRequest request = new ListBuildsRequest { ParentAsModelName = ModelName.FromBuildTargetModel("[BUILD_TARGET]", "[MODEL]"), Filter = "", ReadMask = new FieldMask(), GroupBy = new FieldMask(), }; // Make the request PagedAsyncEnumerable <ListBuildsResponse, Build> response = buildServiceClient.ListBuildsAsync(request); // Iterate over all response items, lazily performing RPCs as required await response.ForEachAsync((Build item) => { // Do something with each item Console.WriteLine(item); }); // Or iterate over pages (of server-defined size), performing one RPC per page await response.AsRawResponses().ForEachAsync((ListBuildsResponse page) => { // Do something with each page of items Console.WriteLine("A page of results:"); foreach (Build item in page) { // Do something with each item Console.WriteLine(item); } }); // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required int pageSize = 10; Page <Build> singlePage = await response.ReadPageAsync(pageSize); // Do something with the page of items Console.WriteLine($"A page of {pageSize} results (unless it's the final page):"); foreach (Build item in singlePage) { // Do something with each item Console.WriteLine(item); } // Store the pageToken, for when the next page is required. string nextPageToken = singlePage.NextPageToken; // End snippet }
private static IEnumerable <Build> GetAllBuilds(BuildStatus status = null) { var request = new ListBuildsRequest { Status = status }; do { var response = Client.ListBuilds(request); request.NextToken = response.NextToken; foreach (var build in response.Builds) { yield return(build); } } while (!string.IsNullOrEmpty(request.NextToken)); }
/// <summary> /// Retrieves the build details for all game server executables which are currently defined for the title /// </summary> public static void ListServerBuilds(ListBuildsRequest request, ListServerBuildsCallback resultCallback, ErrorCallback errorCallback, object customData = null) { if (PlayFabSettings.DeveloperSecretKey == null) throw new Exception ("Must have PlayFabSettings.DeveloperSecretKey set to call this method"); string serializedJSON = JsonConvert.SerializeObject(request, Util.JsonFormatting, Util.JsonSettings); Action<string,PlayFabError> callback = delegate(string responseStr, PlayFabError pfError) { ListBuildsResult result = null; ResultContainer<ListBuildsResult>.HandleResults(responseStr, ref pfError, out result); if(pfError != null && errorCallback != null) { errorCallback(pfError); } if(result != null) { result.CustomData = customData; result.Request = request; if(resultCallback != null) { resultCallback(result); } } }; PlayFabHTTP.Post(PlayFabSettings.GetURL()+"/Admin/ListServerBuilds", serializedJSON, "X-SecretKey", PlayFabSettings.DeveloperSecretKey, callback); }
/// <summary> /// Retrieves the build details for all game server executables which are currently defined for the title /// </summary> public static void ListServerBuilds(ListBuildsRequest request, Action<ListBuildsResult> resultCallback, Action<PlayFabError> errorCallback, object customData = null) { if (PlayFabSettings.DeveloperSecretKey == null) throw new Exception("Must have PlayFabSettings.DeveloperSecretKey set to call this method"); PlayFabHttp.MakeApiCall("/Admin/ListServerBuilds", request, AuthType.DevSecretKey, resultCallback, errorCallback, customData); }
public void ListBuildsAsync(ListBuildsRequest request, AmazonServiceCallback <ListBuildsRequest, ListBuildsResponse> callback, AsyncOptions options = null) { throw new System.NotImplementedException(); }
/// <summary> /// Retrieves the build details for all game server executables which are currently defined for the title /// </summary> public static void ListServerBuilds(ListBuildsRequest request, PlayFabResultCommon.ProcessApiCallback<ListBuildsResult> resultCallback, ErrorCallback errorCallback, object customData = null) { if (PlayFabSettings.DeveloperSecretKey == null) throw new Exception("Must have PlayFabSettings.DeveloperSecretKey set to call this method"); string serializedJson = JsonWrapper.SerializeObject(request, PlayFabUtil.ApiSerializerStrategy); Action<CallRequestContainer> callback = delegate(CallRequestContainer requestContainer) { ResultContainer<ListBuildsResult>.HandleResults(requestContainer, resultCallback, errorCallback, null); }; PlayFabHttp.Post("/Admin/ListServerBuilds", serializedJson, "X-SecretKey", PlayFabSettings.DeveloperSecretKey, callback, request, customData); }
/// <summary> /// Retrieves the build details for all game server executables which are currently defined for the title /// </summary> public static async Task<PlayFabResult<ListBuildsResult>> ListServerBuildsAsync(ListBuildsRequest request) { if (PlayFabSettings.DeveloperSecretKey == null) throw new Exception ("Must have PlayFabSettings.DeveloperSecretKey set to call this method"); object httpResult = await PlayFabHTTP.DoPost(PlayFabSettings.GetURL() + "/Admin/ListServerBuilds", request, "X-SecretKey", PlayFabSettings.DeveloperSecretKey); if(httpResult is PlayFabError) { PlayFabError error = (PlayFabError)httpResult; if (PlayFabSettings.GlobalErrorHandler != null) PlayFabSettings.GlobalErrorHandler(error); return new PlayFabResult<ListBuildsResult> { Error = error, }; } string resultRawJson = (string)httpResult; var serializer = JsonSerializer.Create(PlayFabSettings.JsonSettings); var resultData = serializer.Deserialize<PlayFabJsonSuccess<ListBuildsResult>>(new JsonTextReader(new StringReader(resultRawJson))); ListBuildsResult result = resultData.data; return new PlayFabResult<ListBuildsResult> { Result = result }; }