|
| 1 | +from __future__ import annotations |
| 2 | +from collections.abc import Callable |
| 3 | +from dataclasses import dataclass, field |
| 4 | +from kiota_abstractions.base_request_builder import BaseRequestBuilder |
| 5 | +from kiota_abstractions.base_request_configuration import RequestConfiguration |
| 6 | +from kiota_abstractions.default_query_parameters import QueryParameters |
| 7 | +from kiota_abstractions.get_path_parameters import get_path_parameters |
| 8 | +from kiota_abstractions.method import Method |
| 9 | +from kiota_abstractions.request_adapter import RequestAdapter |
| 10 | +from kiota_abstractions.request_information import RequestInformation |
| 11 | +from kiota_abstractions.request_option import RequestOption |
| 12 | +from kiota_abstractions.serialization import Parsable, ParsableFactory |
| 13 | +from typing import Any, Optional, TYPE_CHECKING, Union |
| 14 | +from warnings import warn |
| 15 | + |
| 16 | +if TYPE_CHECKING: |
| 17 | + from ....models.cloud_pc_service_plan_collection_response import CloudPcServicePlanCollectionResponse |
| 18 | + from ....models.o_data_errors.o_data_error import ODataError |
| 19 | + from .count.count_request_builder import CountRequestBuilder |
| 20 | + from .item.cloud_pc_service_plan_item_request_builder import CloudPcServicePlanItemRequestBuilder |
| 21 | + |
| 22 | +class ServicePlansRequestBuilder(BaseRequestBuilder): |
| 23 | + """ |
| 24 | + Provides operations to manage the servicePlans property of the microsoft.graph.virtualEndpoint entity. |
| 25 | + """ |
| 26 | + def __init__(self,request_adapter: RequestAdapter, path_parameters: Union[str, dict[str, Any]]) -> None: |
| 27 | + """ |
| 28 | + Instantiates a new ServicePlansRequestBuilder and sets the default values. |
| 29 | + param path_parameters: The raw url or the url-template parameters for the request. |
| 30 | + param request_adapter: The request adapter to use to execute the requests. |
| 31 | + Returns: None |
| 32 | + """ |
| 33 | + super().__init__(request_adapter, "{+baseurl}/deviceManagement/virtualEndpoint/servicePlans{?%24count,%24expand,%24filter,%24orderby,%24search,%24select,%24skip,%24top}", path_parameters) |
| 34 | + |
| 35 | + def by_cloud_pc_service_plan_id(self,cloud_pc_service_plan_id: str) -> CloudPcServicePlanItemRequestBuilder: |
| 36 | + """ |
| 37 | + Provides operations to manage the servicePlans property of the microsoft.graph.virtualEndpoint entity. |
| 38 | + param cloud_pc_service_plan_id: The unique identifier of cloudPcServicePlan |
| 39 | + Returns: CloudPcServicePlanItemRequestBuilder |
| 40 | + """ |
| 41 | + if cloud_pc_service_plan_id is None: |
| 42 | + raise TypeError("cloud_pc_service_plan_id cannot be null.") |
| 43 | + from .item.cloud_pc_service_plan_item_request_builder import CloudPcServicePlanItemRequestBuilder |
| 44 | + |
| 45 | + url_tpl_params = get_path_parameters(self.path_parameters) |
| 46 | + url_tpl_params["cloudPcServicePlan%2Did"] = cloud_pc_service_plan_id |
| 47 | + return CloudPcServicePlanItemRequestBuilder(self.request_adapter, url_tpl_params) |
| 48 | + |
| 49 | + async def get(self,request_configuration: Optional[RequestConfiguration[ServicePlansRequestBuilderGetQueryParameters]] = None) -> Optional[CloudPcServicePlanCollectionResponse]: |
| 50 | + """ |
| 51 | + List the currently available service plans that an organization can purchase for their Cloud PCs. For examples of currently available service plans, see Windows 365 compare plans and pricing. Currently, the Microsoft Graph API is available for Windows 365 Enterprise. |
| 52 | + param request_configuration: Configuration for the request such as headers, query parameters, and middleware options. |
| 53 | + Returns: Optional[CloudPcServicePlanCollectionResponse] |
| 54 | + Find more info here: https://learn.microsoft.com/graph/api/virtualendpoint-list-serviceplans?view=graph-rest-1.0 |
| 55 | + """ |
| 56 | + request_info = self.to_get_request_information( |
| 57 | + request_configuration |
| 58 | + ) |
| 59 | + from ....models.o_data_errors.o_data_error import ODataError |
| 60 | + |
| 61 | + error_mapping: dict[str, type[ParsableFactory]] = { |
| 62 | + "XXX": ODataError, |
| 63 | + } |
| 64 | + if not self.request_adapter: |
| 65 | + raise Exception("Http core is null") |
| 66 | + from ....models.cloud_pc_service_plan_collection_response import CloudPcServicePlanCollectionResponse |
| 67 | + |
| 68 | + return await self.request_adapter.send_async(request_info, CloudPcServicePlanCollectionResponse, error_mapping) |
| 69 | + |
| 70 | + def to_get_request_information(self,request_configuration: Optional[RequestConfiguration[ServicePlansRequestBuilderGetQueryParameters]] = None) -> RequestInformation: |
| 71 | + """ |
| 72 | + List the currently available service plans that an organization can purchase for their Cloud PCs. For examples of currently available service plans, see Windows 365 compare plans and pricing. Currently, the Microsoft Graph API is available for Windows 365 Enterprise. |
| 73 | + param request_configuration: Configuration for the request such as headers, query parameters, and middleware options. |
| 74 | + Returns: RequestInformation |
| 75 | + """ |
| 76 | + request_info = RequestInformation(Method.GET, self.url_template, self.path_parameters) |
| 77 | + request_info.configure(request_configuration) |
| 78 | + request_info.headers.try_add("Accept", "application/json") |
| 79 | + return request_info |
| 80 | + |
| 81 | + def with_url(self,raw_url: str) -> ServicePlansRequestBuilder: |
| 82 | + """ |
| 83 | + Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. |
| 84 | + param raw_url: The raw URL to use for the request builder. |
| 85 | + Returns: ServicePlansRequestBuilder |
| 86 | + """ |
| 87 | + if raw_url is None: |
| 88 | + raise TypeError("raw_url cannot be null.") |
| 89 | + return ServicePlansRequestBuilder(self.request_adapter, raw_url) |
| 90 | + |
| 91 | + @property |
| 92 | + def count(self) -> CountRequestBuilder: |
| 93 | + """ |
| 94 | + Provides operations to count the resources in the collection. |
| 95 | + """ |
| 96 | + from .count.count_request_builder import CountRequestBuilder |
| 97 | + |
| 98 | + return CountRequestBuilder(self.request_adapter, self.path_parameters) |
| 99 | + |
| 100 | + @dataclass |
| 101 | + class ServicePlansRequestBuilderGetQueryParameters(): |
| 102 | + """ |
| 103 | + List the currently available service plans that an organization can purchase for their Cloud PCs. For examples of currently available service plans, see Windows 365 compare plans and pricing. Currently, the Microsoft Graph API is available for Windows 365 Enterprise. |
| 104 | + """ |
| 105 | + def get_query_parameter(self,original_name: str) -> str: |
| 106 | + """ |
| 107 | + Maps the query parameters names to their encoded names for the URI template parsing. |
| 108 | + param original_name: The original query parameter name in the class. |
| 109 | + Returns: str |
| 110 | + """ |
| 111 | + if original_name is None: |
| 112 | + raise TypeError("original_name cannot be null.") |
| 113 | + if original_name == "count": |
| 114 | + return "%24count" |
| 115 | + if original_name == "expand": |
| 116 | + return "%24expand" |
| 117 | + if original_name == "filter": |
| 118 | + return "%24filter" |
| 119 | + if original_name == "orderby": |
| 120 | + return "%24orderby" |
| 121 | + if original_name == "search": |
| 122 | + return "%24search" |
| 123 | + if original_name == "select": |
| 124 | + return "%24select" |
| 125 | + if original_name == "skip": |
| 126 | + return "%24skip" |
| 127 | + if original_name == "top": |
| 128 | + return "%24top" |
| 129 | + return original_name |
| 130 | + |
| 131 | + # Include count of items |
| 132 | + count: Optional[bool] = None |
| 133 | + |
| 134 | + # Expand related entities |
| 135 | + expand: Optional[list[str]] = None |
| 136 | + |
| 137 | + # Filter items by property values |
| 138 | + filter: Optional[str] = None |
| 139 | + |
| 140 | + # Order items by property values |
| 141 | + orderby: Optional[list[str]] = None |
| 142 | + |
| 143 | + # Search items by search phrases |
| 144 | + search: Optional[str] = None |
| 145 | + |
| 146 | + # Select properties to be returned |
| 147 | + select: Optional[list[str]] = None |
| 148 | + |
| 149 | + # Skip the first n items |
| 150 | + skip: Optional[int] = None |
| 151 | + |
| 152 | + # Show only the first n items |
| 153 | + top: Optional[int] = None |
| 154 | + |
| 155 | + |
| 156 | + @dataclass |
| 157 | + class ServicePlansRequestBuilderGetRequestConfiguration(RequestConfiguration[ServicePlansRequestBuilderGetQueryParameters]): |
| 158 | + """ |
| 159 | + Configuration for the request such as headers, query parameters, and middleware options. |
| 160 | + """ |
| 161 | + warn("This class is deprecated. Please use the generic RequestConfiguration class generated by the generator.", DeprecationWarning) |
| 162 | + |
| 163 | + |
0 commit comments