<commit_before>/*
Copyright 2019 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package meta

import (
	"bytes"
	"encoding/json"
	"fmt"
	"io/ioutil"
	"os"
	"regexp"
	"sort"
	"strings"
	"unicode"

	"k8s.io/apimachinery/pkg/util/sets"
)

const (
	// This assumes that alpha contains a superset of all struct fields
	apiFilePath = "./vendor/google.golang.org/api/compute/v0.alpha/compute-api.json"
)

// MainServices describes all of the API types that we want to define all the helper functions for
// The other types that are discovered as dependencies will simply be wrapped with a composite struct
// The format of the map is ServiceName -> k8s-cloud-provider wrapper name
var MainServices = map[string]string{
	"BackendService":                  "BackendServices",
	"ForwardingRule":                  "ForwardingRules",
	"HealthCheck":                     "HealthChecks",
	"UrlMap":                          "UrlMaps",
	"TargetHttpProxy":                 "TargetHttpProxies",
	"TargetHttpsProxy":                "TargetHttpsProxies",
	"SslCertificate":                  "SslCertificates",
	"NetworkEndpointGroup":            "NetworkEndpointGroups",
	"NetworkEndpointWithHealthStatus": "NetworkEndpointsWithHealthStatus",
	"NetworkEndpointGroupsAttachEndpointsRequest": "NetworkEndpointGroupsAttachEndpointsRequests",
	"NetworkEndpointGroupsDetachEndpointsRequest": "NetworkEndpointGroupsDetachEndpointsRequests",
	"NetworkEndpointGroupsListEndpointsRequest":   "NetworkEndpointGroupsListEndpointsRequests",
}

// TODO: (shance) Replace this with data gathered from meta.AllServices
// Services in NoUpdate will not have an Update() method generated for them
var NoUpdate = sets.NewString(
	"ForwardingRule",
	"TargetHttpProxy",
	"TargetHttpsProxy",
	"SslCertificate",
	"NetworkEndpointGroup",
	"NetworkEndpointWithHealthStatus",
)

// Services in NoCRUD will not have Create, Get, Delete, Update, methods generated for them
var NoCRUD = sets.NewString(
	"NetworkEndpointGroupsAttachEndpointsRequest",
	"NetworkEndpointGroupsDetachEndpointsRequest",
	"NetworkEndpointGroupsListEndpointsRequest",
	"NetworkEndpointWithHealthStatus",
)
var Versions = map[string]string{
	"Alpha": "alpha",
	"Beta":  "beta",
	"GA":    "",
}

// TODO (shance) Replace this with data gathered from meta.AllServices or discovery doc
// DefaultRegionalServices contains services which are regional by default.
// Their global type is explicitly labeled (e.g. GlobalForwardingRule)
var DefaultRegionalServices = sets.NewString(
	"ForwardingRule",<commit_msg>more composite changes for neg mocks<commit_after>/*
Copyright 2019 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package meta

import (
	"bytes"
	"encoding/json"
	"fmt"
	"io/ioutil"
	"os"
	"regexp"
	"sort"
	"strings"
	"unicode"

	"k8s.io/apimachinery/pkg/util/sets"
)

const (
	// This assumes that alpha contains a superset of all struct fields
	apiFilePath = "./vendor/google.golang.org/api/compute/v0.alpha/compute-api.json"
)

// MainServices describes all of the API types that we want to define all the helper functions for
// The other types that are discovered as dependencies will simply be wrapped with a composite struct
// The format of the map is ServiceName -> k8s-cloud-provider wrapper name
var MainServices = map[string]string{
	"BackendService":                  "BackendServices",
	"ForwardingRule":                  "ForwardingRules",
	"HealthCheck":                     "HealthChecks",
	"HealthStatusForNetworkEndpoint":  "HealthStatusForNetworkEndpoints",
	"UrlMap":                          "UrlMaps",
	"TargetHttpProxy":                 "TargetHttpProxies",
	"TargetHttpsProxy":                "TargetHttpsProxies",
	"SslCertificate":                  "SslCertificates",
	"NetworkEndpointGroup":            "NetworkEndpointGroups",
	"NetworkEndpoint":                 "NetworkEndpoints",
	"NetworkEndpointWithHealthStatus": "NetworkEndpointsWithHealthStatus",
	"NetworkEndpointGroupsAttachEndpointsRequest": "NetworkEndpointGroupsAttachEndpointsRequests",
	"NetworkEndpointGroupsDetachEndpointsRequest": "NetworkEndpointGroupsDetachEndpointsRequests",
	"NetworkEndpointGroupsListEndpointsRequest":   "NetworkEndpointGroupsListEndpointsRequests",
}

// TODO: (shance) Replace this with data gathered from meta.AllServices
// Services in NoUpdate will not have an Update() method generated for them
var NoUpdate = sets.NewString(
	"ForwardingRule",
	"HealthStatusForNetworkEndpoint",
	"TargetHttpProxy",
	"TargetHttpsProxy",
	"SslCertificate",
	"NetworkEndpointGroup",
	"NetworkEndpoint",
	"NetworkEndpointWithHealthStatus",
)

// Services in NoCRUD will not have Create, Get, Delete, Update, methods generated for them
var NoCRUD = sets.NewString(
	"HealthStatusForNetworkEndpoint",
	"NetworkEndpointGroupsAttachEndpointsRequest",
	"NetworkEndpointGroupsDetachEndpointsRequest",
	"NetworkEndpointGroupsListEndpointsRequest",
	"NetworkEndpoint",
	"NetworkEndpointWithHealthStatus",
)
var Versions = map[string]string{
	"Alpha": "alpha",
	"Beta":  "beta",
	"GA":    "",
}

// TODO (shance) Replace this with data gathered from meta.AllServices or discovery doc
// DefaultRegionalServices contains services which are regional by default.
// Their global type is explicitly labeled (e.g. GlobalForwardingRule)
var DefaultRegionalServices = sets.NewString(
	"ForwardingRule",
{'fraction_non_alphanumeric': 0.08720379146919431, 'fraction_numerical': 0.0034755134281200632, 'mean_word_length': 4.538932633420822, 'pattern_counts': {'":': 32, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4980697', 'n_tokens_mistral': 1739, 'n_tokens_neox': 1708, 'n_words': 556}