Documentation ¶
Overview ¶
* CarbonAware.WebApi, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * API version: 1.0 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
* CarbonAware.WebApi, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * API version: 1.0 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
* CarbonAware.WebApi, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * API version: 1.0 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
* CarbonAware.WebApi, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * API version: 1.0 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
* CarbonAware.WebApi, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * API version: 1.0 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
* CarbonAware.WebApi, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * API version: 1.0 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
* CarbonAware.WebApi, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * API version: 1.0 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
* CarbonAware.WebApi, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * API version: 1.0 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
* CarbonAware.WebApi, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * API version: 1.0 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
* CarbonAware.WebApi, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * API version: 1.0 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
* CarbonAware.WebApi, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * API version: 1.0 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
* CarbonAware.WebApi, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * API version: 1.0 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
Index ¶
- Variables
- func CacheExpires(r *http.Response) time.Time
- type APIClient
- type APIKey
- type APIResponse
- type BasicAuth
- type CarbonAwareApiBatchForecastDataAsyncOpts
- type CarbonAwareApiGetAverageCarbonIntensityBatchOpts
- type CarbonAwareApiGetBestEmissionsDataForLocationsByTimeOpts
- type CarbonAwareApiGetCurrentForecastDataOpts
- type CarbonAwareApiGetEmissionsDataForLocationByTimeOpts
- type CarbonAwareApiGetEmissionsDataForLocationsByTimeOpts
- type CarbonAwareApiService
- func (a *CarbonAwareApiService) BatchForecastDataAsync(ctx context.Context, ...) ([]EmissionsForecastDto, *http.Response, error)
- func (a *CarbonAwareApiService) GetAverageCarbonIntensity(ctx context.Context, location string, startTime time.Time, endTime time.Time) (CarbonIntensityDto, *http.Response, error)
- func (a *CarbonAwareApiService) GetAverageCarbonIntensityBatch(ctx context.Context, ...) ([]CarbonIntensityDto, *http.Response, error)
- func (a *CarbonAwareApiService) GetBestEmissionsDataForLocationsByTime(ctx context.Context, location []string, ...) ([]EmissionsData, *http.Response, error)
- func (a *CarbonAwareApiService) GetCurrentForecastData(ctx context.Context, location []string, ...) ([]EmissionsForecastDto, *http.Response, error)
- func (a *CarbonAwareApiService) GetEmissionsDataForLocationByTime(ctx context.Context, location string, ...) ([]EmissionsData, *http.Response, error)
- func (a *CarbonAwareApiService) GetEmissionsDataForLocationsByTime(ctx context.Context, location []string, ...) ([]EmissionsData, *http.Response, error)
- type CarbonIntensityBatchParametersDto
- type CarbonIntensityDto
- type Configuration
- type EmissionsData
- type EmissionsDataDto
- type EmissionsForecastBatchParametersDto
- type EmissionsForecastDto
- type GenericSwaggerError
- type Location
- type LocationsApiService
Constants ¶
This section is empty.
Variables ¶
var ( // Namespace gets the env variable for the current namespace name. Namespace = os.Getenv("NAMESPACE_NAME") // PodName gets the env variable for the current pod. PodName = os.Getenv("POD_NAME") // ContextOAuth2 takes a oauth2.TokenSource as authentication for the request. ContextOAuth2 = contextKey("token") // ContextBasicAuth takes BasicAuth as authentication for the request. ContextBasicAuth = contextKey("basic") // ContextAccessToken takes a string oauth2 access token as authentication for the request. ContextAccessToken = contextKey("accesstoken") // ContextAPIKey takes an APIKey as authentication for the request ContextAPIKey = contextKey("apikey") )
Functions ¶
Types ¶
type APIClient ¶
type APIClient struct { CarbonAwareApi *CarbonAwareApiService LocationsApi *LocationsApiService // contains filtered or unexported fields }
APIClient manages communication with the CarbonAware.WebApi, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null API v1.0 In most cases there should be only one, shared, APIClient.
func NewAPIClient ¶
func NewAPIClient(cfg *Configuration) *APIClient
NewAPIClient creates a new API client. Requires a userAgent string describing your application. optionally a custom http.Client to allow for advanced features such as caching.
func (*APIClient) ChangeBasePath ¶
Change base path to allow switching to mocks
type APIKey ¶
APIKey provides API key based authentication to a request passed via context using ContextAPIKey
type APIResponse ¶
type APIResponse struct { *http.Response `json:"-"` Message string `json:"message,omitempty"` // Operation is the name of the swagger operation. Operation string `json:"operation,omitempty"` // RequestURL is the request URL. This value is always available, even if the // embedded *http.Response is nil. RequestURL string `json:"url,omitempty"` // Method is the HTTP method used for the request. This value is always // available, even if the embedded *http.Response is nil. Method string `json:"method,omitempty"` // Payload holds the contents of the response body (which may be nil or empty). // This is provided here as the raw response.Body() reader will have already // been drained. Payload []byte `json:"-"` }
func NewAPIResponse ¶
func NewAPIResponse(r *http.Response) *APIResponse
func NewAPIResponseWithError ¶
func NewAPIResponseWithError(errorMessage string) *APIResponse
type BasicAuth ¶
type BasicAuth struct { UserName string `json:"userName,omitempty"` Password string `json:"password,omitempty"` }
BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth
type CarbonAwareApiService ¶
type CarbonAwareApiService service
func (*CarbonAwareApiService) BatchForecastDataAsync ¶
func (a *CarbonAwareApiService) BatchForecastDataAsync(ctx context.Context, localVarOptionals *CarbonAwareApiBatchForecastDataAsyncOpts) ([]EmissionsForecastDto, *http.Response, error)
func (*CarbonAwareApiService) GetAverageCarbonIntensity ¶
func (a *CarbonAwareApiService) GetAverageCarbonIntensity(ctx context.Context, location string, startTime time.Time, endTime time.Time) (CarbonIntensityDto, *http.Response, error)
CarbonAwareApiService Retrieves the measured carbon intensity data between the time boundaries and calculates the average carbon intensity during that period. This endpoint is useful for reporting the measured carbon intensity for a specific time period in a specific location.
- @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
- @param location The location name where workflow is run
- @param startTime The time at which the workflow we are measuring carbon intensity for started
- @param endTime The time at which the workflow we are measuring carbon intensity for ended
@return CarbonIntensityDto
func (*CarbonAwareApiService) GetAverageCarbonIntensityBatch ¶
func (a *CarbonAwareApiService) GetAverageCarbonIntensityBatch(ctx context.Context, localVarOptionals *CarbonAwareApiGetAverageCarbonIntensityBatchOpts) ([]CarbonIntensityDto, *http.Response, error)
func (*CarbonAwareApiService) GetBestEmissionsDataForLocationsByTime ¶
func (a *CarbonAwareApiService) GetBestEmissionsDataForLocationsByTime(ctx context.Context, location []string, localVarOptionals *CarbonAwareApiGetBestEmissionsDataForLocationsByTimeOpts) ([]EmissionsData, *http.Response, error)
func (*CarbonAwareApiService) GetCurrentForecastData ¶
func (a *CarbonAwareApiService) GetCurrentForecastData(ctx context.Context, location []string, localVarOptionals *CarbonAwareApiGetCurrentForecastDataOpts) ([]EmissionsForecastDto, *http.Response, error)
func (*CarbonAwareApiService) GetEmissionsDataForLocationByTime ¶
func (a *CarbonAwareApiService) GetEmissionsDataForLocationByTime(ctx context.Context, location string, localVarOptionals *CarbonAwareApiGetEmissionsDataForLocationByTimeOpts) ([]EmissionsData, *http.Response, error)
func (*CarbonAwareApiService) GetEmissionsDataForLocationsByTime ¶
func (a *CarbonAwareApiService) GetEmissionsDataForLocationsByTime(ctx context.Context, location []string, localVarOptionals *CarbonAwareApiGetEmissionsDataForLocationsByTimeOpts) ([]EmissionsData, *http.Response, error)
type CarbonIntensityBatchParametersDto ¶
type CarbonIntensityBatchParametersDto struct { // The location name where workflow is run Location string `json:"location,omitempty"` // The time at which the workflow we are measuring carbon intensity for started StartTime time.Time `json:"startTime,omitempty"` // The time at which the workflow we are measuring carbon intensity for ended EndTime time.Time `json:"endTime,omitempty"` }
type CarbonIntensityDto ¶
type CarbonIntensityDto struct { // the location name where workflow is run Location string `json:"location,omitempty"` // the time at which the workflow we are measuring carbon intensity for started StartTime time.Time `json:"startTime,omitempty"` // the time at which the workflow we are measuring carbon intensity for ended EndTime time.Time `json:"endTime,omitempty"` // Value of the marginal carbon intensity in grams per kilowatt-hour. CarbonIntensity float64 `json:"carbonIntensity,omitempty"` }
type Configuration ¶
type Configuration struct { BasePath string `json:"basePath,omitempty"` Host string `json:"host,omitempty"` Scheme string `json:"scheme,omitempty"` DefaultHeader map[string]string `json:"defaultHeader,omitempty"` UserAgent string `json:"userAgent,omitempty"` HTTPClient *http.Client }
func NewConfiguration ¶
func NewConfiguration() *Configuration
func (*Configuration) AddDefaultHeader ¶
func (c *Configuration) AddDefaultHeader(key string, value string)
type EmissionsData ¶
type EmissionsDataDto ¶
type EmissionsForecastBatchParametersDto ¶
type EmissionsForecastBatchParametersDto struct { // For historical forecast requests, this value is the timestamp used to access the most recently generated forecast as of that time. RequestedAt time.Time `json:"requestedAt,omitempty"` // The location of the forecast Location string `json:"location,omitempty"` // Start time boundary of forecasted data points.Ignores current forecast data points before this time. Defaults to the earliest time in the forecast data. DataStartAt time.Time `json:"dataStartAt,omitempty"` // End time boundary of forecasted data points. Ignores current forecast data points after this time. Defaults to the latest time in the forecast data. DataEndAt time.Time `json:"dataEndAt,omitempty"` // The estimated duration (in minutes) of the workload. Defaults to the duration of a single forecast data point. WindowSize int32 `json:"windowSize,omitempty"` }
type EmissionsForecastDto ¶
type EmissionsForecastDto struct { // Timestamp when the forecast was generated. GeneratedAt time.Time `json:"generatedAt,omitempty"` // For current requests, this value is the timestamp the request for forecast data was made. For historical forecast requests, this value is the timestamp used to access the most recently generated forecast as of that time. RequestedAt time.Time `json:"requestedAt,omitempty"` // The location of the forecast Location string `json:"location,omitempty"` // Start time boundary of forecasted data points. Ignores forecast data points before this time. Defaults to the earliest time in the forecast data. DataStartAt time.Time `json:"dataStartAt,omitempty"` // End time boundary of forecasted data points. Ignores forecast data points after this time. Defaults to the latest time in the forecast data. DataEndAt time.Time `json:"dataEndAt,omitempty"` // The estimated duration (in minutes) of the workload. Defaults to the duration of a single forecast data point. WindowSize int32 `json:"windowSize,omitempty"` // The optimal forecasted data point within the 'forecastData' array. Null if 'forecastData' array is empty. OptimalDataPoints []EmissionsDataDto `json:"optimalDataPoints,omitempty"` // The forecasted data points transformed and filtered to reflect the specified time and window parameters. Points are ordered chronologically; Empty array if all data points were filtered out. E.G. dataStartAt and dataEndAt times outside the forecast period; windowSize greater than total duration of forecast data; ForecastData []EmissionsDataDto `json:"forecastData,omitempty"` }
type GenericSwaggerError ¶
type GenericSwaggerError struct {
// contains filtered or unexported fields
}
GenericSwaggerError Provides access to the body, error and model on returned errors.
func (GenericSwaggerError) Body ¶
func (e GenericSwaggerError) Body() []byte
Body returns the raw bytes of the response
func (GenericSwaggerError) Error ¶
func (e GenericSwaggerError) Error() string
Error returns non-empty string if there was an error.
func (GenericSwaggerError) Model ¶
func (e GenericSwaggerError) Model() interface{}
Model returns the unpacked model of the error
type LocationsApiService ¶
type LocationsApiService service
func (*LocationsApiService) GetAllLocations ¶
func (a *LocationsApiService) GetAllLocations(ctx context.Context) (map[string]Location, *http.Response, error)
LocationsApiService Get all locations instances
- @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return map[string]Location
Source Files ¶
- api_carbon_aware.go
- api_locations.go
- client.go
- configuration.go
- model_carbon_intensity_batch_parameters_dto.go
- model_carbon_intensity_dto.go
- model_emissions_data.go
- model_emissions_data_dto.go
- model_emissions_forecast_batch_parameters_dto.go
- model_emissions_forecast_dto.go
- model_location.go
- response.go