/// <summary> /// Determines whether this instance and another specified <see cref="ResourceGroupMembershipStatus"/> object have the same value. /// </summary> /// <param name="value">The Resource Group Membership status to compare to this instance.</param> /// <returns>true if the value of the parameter is the same as the value of this instance; otherwise, false. If value is null, the method returns false.</returns> public bool Equals(ResourceGroupMembershipStatus value) { if (Object.ReferenceEquals(value, null)) { return(false); } if (Object.ReferenceEquals(this, value)) { return(true); } return(this.Name == value.Name); }
/// <summary> /// Parse Resource Group Membership status. /// </summary> /// <param name="name">Name of the Resource Group Membership status.</param> /// <returns><see cref="ResourceGroupMembershipStatus"/> for the name.</returns> public static ResourceGroupMembershipStatus Parse(string name) { ResourceGroupMembershipStatus resourceGroupMembershipStatus = null; if (name == null) { resourceGroupMembershipStatus = ResourceGroupMembershipStatus.Unknown; } else if (!RESOURCE_GROUP_MEMBERSHIP_STATUSES.TryGetValue(name, out resourceGroupMembershipStatus)) { resourceGroupMembershipStatus = new ResourceGroupMembershipStatus(name); } return(resourceGroupMembershipStatus); }
/// <summary> /// Updates Resource Group membership. /// </summary> /// <param name="resourceGroupMembership"><see cref="ResourceGroupMembership"/> to be updated.</param> /// <param name="resourceGroup"><see cref="ResourceGroup"/> to which this resource group membership belongs.</param> /// <param name="license"><see cref="License"/> for the Hybrid Services licensed feature.</param> /// <param name="person"><see cref="Person"/> to which this resource group membership is associated.</param> /// <param name="personOrganization"><see cref="Organization"/> for the person.</param> /// <param name="status">The activation status of the resource group membership.</param> /// <param name="cancellationToken"><see cref="CancellationToken"/> to be used for cancellation.</param> /// <returns><see cref="TeamsResult{TTeamsObject}"/> to get result.</returns> public Task <TeamsResult <ResourceGroupMembership> > UpdateResourceGroupMembershipAsync(ResourceGroupMembership resourceGroupMembership, ResourceGroup resourceGroup, License license, Person person, Organization personOrganization, ResourceGroupMembershipStatus status = null, CancellationToken?cancellationToken = null) { return(UpdateResourceGroupMembershipAsync(resourceGroupMembership.Id, resourceGroup.Id, license.Id, person.Id, personOrganization.Id, status, cancellationToken)); }
/// <summary> /// Updates Resource Group membership. /// </summary> /// <param name="resourceGroupMembership"><see cref="ResourceGroupMembership"/> to be updated.</param> /// <param name="resourceGroupId">The ID of the resource group to which this resource group membership belongs.</param> /// <param name="licenseId">The license ID for the Hybrid Services licensed feature.</param> /// <param name="personId">The ID of the person to which this resource group membership is associated.</param> /// <param name="personOrganizationId">The OrganizationId for the person.</param> /// <param name="status">The activation status of the resource group membership.</param> /// <param name="cancellationToken"><see cref="CancellationToken"/> to be used for cancellation.</param> /// <returns><see cref="TeamsResult{TTeamsObject}"/> to get result.</returns> public Task <TeamsResult <ResourceGroupMembership> > UpdateResourceGroupMembershipAsync(ResourceGroupMembership resourceGroupMembership, string resourceGroupId, string licenseId, string personId, string personOrganizationId, ResourceGroupMembershipStatus status = null, CancellationToken?cancellationToken = null) { return(UpdateResourceGroupMembershipAsync(resourceGroupMembership.Id, resourceGroupId, licenseId, personId, personOrganizationId, status, cancellationToken)); }
/// <summary> /// Updates Resource Group membership. /// </summary> /// <param name="resourceGroupMembershipId">The ID of the resource group membership.</param> /// <param name="resourceGroupId">The ID of the resource group to which this resource group membership belongs.</param> /// <param name="licenseId">The license ID for the Hybrid Services licensed feature.</param> /// <param name="personId">The ID of the person to which this resource group membership is associated.</param> /// <param name="personOrganizationId">The OrganizationId for the person.</param> /// <param name="status">personOrganizationId</param> /// <param name="cancellationToken"><see cref="CancellationToken"/> to be used for cancellation.</param> /// <returns><see cref="TeamsResult{TTeamsObject}"/> to get result.</returns> public async Task <TeamsResult <ResourceGroupMembership> > UpdateResourceGroupMembershipAsync(string resourceGroupMembershipId, string resourceGroupId, string licenseId, string personId, string personOrganizationId, ResourceGroupMembershipStatus status = null, CancellationToken?cancellationToken = null) { var membership = new ResourceGroupMembership { ResourceGroupId = resourceGroupId, LicenseId = licenseId, PersonId = personId, PersonOrganizationId = personOrganizationId, StatusName = status?.Name, }; var result = await this.teamsHttpClient.RequestJsonAsync <TeamsResult <ResourceGroupMembership>, ResourceGroupMembership>( HttpMethod.Put, new Uri(String.Format("{0}/{1}", TEAMS_RESOURCE_GROUP_MEMBERSHIP_API_PATH, Uri.EscapeDataString(resourceGroupMembershipId))), null, membership, cancellationToken); result.IsSuccessStatus = (result.IsSuccessStatus && (result.HttpStatusCode == System.Net.HttpStatusCode.OK)); return(result); }
/// <summary> /// Lists Resource Group Memberships. /// </summary> /// <param name="license">List resource group memberships for a license.</param> /// <param name="person">List resource group memberships for a person.</param> /// <param name="personOrganization">List resource group memberships for an organization.</param> /// <param name="status">Limit resource group memberships to a specific status.</param> /// <param name="max">Limit the maximum number of items in the response.</param> /// <param name="cancellationToken"><see cref="CancellationToken"/> to be used for cancellation.</param> /// <returns><see cref="TeamsResult{TTeamsObject}"/> to get result.</returns> public Task <TeamsListResult <ResourceGroupMembershipList> > ListResourceGroupMembershipsAsync(License license = null, Person person = null, Organization personOrganization = null, ResourceGroupMembershipStatus status = null, int?max = null, CancellationToken?cancellationToken = null) { return(ListResourceGroupMembershipsAsync(license?.Id, person?.Id, personOrganization?.Id, status, max, cancellationToken)); }
/// <summary> /// Lists Resource Group Memberships. /// </summary> /// <param name="licenseId">List resource group memberships for a license, by ID.</param> /// <param name="personId">List resource group memberships for a person, by ID.</param> /// <param name="personOrganizationId">List resource group memberships for an organization, by ID.</param> /// <param name="status">Limit resource group memberships to a specific status.</param> /// <param name="max">Limit the maximum number of items in the response.</param> /// <param name="cancellationToken"><see cref="CancellationToken"/> to be used for cancellation.</param> /// <returns><see cref="TeamsResult{TTeamsObject}"/> to get result.</returns> public async Task <TeamsListResult <ResourceGroupMembershipList> > ListResourceGroupMembershipsAsync(string licenseId = null, string personId = null, string personOrganizationId = null, ResourceGroupMembershipStatus status = null, int?max = null, CancellationToken?cancellationToken = null) { var queryParameters = new NameValueCollection(); queryParameters.Add("licenseId", licenseId); queryParameters.Add("personId", personId); queryParameters.Add("personOrgId", personOrganizationId); queryParameters.Add("status", status?.Name); queryParameters.Add("max", max?.ToString()); var result = await this.teamsHttpClient.RequestJsonAsync <TeamsListResult <ResourceGroupMembershipList>, ResourceGroupMembershipList>( HttpMethod.Get, TEAMS_RESOURCE_GROUP_MEMBERSHIP_API_URI, queryParameters, null, cancellationToken); result.IsSuccessStatus = (result.IsSuccessStatus && (result.HttpStatusCode == System.Net.HttpStatusCode.OK)); return(result); }