public async Task CreateListUpdatePortalRevision() { Environment.SetEnvironmentVariable("AZURE_TEST_MODE", "Playback"); using (MockContext context = MockContext.Start(this.GetType())) { var testBase = new ApiManagementTestBase(context); testBase.TryCreateApiManagementService(); var revisionId = TestUtilities.GenerateName("revisionId"); var portalRevisionContract = new PortalRevisionContract { Description = new string('a', 99), IsCurrent = true }; // create portal revision var portalRevision = await testBase.client.PortalRevision.CreateOrUpdateAsync( testBase.rgName, testBase.serviceName, revisionId, portalRevisionContract); Assert.NotNull(portalRevision); Assert.True(portalRevision.IsCurrent); Assert.Equal("completed", portalRevision.Status); //get var getPortalRevision = testBase.client.PortalRevision.Get( testBase.rgName, testBase.serviceName, revisionId); Assert.NotNull(getPortalRevision); Assert.True(portalRevision.IsCurrent); Assert.Equal("completed", portalRevision.Status); var updateDescription = "Updated " + portalRevisionContract.Description; var updatedResult = await testBase.client.PortalRevision.UpdateAsync( testBase.rgName, testBase.serviceName, revisionId, new PortalRevisionContract { Description = updateDescription }, "*"); Assert.NotNull(updatedResult); Assert.True(portalRevision.IsCurrent); Assert.Equal("completed", updatedResult.Status); Assert.Equal(updateDescription, updatedResult.Description); //list var listPortalRevision = testBase.client.PortalRevision.ListByService( testBase.rgName, testBase.serviceName); Assert.NotNull(listPortalRevision); } }
/// <summary> /// Updates the description of specified portal revision or makes it current. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='resourceGroupName'> /// The name of the resource group. /// </param> /// <param name='serviceName'> /// The name of the API Management service. /// </param> /// <param name='portalRevisionId'> /// Portal revision identifier. Must be unique in the current API Management /// service instance. /// </param> /// <param name='parameters'> /// </param> /// <param name='ifMatch'> /// ETag of the Entity. ETag should match the current entity state from the /// header response of the GET request or it should be * for unconditional /// update. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <PortalRevisionContract> BeginUpdateAsync(this IPortalRevisionOperations operations, string resourceGroupName, string serviceName, string portalRevisionId, PortalRevisionContract parameters, string ifMatch, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, serviceName, portalRevisionId, parameters, ifMatch, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// Updates the description of specified portal revision or makes it current. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='resourceGroupName'> /// The name of the resource group. /// </param> /// <param name='serviceName'> /// The name of the API Management service. /// </param> /// <param name='portalRevisionId'> /// Portal revision identifier. Must be unique in the current API Management /// service instance. /// </param> /// <param name='parameters'> /// </param> /// <param name='ifMatch'> /// ETag of the Entity. ETag should match the current entity state from the /// header response of the GET request or it should be * for unconditional /// update. /// </param> public static PortalRevisionContract BeginUpdate(this IPortalRevisionOperations operations, string resourceGroupName, string serviceName, string portalRevisionId, PortalRevisionContract parameters, string ifMatch) { return(operations.BeginUpdateAsync(resourceGroupName, serviceName, portalRevisionId, parameters, ifMatch).GetAwaiter().GetResult()); }