text:
@article{Morishita2015,
abstract = {The routine tuberculosis (TB) surveillance system in Cambodia has been strengthened under the National TB Programme (NTP). This paper provides an overview of the TB surveillance data for Cambodia at the national level for the period 2000 to 2013 and at the subnational level for 2013. The proportion of the total population that were screened for TB rose from 0.4{\%} in 2001 to 1.1{\%} in 2013, while the smear-positivity rate decreased from 28.9{\%} to 8.1{\%} in the same period. The total number of notified TB cases increased steadily from 2000; this has stabilized in recent years with 39 055 cases notified in 2013. The proportion of all TB cases that were smear-positive decreased from 78{\%} in 2000 to 36{\%} in 2013. Case notification rates (CNRs) for all forms of TB and new smear-positive TB in 2013 were 261 and 94 per 100 000 population, respectively. Higher CNRs were found in the north-west and south-east parts of the country and were higher for males especially in older age groups. The increase in TB screening, decline in the smear-positive rate and decline in notified smear-positive TB cases likely reflect a long-term positive impact of the NTP. A negative correlation between the proportion of the population screened and the smear-positivity rate at the subnational level helped identify where to find undiagnosed cases. Subnational differences in case notification of the elderly and in children provide more specific targets for case-finding and further encourage strategic resource allocation.},
author = {Morishita, Fukushi and Burrus-Furphy, Valerie and Kobayashi, Miwako and Nishikiori, Nobuyuki and Eang, Mao Tan and Yadav, Rajendra-Prasad},
doi = {10.5365/wpsar.2014.5.4.005},
file = {:D$\backslash$:/Users/hiattt/AppData/Local/Mendeley Ltd/Mendeley Desktop/Downloaded/289-2788-6-PB.pdf:pdf},
issn = {20947321},
journal = {Western Pacific Surveillance and Response Journal},
number = {1},
pages = {1--10},
title = {{Tuberculosis case-finding in Cambodia: analysis of case notification data, 2000 to 2013}},
url = {http://ojs.wpro.who.int/ojs/index.php/wpsar/article/view/289/449},
volume = {6},
year = {2015}
}
@article{Borgdorff2000,
abstract = {OBJECTIVE To explore whether lower tuberculosis notification rates among women are due to a reduced access to health care, particularly diagnostic services, for women. METHODS Age- and sex-specific tuberculosis prevalence rates of smear-positive tuberculosis were obtained from tuberculosis prevalence surveys reported to the WHO or published in the literature. Age- and sex-specific notification rates from the same countries in 1996 were used. RESULTS Prevalence data and notifications from 29 surveys in 14 countries were used. Notification rates varied strongly among countries, but the female/male ratio was below 1 and decreased with increasing age in almost all. The female/male (F/M) prevalence ratios were less than 0.5 in surveys in the South-East Asia and Western Pacific Region, and approximately 1 in the African Region. CONCLUSION In most countries the F/M sex ratio in prevalent cases was similar or lower than that in notified cases, suggesting that F/M differences in notification rates may be largely due to epidemiological differences and not to differential access to health care. However, available data are limited as the prevalence surveys in Africa were carried out many years ago, and in Asia notification rates may be distorted by a large private sector with deficiencies in notification.},
author = {Borgdorff, Martien W. and Nagelkerke, N. J D and Dye, C. and Nunn, P.},
file = {:D$\backslash$:/Users/hiattt/AppData/Local/Mendeley Ltd/Mendeley Desktop/Downloaded/4DC07EFBC42C3006145524097972FA4DD6B79B2015.pdf:pdf},
isbn = {1027-3719 (Print)$\backslash$n1027-3719 (Linking)},
issn = {10273719},
journal = {International Journal of Tuberculosis and Lung Disease},
keywords = {Case detection,Gender,Notification,Prevalence surveys,Tuberculosis},
number = {2},
pages = {123--132},
pmid = {10694090},
title = {{Gender and tuberculosis: A comparison of prevalence surveys with notification data to explore sex differences in case detection}},
volume = {4},
year = {2000}
}
@article{Uplekar,
abstract = {Although a seventy per cent excess of male over female TB cases are reported globally each year, the reasons for this difference are unclear. Generally, women in poor countries confront more barriers than men in accessing health care services. Yet, research is lacking to explain the impact of gender inequalities in access to care on reported sex ratios for TB. A review of the limited available literature and field visits to TB programmes offered insights and suggested a framework to study gender differentials in TB. This paper considers the role of gender at various steps in effective TB care. A research strategy to study and account for gender differences in TB control is proposed.},
author = {Uplekar, M.W. W. and Rangan, S. and Weiss, M.G. G. and Ogden, J. and Borgdorff, M.W. W. and Hudelson, P.},
file = {:D$\backslash$:/Users/hiattt/AppData/Local/Mendeley Ltd/Mendeley Desktop/Downloaded/24574C56CC93510C1455180401F329D5DBC545DFA6.pdf:pdf},
journal = {International Journal of Tuberculosis and Lung Disease},
keywords = {Access to care,Gender,Research strategy,Sex,Tuberculosis},
number = {3},
pages = {220--224},
publisher = {International Union Against Tuberculosis and Lung Disease},
title = {{Attention to gender issues in tuberculosis control}},
url = {http://www.ingentaconnect.com/content/iuatld/ijtld/2001/00000005/00000003/art00005},
volume = {5},
year = {2001}
}
@article{Thorson2001,
abstract = {Tuberculosis (TB) kills approximately 1 million women per year and it is estimated that almost 1 billion women and girls are infected with TB worldwide. Gender aspects of TB have been neglected in the research, and little attention is given to gender in TB-control programs. This review brings together the most important publications on gender and TB during 1999 and 2000 and illuminates areas where gender has an impact on the disease and its control. Even though only a limited number of publications on gender aspects of TB are available, some interesting findings were presented during the past year. Studies from Vietnam have shown that women with pulmonary TB are diagnosed on average 2 weeks later than men because of delays from the health care provider. In a study of persons with cough it was found that men were given sputum examinations more often than women. These and other findings are discussed in relation to the hypothesis that women with TB are under-notified.},
author = {Thorson, A and Diwan, V K},
issn = {1070-5287},
journal = {Current opinion in pulmonary medicine},
keywords = {Disease Notification,Disease Notification: statistics {\&} numerical data,Humans,Incidence,Infection,Infection: epidemiology,Patient Compliance,Patient Compliance: statistics {\&} numerical data,Sex Factors,Socioeconomic Factors,Tuberculosis,Tuberculosis: epidemiology,Women's Health},
month = {may},
number = {3},
pages = {165--9},
pmid = {11371773},
title = {{Gender inequalities in tuberculosis: aspects of infection, notification rates, and compliance.}},
url = {http://www.ncbi.nlm.nih.gov/pubmed/11371773},
volume = {7},
year = {2001}
}
@book{WorldHealthOrganisation2013,
address = {Geneva},
author = {{World HealthOrganisation}},
file = {:D$\backslash$:/Users/hiattt/AppData/Local/Mendeley Ltd/Mendeley Desktop/Downloaded/Bookshelf{\_}NBK294083.pdf:pdf},
isbn = {978 92 4 154860 1},
pages = {27--28},
title = {{Systematic screening for active tuberculosis: principles and recommendations.}},
year = {2013}
}
@misc{Lonnroth2013,
abstract = {The impact of current interventions to improve early detection of tuberculosis (TB) seems to have been saturated. Case detection trends have stagnated. TB incidence is falling in most settings worldwide, but the rate of decline is far lower than expected. There is growing evidence from national TB prevalence surveys and other research of a large pool of undetected TB in the community. Intensified efforts to further break down access barriers and scale up new and rapid diagnostic tools are likely to improve the situation. However, will these be enough? Or do we also need to reach out more towards people who do not actively seek care with well-recognisable TB symptoms? There have recently been calls to revisit TB screening, particularly in high-risk groups. The World Health Organization (WHO) recommends screening for TB in people with human immunodeficiency virus infection and in close TB contacts. Should other risk groups also be screened systematically? Could mass, community-wide screening, which the WHO has discouraged over the past four decades, be of benefit in some situations? If so, what screening tools and approaches should be used? The WHO is in the process of seeking answers to these questions and developing guidelines on systematic screening for active TB. In this article, we present the rationale, definitions and key considerations underpinning this process.},
author = {Lonnroth, K. and Corbett, E. and Golub, J. and Godfrey-Faussett, P. and Uplekar, M. and Weil, D. and Raviglione, M.},
booktitle = {International Journal of Tuberculosis and Lung Disease},
doi = {10.5588/ijtld.12.0797},
isbn = {1815-7920 (Electronic)$\backslash$n1027-3719 (Linking)},
issn = {10273719},
keywords = {Active case finding,Guidelines,Policy,Tuberculosis},
number = {3},
pages = {289--298},
pmid = {23407219},
title = {{Systematic screening for active tuberculosis: Rationale, definitions and key considerations}},
volume = {17},
year = {2013}
}
@misc{WorldHealthOrganization,
author = {{World Health Organization}},
title = {{Global tuberculosis database}},
url = {www.who.int/tb/data},
urldate = {2015-11-20}
}
@book{WorldHealthOrganization2014b,
address = {Geneva},
file = {:D$\backslash$:/Users/hiattt/AppData/Local/Mendeley Ltd./Mendeley Desktop/Downloaded/Unknown - 2014 - Standards and benchmarks for tuberculosis surveillance and vital registration systems checklist and user guide.pdf:pdf},
institution = {World Health Organization},
title = {{Standards and benchmarks for tuberculosis surveillance and vital registration systems: checklist and user guide}},
url = {http://apps.who.int/iris/handle/10665/112673},
year = {2014}
}
@techreport{WorldHealthOrganization2009,
address = {Geneva},
doi = {10.1016/S0140-6736(14)61244-7},
file = {:D$\backslash$:/Users/hiattt/AppData/Local/Mendeley Ltd./Mendeley Desktop/Downloaded/Unknown - 2009 - TB Impact Measurement Policy and recommendations for how to assess the epidemiological burden of TB and the impact of T.pdf:pdf},
institution = {World Health Organization},
issn = {01406736},
month = {jul},
number = {9940},
title = {{TB Impact Measurement: Policy and recommendations for how to assess the epidemiological burden of TB and the impact of TB control.}},
url = {http://whqlibdoc.who.int/publications/2009/9789241598828{\_}eng.pdf},
volume = {384},
year = {2009}
}
@article{Wang2007,
abstract = {China has the world's second largest tuberculosis epidemic, but progress in tuberculosis control was slow during the 1990s. Detection of tuberculosis had stagnated at around 30{\%} of the estimated total of new cases, and multidrug-resistant tuberculosis was a major problem. These signs of inadequate tuberculosis control can be linked to a malfunctioning health system. The spread of severe acute respiratory syndrome (SARS) in 2003, brought to light substantial weaknesses in the country's public-health system. After the SARS epidemic was brought under control, the government increased its commitment and leadership to tackle public-health problems and, among other efforts, increased public-health funding, revised laws that concerned the control of infectious diseases, implemented the world's largest internet-based disease reporting system, and started a programme to rebuild local public-health facilities. These measures contributed to acceleration in efforts to control tuberculosis. By 2005, the detection of cases of tuberculosis had increased to 80{\%} of the estimated total new cases, permitting China to achieve the 2005 global tuberculosis control targets. At the same time, specific efforts to improve tuberculosis control also contributed to strengthening of the public-health system. We examine how the strengthening of a disease control programme and the public-health system worked together to achieve a desired health outcome. ?? 2007 Elsevier Ltd. All rights reserved.},
author = {Wang, Longde and Liu, Jianjun and Chin, Daniel P.},
doi = {10.1016/S0140-6736(07)60316-X},
isbn = {1474-547X (Electronic)$\backslash$n0140-6736 (Linking)},
issn = {01406736},
journal = {Lancet},
pages = {691--696},
pmid = {17321314},
title = {{Progress in tuberculosis control and the evolving public-health system in China}},
volume = {369},
year = {2007}
}
@article{VanMaaren2007,
abstract = {In 1999, a tuberculosis (TB) crisis was declared in the Western Pacific Region.},
author = {{Van Maaren}, Pieter and Tomas, Bernard and Glaziou, Philippe and Kasai, Takeshi and Ahna, Dongil},
doi = {10.2471/BLT.06.038521},
file = {:D$\backslash$:/Users/hiattt/AppData/Local/Mendeley Ltd./Mendeley Desktop/Downloaded/Van Maaren et al. - 2007 - Reaching the global tuberculosis control targets in the Western Pacific Region.pdf:pdf},
isbn = {0042-9686 (Print)$\backslash$n0042-9686 (Linking)},
issn = {00429686},
journal = {Bulletin of the World Health Organization},
pages = {360--363},
pmid = {17639220},
title = {{Reaching the global tuberculosis control targets in the Western Pacific Region}},
volume = {85},
year = {2007}
}
@techreport{,
abstract = {The World Health Organization's Stop TB Department has prepared this fourth edition of Treatment of Tuberculosis: Guidelines, adhering fully to the new WHO process for evidence-based guidelines. Several important recommendations are being promoted in this new edition.First, the recommendation to discontinue the regimen based on just 2 months of rifampicin (2HRZE/6HE) and change to the regimen based on a full 6 months of rifampicin (2HRZE/4HR) will reduce the number of relapses and failures. This will alleviate patient suffering resulting from a second episode of tuberculosis (TB) and conserve patient and programme resources.Second, this fourth edition confirms prior WHO recommendations for drug susceptibility testing (DST) at the start of therapy for all previously treated patients. Finding and treating multidrug-resistant TB (MDR-TB) in previously treated patients will help to improve the very poor outcomes in these patients. New recommendations for the prompt detection and appropriate treatment of (MDR-TB) cases will also improve access to life-saving care.Third, detecting MDR-TB will require expansion of DST capacity within the context of country-specific, comprehensive plans for laboratory strengthening. This fourth edition provides guidance for treatment approaches in the light of advances in laboratory technology and the country's progress in building laboratory capacity.Fourth, diagnosing MDR-TB cases among previously treated patients and providing effective treatment will greatly help in halting the spread of MDR-TB. This edition also addresses the prevention of acquired MDR-TB, especially among new TB patients who already have isoniazid-resistant Mycobacterium tuberculosis when they start treatment.Finally, this edition strongly reaffirms prior recommendations for supervised treatment, as well as the use of fixed-dose combinations of anti-TB drugs and patient kits as further measures for preventing the acquisition of drug resistance.},
address = {Geneva},
booktitle = {4th edition},
doi = {10.1164/rccm.201012-1949OC},
file = {:D$\backslash$:/Users/hiattt/AppData/Local/Mendeley Ltd./Mendeley Desktop/Downloaded/Unknown - 2010 - Treatment of Tuberculosis Guidelines.pdf:pdf},
institution = {World Health Organization},
isbn = {978 92 4 154783 3},
issn = {1535-4970},
pmid = {21330452},
title = {{Treatment of Tuberculosis: Guidelines}},
url = {http://whqlibdoc.who.int/publications/2010/9789241547833{\_}eng.pdf},
year = {2010}
}
@inproceedings{WorldHealthOrganization2014a,
address = {Geneva},
author = {{World Health Organization}},
booktitle = {Sixty-Seventh World Health Assembly},
file = {:D$\backslash$:/Users/hiattt/AppData/Local/Mendeley Ltd./Mendeley Desktop/Downloaded/World Health Organization - 2014 - Global strategy and targets for tuberculosis prevention, care and control after 2015.pdf:pdf},
number = {May 2014},
pages = {1--3},
title = {{Global strategy and targets for tuberculosis prevention, care and control after 2015}},
url = {http://apps.who.int/gb/ebwha/pdf{\_}files/WHA67/A67{\_}R1-en.pdf},
year = {2014}
}
@article{Groves2012,
author = {Groves, Trish and Godlee, Fiona},
doi = {10.1136/bmj.e4383},
file = {:D$\backslash$:/Users/hiattt/AppData/Local/Mendeley Ltd./Mendeley Desktop/Downloaded/Groves, Godlee - 2012 - Open science and reproducible research.pdf:pdf},
issn = {1756-1833},
journal = {BMJ (Clinical research ed.)},
keywords = {Access to Information,Biomedical Research,Biomedical Research: organization {\&} administration,Databases, Factual,Great Britain,Humans},
month = {jan},
number = {June},
pages = {e4383},
pmid = {22736475},
title = {{Open science and reproducible research.}},
url = {http://www.ncbi.nlm.nih.gov/pubmed/22736475},
volume = {344},
year = {2012}
}
@article{Peng2006,
abstract = {The replication of important findings by multiple independent investigators is fundamental to the accumulation of scientific evidence. Researchers in the biologic and physical sciences expect results to be replicated by independent data, analytical methods, laboratories, and instruments. Epidemiologic studies are commonly used to quantify small health effects of important, but subtle, risk factors, and replication is of critical importance where results can inform substantial policy decisions. However, because of the time, expense, and opportunism of many current epidemiologic studies, it is often impossible to fully replicate their findings. An attainable minimum standard is "reproducibility," which calls for data sets and software to be made available for verifying published findings and conducting alternative analyses. The authors outline a standard for reproducibility and evaluate the reproducibility of current epidemiologic research. They also propose methods for reproducible research and implement them by use of a case study in air pollution and health.},
author = {Peng, Roger D. and Dominici, Francesca and Zeger, Scott L.},
doi = {10.1093/aje/kwj093},
isbn = {0002-9262 (Print)$\backslash$n0002-9262 (Linking)},
issn = {00029262},
journal = {American Journal of Epidemiology},
keywords = {Air pollution,Information dissemination,Models,statistical},
pages = {783--789},
pmid = {16510544},
title = {{Reproducible epidemiologic research}},
volume = {163},
year = {2006}
}
@techreport{WorldHealthOrganization2013,
address = {Geneva},
file = {:D$\backslash$:/Users/hiattt/AppData/Local/Mendeley Ltd./Mendeley Desktop/Downloaded/Unknown - 2013 - Definitions and reporting framework for tuberculosis–2013 revision.pdf:pdf},
institution = {World Health Organization},
isbn = {9789241547833},
title = {{Definitions and reporting framework for tuberculosis–2013 revision}},
url = {http://apps.who.int/iris/handle/10665/79199},
year = {2013}
}
@techreport{WorldHealthOrganization2011,
abstract = {Significant progress has been made in TB control in the Western Pacific Region in the past decade with a decline in the number of prevalent TB patients and the diagnosis treatment of over 10 million patients. Despite these successes, TB control programmes in the Region face significant challenges, such as hard-to-reach vulnerable and marginalized groups, in which the TB epidemic tends to concentrate, TB-HIV co-infection and the emergence and spread of drug-resistant TB, especially multi-drug resistant TB (MDR-TB). To mitigate these threats, the Regional Strategy to Stop Tuberculosis in the Western Pacific (2011-2015) was developed in consultation with and endorsed by Member States. The new Strategy builds upon the previous two regional strategic plans and introduces new, evidence-based interventions and technologies in response to the new and emerging challenges. The Strategy provides a reference for action to be taken, focusing on five core objectives: (1) Promoting universal and equitable access to quality TB diagnosis and treatment for all people; (2) Strengthening TB laboratory capacity; (3) Scaling up the programmatic management of drug-resistant TB; (4) Expanding TB/HIV collaborative activities; and (5) Strengthening TB programme management capacity.},
institution = {World Health Organization Regional Office for the Western Pacific},
isbn = {/publications/PUB{\_}9789290615217/en/index.html},
pages = {52},
publisher = {WPRO | WHO Western Pacific Region},
title = {{Regional Strategy to Stop Tuberculosis in the Western Pacific Region 2011-2015}},
url = {http://www.wpro.who.int/publications/PUB{\_}9789290615217},
year = {2011}
}
@techreport{WorldHealthOrganization2014,
abstract = {This is the nineteenth global report on tuberculosis (TB) published by WHO in a series that started in 1997. It provides a comprehensive and up-to-date assessment of the TB epidemic and progress in implementing and financing TB prevention, care and control at global, regional and country levels using data reported by over 200 countries that account for over 99{\%} of the world's TB cases. The report is accompanied by a special supplement that marks the 20th anniversary of the establishment of the Global Project on Anti-TB Drug Resistance Surveillance. The supplement highlights the latest status of knowledge about the epidemic of multidrug-resistant TB (MDR-TB) and the programmatic response. The report has 9 main chapters. The introductory chapter provides general background on TB as well as an explanation of current global targets for TB control, the WHO's Stop TB Strategy that covers the period 2006-2015 and the post-2015 global TB strategy that was recently endorsed by all Member States at the 2014 World Health Assembly. The remaining eight chapters cover the disease burden caused by TB (incidence, prevalence, mortality); a special assessment ("countdown to 2015) of progress towards 2015 global TB targets at global, regional and country level; TB case notifications and treatment outcomes; drug resistance surveillance among TB patients and the programmatic response in detecting and providing treatment for multidrug-resistant TB; diagnostics and laboratory strengthening for TB; addressing the co-epidemics of TB and HIV; financing TB care and control; and research and development for new TB diagnostics, drugs and vaccines. The three annexes of the report include an explanation of how to access and use the online global TB database, one-page profiles for 22 high TB-burden countries and one page regional profiles for WHO's six regions.},
file = {:D$\backslash$:/Users/hiattt/AppData/Local/Mendeley Ltd./Mendeley Desktop/Downloaded/World Health Organization - 2014 - Global Tuberculosis Report 2014.pdf:pdf},
institution = {World Health Organization},
title = {{Global Tuberculosis Report 2014}},
url = {http://apps.who.int/iris/bitstream/10665/137094/1/9789241564809{\_}eng.pdf},
year = {2014}
}
@article{Hiatt2014,
abstract = {TB control in the Western Pacific Region has seen substantial progress in the last decade with a 33{\%} reduction in prevalent TB cases since 2000. The burden remains immense however, and national TB programmes must evolve and adapt in order to build upon these gains. Through routine surveillance, countries and areas in the Region reported 1.4 million TB cases in 2012. The case notification rate increased in the early 2000s and in recent years appears to have stabilized and is in decline for all forms and new smear-positive cases respectively. The age and sex breakdown for smear-positive TB case rates by country shows generally higher rates with increased age and declining rates over time for all age groups. Treatment success remains high in the region with 15 countries across the region reaching or maintaining 85{\%}. HIV testing among TB patients has increased gradually along with a slow decline in the number of HIV-positive patients found. The trend of TB notification is heavily influenced by programmatic improvements in many countries and rapidly changing demographics. It appears that cases are being found earlier as reflected in declining rates of smear-positive TB with steady rates of TB in all forms. WHO estimates depict a decline in TB incidence in the Region. HIV testing, while still low, has increased substantially in recent years with essential TB/HIV services expanding in many countries. TB surveillance data, within inherent limitations, is an important source of programmatic and epidemiological information. Careful interpretation of these findings can provide useful insight for programmatic decision making.},
author = {Hiatt, Tom and Nishikiori, Nobuyuki},
doi = {10.5365/wpsar.2014.5.1.013},
file = {:D$\backslash$:/Users/hiattt/AppData/Local/Mendeley Ltd./Mendeley Desktop/Downloaded/Hiatt, Nishikiori - 2014 - Epidemiology and control of tuberculosis in the Western Pacific Region analysis of 2012 case notification dat.pdf:pdf},
issn = {2094-7313},
journal = {Western Pacific Surveillance and Response Journal},
language = {en},
month = {mar},
number = {1},
pages = {25--34},
title = {{Epidemiology and control of tuberculosis in the Western Pacific Region: analysis of 2012 case notification data}},
url = {http://ojs.wpro.who.int/ojs/index.php/wpsar/article/view/253/377},
volume = {5},
year = {2014}
}
@techreport{WorldHealthOrganization2006,
address = {Geneva},
file = {:D$\backslash$:/Users/hiattt/AppData/Local/Mendeley Ltd./Mendeley Desktop/Downloaded/Unknown - 2006 - Revised TB recording and reporting forms and registers – version 2006.pdf:pdf},
institution = {World Health Organization},
number = {September},
title = {{Revised TB recording and reporting forms and registers – version 2006}},
url = {http://whqlibdoc.who.int/hq/2006/WHO{\_}HTM{\_}TB{\_}2006.373{\_}eng.pdf},
year = {2006}
}
@book{Rieder1999,
author = {Rieder, HL},
file = {:D$\backslash$:/Users/hiattt/AppData/Local/Mendeley Ltd./Mendeley Desktop/Downloaded/Rieder - 1999 - Epidemiologic basis of tuberculosis control.pdf:pdf},
title = {{Epidemiologic basis of tuberculosis control.}},
url = {http://www.cabdirect.org/abstracts/20002005361.html},
year = {1999}
}
@article{Huong,
abstract = {SETTING: Six provinces in Vietnam where the DOTS strategy was introduced in 1989. OBJECTIVE: To assess the impact of improved tuberculosis (TB) control on TB epidemiology in Vietnam. METHODS: Data from the surveillance system in the period 1990-2003 were analysed to assess trends of notification rates and the mean ages of notified cases. Data from repeated tuberculin surveys in the period 1986-2002 were estimated to assess the prevalence of TB infection, the annual risk of infection and its trend using various cut-off points in those with and without bacille Calmette-Guerin (BCG) scar. RESULTS: Age-standardised notification rates in the period 1996-2003 declined significantly, by 2.6{\%} to 5.9{\%} per year, in five provinces. However, in four provinces notification rates in the age group 15-24 years increased significantly, by 4.5{\%} to 13.6{\%} per year, during this period. The mean age of newly diagnosed patients with smear-positive TB increased up to 1995 but decreased thereafter. The annual risk of TB infection showed a significant annual decrease (4.9{\%} per year) in one province in surveys performed between 1986 and 1997, and in two provinces (6.6{\%} and 4.7{\%}) in surveys conducted between 1993 and 2002. CONCLUSION: These data suggest limited impact to date of the DOTS strategy in Vietnam.},
author = {Huong, N. T. and Duong, B. D. and Co, N. V. and Quy, H. T. and Tung, L. B. and Broekmans, J. F. and Bosman, M. C. and Verhage, C. and Kalisvaart, N. and Borgdorff, M. W. and Cobelens, Frank G.},
file = {:D$\backslash$:/Users/hiattt/AppData/Local/Mendeley Ltd/Mendeley Desktop/Downloaded/95B3B9081D4B187314555184804F10F09EBA3776F7.pdf:pdf},
isbn = {1027-3719 (Print)$\backslash$n1027-3719 (Linking)},
issn = {10273719},
journal = {International Journal of Tuberculosis and Lung Disease},
keywords = {,Communicable disease control,Disease notification,Health surveys,Tuberculin test,Tuberculosis,Vietnam},
number = {9},
pages = {963--969},
pmid = {16964785},
publisher = {International Union Against Tuberculosis and Lung Disease},
title = {{Tuberculosis epidemiology in six provinces of Vietnam after the introduction of the DOTS strategy}},
url = {http://www.ingentaconnect.com/content/iuatld/ijtld/2006/00000010/00000009/art00005},
volume = {10},
year = {2006}
}

repository: tomhiatt/WPRupdate

repo_name: tomhiatt/WPRupdate


text:
package main

import (
	"fmt"
	"sort"
)

// Person is defined by name and age
type Person struct {
	Name string
	Age  int
}

// ByAge is a sorted list of Persons
type ByAge []Person

// Len implements the interface for Sort
func (p ByAge) Len() int {
	return len(p)
}

// Swap implements the interface for Sort
func (p ByAge) Swap(i, j int) {
	p[i], p[j] = p[j], p[i]
}

// Less implements the interface for Sort
func (p ByAge) Less(i, j int) bool {
	// customize sorting on age equivalence to use Name too
	if p[i].Age == p[j].Age {
		if p[i].Name <= p[j].Name {
			return true
		}
		return false
	}
	// otherwise ages are not equal, simply use age
	return p[i].Age < p[j].Age
}

// MySort IS NOT USING AN INTERFACE TO SORT
func MySort(People []Person) {
	// Example of manually sorting using extra primitive data structures
	AgeToPeople := make(map[int][]Person)
	for _, p := range People {
		// handle the edge case of not yet having a list entry in the map
		_, ok := AgeToPeople[p.Age]
		if !ok {
			AgeToPeople[p.Age] = []Person{p}
		} else {
			temp := AgeToPeople[p.Age]
			AgeToPeople[p.Age] = append(temp, p) // this maintains the pre-existing order on duplicates
		}
	}

	// Sort by a property and then dereference the lookup map
	// get the unique list of ages (each map key is unique)
	var Ages []int
	for age := range AgeToPeople {
		Ages = append(Ages, age)
	}
	sort.Ints(Ages)

	var PeopleSortedByAge []Person
	for _, age := range Ages {
		temp := AgeToPeople[age]
		for _, p := range temp {
			PeopleSortedByAge = append(PeopleSortedByAge, p)
		}
	}
	fmt.Printf("Sorted by age Listing: %v \n", PeopleSortedByAge)

	// Optionally create a subset of the "lowest N members"
	// this could be more efficient if it was applied during the PeopleSortedByAge loop
	PeopleSortedByAgeSubset := PeopleSortedByAge[:3]
	fmt.Printf("Stable Subset of Sorted by age: %v \n", PeopleSortedByAgeSubset)
}

license: MIT

repository: johnpfeiffer/go-sort-example

license_type: permissive

repo_name: johnpfeiffer/go-sort-example

branch_name: refs/heads/main

extension: go


text:
package helm_test

import (
	"context"
	"fmt"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"

	"github.com/solo-io/gloo-mesh/pkg/meshctl/install/gloomesh"
	. "github.com/solo-io/gloo-mesh/pkg/meshctl/install/helm"
)

var _ = Describe("Installer", func() {

	// NOTE: This test pulls a chart from a bucket, so needs to have internet to work.
	It("should get rendered manifests from installer", func() {
		gmeInstaller := Installer{
			ChartUri:    fmt.Sprintf(gloomesh.GlooMeshEnterpriseChartUriTemplate, "1.0.0"),
			KubeContext: "nonexistent-kube-context",
			Namespace:   "invalid namespace",
			ReleaseName: "invalid release name",
			Values:      map[string]string{"licenseKey": "not a license key"},
			Verbose:     true,
		}
		manifests, err := gmeInstaller.GetRenderedManifests(context.Background())
		Expect(err).NotTo(HaveOccurred())
		// make sure that we see something that we expect
		Expect(string(manifests)).To(ContainSubstring("enterprise-networking"))
	})
})

repository: dystudio/gloo-mesh

repo_name: dystudio/gloo-mesh


text:
package mock_keymanager

//go:generate sh -c "$GOPATH/bin/mockgen github.com/spiffe/spire/proto/spire/server/keymanager KeyManager,KeyManagerServer > keymanager.go"

repository: InfoHunter/spire

repo_name: InfoHunter/spire

branch_name: refs/heads/master


text:
@article{Malaj-2022-Increased,
    title = "Increased reliance on insecticide applications in {\textless}scp{\textgreater}C{\textless}/scp{\textgreater} anada linked to simplified agricultural landscapes",
    author = "Malaj, Egina  and
      Morrissey, Christy A.",
    journal = "Ecological Applications, Volume 32, Issue 3",
    volume = "32",
    number = "3",
    year = "2022",
    publisher = "Wiley",
    url = "https://aclanthology.org/G22-87001",
    doi = "10.1002/eap.2533",
}

repository: gwf-uwaterloo/gwf-publications

repo_name: gwf-uwaterloo/gwf-publications

gha_language: Python

extension: bib


text:
package cmd

import (
	"encoding/json"
	"fmt"
	"io/ioutil"
	"log"
	"sync"

	"sm/secrets"

	"github.com/spf13/cobra"
)

// encryptAllCmd represents the encrypt-all command
var encryptAllCmd = &cobra.Command{
	Use:   "encrypt-all",
	Short: "Encrypt all files in manifest using key management system",
	Long: `This command will re-encrypt all changed files in the .sm/manifest.

It requires access to the same key management system (KMS) that was used for the initial
encryption. The key will be extracted from the existing encrypted file. If an unencrypted file
does not exist, this will be logged and skipped.

For example:

  sm encrypt-all

`,
	Run: func(cmd *cobra.Command, args []string) {
		lines, err := secrets.ReadManifest("./.sm/manifest")
		if err != nil {
			log.Fatal("error reading manifest:", err)
		}

		var wg sync.WaitGroup
		wg.Add(len(lines))

		for _, line := range lines {
			go func(line string) {
				defer wg.Done()
				existing, err := ioutil.ReadFile(line)
				if err != nil {
					fmt.Println(fmt.Sprintf("Skipping missing unencrypted file %s", line))
					return
				}

				encryptedFile := fmt.Sprintf("%s.sm", line)
				encryptedMessage, err := ioutil.ReadFile(encryptedFile)
				if err != nil {
					log.Fatal("failed to read:", err)
					return
				}

				// decrypt the encrypted file
				decryptedContent, err := decryptSecret(encryptedMessage)
				if err != nil {
					log.Fatal("failed to decrypt:", err)
					return
				}

				if string(existing) == string(decryptedContent) {
					return
				}

				fmt.Println(fmt.Sprintf("Attempting to re-encrypt %s", line))
				envelope := &secrets.Envelope{}
				if err := json.Unmarshal(encryptedMessage, &envelope); err != nil {
					log.Fatal("failed to read envelope:", err)
					return
				}

				encryptSecret(envelope.Env, envelope.Region, envelope.MasterKeyID, existing, encryptedFile)
			}(line)
		}

		wg.Wait()
	},
}

func init() {
	RootCmd.AddCommand(encryptAllCmd)
}

repository: hugmatj/sm

repo_name: hugmatj/sm


text:
SUMMARY = "Multi-platform app that allows your devices to communicate"
LICENSE = "Apache-2.0 & BSD-3-Clause & GPL-2.0-only & GPL-2.0-or-later & GPL-3.0-only & LGPL-2.0-or-later & LGPL-2.1-only & LGPL-2.1-or-later & LGPL-3.0-only & MIT"
LIC_FILES_CHKSUM = " \
    file://LICENSES/Artistic-2.0.txt;md5=7f086b1df814d268c59965d8db41f13c \
    file://LICENSES/BSD-3-Clause.txt;md5=f225922a2c12dfa5218fb70c49db3ea6 \
    file://LICENSES/GPL-2.0-only.txt;md5=9e2385fe012386d34dcc5c9863070881 \
    file://LICENSES/GPL-2.0-or-later.txt;md5=9e2385fe012386d34dcc5c9863070881 \
    file://LICENSES/GPL-3.0-only.txt;md5=49fc03046e56a282c0c743b5d3a55b7c \
    file://LICENSES/LGPL-2.0-or-later.txt;md5=da48810c4ddf8e49efa031294a26b98c \
    file://LICENSES/LGPL-2.1-only.txt;md5=147a320ed8b16b036829a0c71d424153 \
    file://LICENSES/LGPL-2.1-or-later.txt;md5=147a320ed8b16b036829a0c71d424153 \
    file://LICENSES/LGPL-3.0-only.txt;md5=8d51f5b5fd447f7a1040c3dc9f0a8de6 \
    file://LICENSES/MIT.txt;md5=7dda4e90ded66ab88b86f76169f28663 \
"

inherit kde-apps

DEPENDS += " \
    kdoctools-native \
    kpackage-native \
    qca \
    pulseaudio-qt \
    ki18n \
    kconfigwidgets \
    kdbusaddons \
    kiconthemes \
    knotifications \
    kio \
    kcmutils \
    kservice \
    solid \
    kirigami2 \
    kpeople \
    kwindowsystem \
"

PV = "${KDE_APP_VERSION}"
SRC_URI[sha256sum] = "f125eb729dd81ea265471c9bbca54fe6a7e87348c9a782b321331da72a02aa6e"

EXTRA_OECMAKE += " \
"

FILES:${PN} += " \
"

extension: bb


text:
package firebase

import (
	"context"
	firebase "firebase.google.com/go"
	"firebase.google.com/go/auth"
	"google.golang.org/api/option"
	"log"
	"os"
	"time"
)

const timeOutDelay = time.Duration(10)

/*SetupFirebaseFromEnv create a new *auth.Client, using env variable You must init
FIREBASE_KEY_PATH environment variable to the "root directory path"
to the credentials file
*/
func SetupFirebaseFromEnv() *auth.Client {
	log.Printf("Setting up Firebase client.. \n")
	if keyPath := os.Getenv("FIREBASE_KEY_PATH"); keyPath != "" {
		opt := option.WithCredentialsFile(keyPath)
		//Firebase admin SDK initialization
		ctx, _ := context.WithTimeout(context.Background(), time.Second*timeOutDelay)
		app, err := firebase.NewApp(ctx, nil, opt)
		if err != nil {
			panic(err)
		}
		//Firebase Auth
		authCtx, _ := context.WithTimeout(context.Background(), time.Second*timeOutDelay)
		auth, err := app.Auth(authCtx)
		if err != nil {
			panic(err)
		}
		log.Printf("Firebase client setup :) \n")
		return auth
	}
	log.Printf("Failed to setup wireframe. \n")
	return nil
}

/*SetupFirebase create a new *auth.Client. keyPath is the path to the
wireframe json file.
*/
func SetupFirebase(keyPath string) *auth.Client {
	log.Printf("Setting up Firebase client.. \n")
	if keyPath := os.Getenv(keyPath); keyPath != "" {
		opt := option.WithCredentialsFile(keyPath)
		//Firebase admin SDK initialization
		ctx, _ := context.WithTimeout(context.Background(), time.Second*timeOutDelay)
		app, err := firebase.NewApp(ctx, nil, opt)
		if err != nil {
			panic(err)
		}
		//Firebase Auth
		authCtx, _ := context.WithTimeout(context.Background(), time.Second*timeOutDelay)
		auth, err := app.Auth(authCtx)
		if err != nil {
			panic(err)
		}
		log.Printf("Firebase client setup :) \n")
		return auth
	}
	log.Printf("Failed to setup wireframe. \n")
	return nil
}

repository: Alvarios/wireframe

repo_name: Alvarios/wireframe


text:
SUMMARY = "Basic Cinnamon desktop session"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"

# at least cinnamon-menus are dynamically renamed
PACKAGE_ARCH = "${TUNE_PKGARCH}"

inherit packagegroup

RDEPENDS:${PN} = " \
    mint-backgrounds-una \
    mint-themes \
    mint-x-icons \
    mint-y-icons \
    cinnamon \
    cinnamon-control-center \
    cinnamon-default-config \
    cinnamon-desktop \
    cinnamon-menus \
    cinnamon-screensaver \
    cinnamon-session \
    cinnamon-settings-daemon \
    cjs \
    muffin \
    nemo \
    python3-xapp \
    libxapp \
    adwaita-icon-theme \
"

repository: schnitzeltony/meta-gnome-forks

repo_name: schnitzeltony/meta-gnome-forks


text:
/*
 * Github Authorized Keys - Use GitHub teams to manage system user accounts and authorized_keys
 *
 * Copyright 2016 Cloud Posse, LLC <hello@cloudposse.com>
 *
 * 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
 *
 *   http://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 server

import (
	"strings"

	log "github.com/Sirupsen/logrus"
	"github.com/cloudposse/github-authorized-keys/config"
	keyStorages "github.com/cloudposse/github-authorized-keys/key_storages"
	"github.com/gin-gonic/gin"
)

// Run - start http server
func Run(cfg config.Config) {

	router := gin.Default()

	router.GET("/user/:name/authorized_keys", func(c *gin.Context) {
		name := c.Params.ByName("name")
		name = strings.ToLower(name)
		key, err := authorize(cfg, name)
		if err == nil {
			c.String(200, "%v", key)
		} else {
			c.String(404, "")
		}
	})

	err := router.Run(cfg.Listen)
	if err != nil {
		log.Error(err)
	}
}

func authorize(cfg config.Config, userName string) (string, error) {
	var keys *keyStorages.Proxy

	sourceStorage := keyStorages.NewGithubKeys(cfg.GithubAPIToken, cfg.GithubOrganization, cfg.GithubURL, cfg.GithubTeamName, cfg.GithubTeamID)

	if len(cfg.EtcdEndpoints) > 0 {
		fallbackStorage, _ := keyStorages.NewEtcdCache(cfg.EtcdEndpoints, cfg.EtcdPrefix, cfg.EtcdTTL)
		keys = keyStorages.NewProxy(sourceStorage, fallbackStorage)
	} else {
		fallbackStorage := &keyStorages.NilStorage{}
		keys = keyStorages.NewProxy(sourceStorage, fallbackStorage)
	}
	return keys.Get(userName)
}

repository: cloudposse/github-authorized-keys

repo_name: cloudposse/github-authorized-keys

gha_language: Go


text:
@article{kolesnikov2019big,
  title={Big transfer (bit): General visual representation learning},
  author={Kolesnikov, Alexander and Beyer, Lucas and Zhai, Xiaohua and Puigcerver, Joan and Yung, Jessica and Gelly, Sylvain and Houlsby, Neil},
  journal={arXiv preprint arXiv:1912.11370},
  volume={6},
  number={2},
  pages={8},
  year={2019}
}

url: https://raw.githubusercontent.com/rbt-c/DL-NLP-Readings/82ca76e9184a3b00ac87129d99391477c85cfcd2/Bibtex/Big Transfer BiT - General Visual Representation Learning.bib

repository: rbt-c/DL-NLP-Readings

repo_name: rbt-c/DL-NLP-Readings


text:
/*
Copyright 2020 The Crossplane 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

    http://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 definition

import (
	"context"
	"strings"
	"time"

	extv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
	kerrors "k8s.io/apimachinery/pkg/api/errors"
	kmeta "k8s.io/apimachinery/pkg/api/meta"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	kunstructured "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
	"k8s.io/apimachinery/pkg/types"
	ctrl "sigs.k8s.io/controller-runtime"
	kcontroller "sigs.k8s.io/controller-runtime/pkg/controller"
	"sigs.k8s.io/controller-runtime/pkg/handler"
	"sigs.k8s.io/controller-runtime/pkg/manager"
	"sigs.k8s.io/controller-runtime/pkg/reconcile"

	"github.com/crossplane/crossplane-runtime/pkg/connection"
	"github.com/crossplane/crossplane-runtime/pkg/controller"
	"github.com/crossplane/crossplane-runtime/pkg/errors"
	"github.com/crossplane/crossplane-runtime/pkg/event"
	"github.com/crossplane/crossplane-runtime/pkg/logging"
	"github.com/crossplane/crossplane-runtime/pkg/meta"
	"github.com/crossplane/crossplane-runtime/pkg/ratelimiter"
	"github.com/crossplane/crossplane-runtime/pkg/reconciler/managed"
	"github.com/crossplane/crossplane-runtime/pkg/resource"
	"github.com/crossplane/crossplane-runtime/pkg/resource/unstructured"

	v1 "github.com/crossplane/crossplane/apis/apiextensions/v1"
	"github.com/crossplane/crossplane/apis/secrets/v1alpha1"
	"github.com/crossplane/crossplane/internal/controller/apiextensions/composite"
	"github.com/crossplane/crossplane/internal/features"
	"github.com/crossplane/crossplane/internal/xcrd"
)

const (
	timeout   = 2 * time.Minute
	finalizer = "defined.apiextensions.crossplane.io"

	errGetXRD          = "cannot get CompositeResourceDefinition"
	errRenderCRD       = "cannot render composite resource CustomResourceDefinition"
	errGetCRD          = "cannot get composite resource CustomResourceDefinition"
	errApplyCRD        = "cannot apply rendered composite resource CustomResourceDefinition"
	errUpdateStatus    = "cannot update status of CompositeResourceDefinition"
	errStartController = "cannot start composite resource controller"
	errAddFinalizer    = "cannot add composite resource finalizer"
	errRemoveFinalizer = "cannot remove composite resource finalizer"
	errDeleteCRD       = "cannot delete composite resource CustomResourceDefinition"
	errListCRs         = "cannot list defined composite resources"
	errDeleteCRs       = "cannot delete defined composite resources"
)

// Wait strings.
const (
	waitCRDelete     = "waiting for defined composite resources to be deleted"
	waitCRDEstablish = "waiting for composite resource CustomResourceDefinition to be established"
)

// Event reasons.
const (
	reasonRenderCRD   event.Reason = "RenderCRD"
	reasonEstablishXR event.Reason = "EstablishComposite"
	reasonTerminateXR event.Reason = "TerminateComposite"
)

// A ControllerEngine can start and stop Kubernetes controllers on demand.
type ControllerEngine interface {
	IsRunning(name string) bool
	Start(name string, o kcontroller.Options, w ...controller.Watch) error
	Stop(name string)
	Err(name string) error
}

// A CRDRenderer renders a CompositeResourceDefinition's corresponding
// CustomResourceDefinition.
type CRDRenderer interface {
	Render(d *v1.CompositeResourceDefinition) (*extv1.CustomResourceDefinition, error)
}

// A CRDRenderFn renders a CompositeResourceDefinition's corresponding
// CustomResourceDefinition.
type CRDRenderFn func(d *v1.CompositeResourceDefinition) (*extv1.CustomResourceDefinition, error)

// Render the supplied CompositeResourceDefinition's corresponding
// CustomResourceDefinition.
func (fn CRDRenderFn) Render(d *v1.CompositeResourceDefinition) (*extv1.CustomResourceDefinition, error) {
	return fn(d)
}

// Setup adds a controller that reconciles CompositeResourceDefinitions by
// defining a composite resource and starting a controller to reconcile it.
func Setup(mgr ctrl.Manager, o controller.Options) error {
	name := "defined/" + strings.ToLower(v1.CompositeResourceDefinitionGroupKind)

	r := NewReconciler(mgr,
		WithLogger(o.Logger.WithValues("controller", name)),
		WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))),
		WithOptions(o))

	return ctrl.NewControllerManagedBy(mgr).
		Named(name).
		For(&v1.CompositeResourceDefinition{}).
		Owns(&extv1.CustomResourceDefinition{}).
		WithOptions(o.ForControllerRuntime()).
		Complete(ratelimiter.NewReconciler(name, r, o.GlobalRateLimiter))
}

// ReconcilerOption is used to configure the Reconciler.
type ReconcilerOption func(*Reconciler)

// WithLogger specifies how the Reconciler should log messages.
func WithLogger(log logging.Logger) ReconcilerOption {
	return func(r *Reconciler) {
		r.log = log
	}
}

// WithRecorder specifies how the Reconciler should record Kubernetes events.
func WithRecorder(er event.Recorder) ReconcilerOption {
	return func(r *Reconciler) {
		r.record = er
	}
}

// WithOptions lets the Reconciler know which options to pass to new composite
// resource controllers.
func WithOptions(o controller.Options) ReconcilerOption {
	return func(r *Reconciler) {
		r.options = o
	}
}

// WithFinalizer specifies how the Reconciler should finalize
// CompositeResourceDefinitions.
func WithFinalizer(f resource.Finalizer) ReconcilerOption {
	return func(r *Reconciler) {
		r.composite.Finalizer = f
	}
}

// WithControllerEngine specifies how the Reconciler should manage the
// lifecycles of composite controllers.
func WithControllerEngine(c ControllerEngine) ReconcilerOption {
	return func(r *Reconciler) {
		r.composite.ControllerEngine = c
	}
}

// WithCRDRenderer specifies how the Reconciler should render an
// CompositeResourceDefinition's corresponding CustomResourceDefinition.
func WithCRDRenderer(c CRDRenderer) ReconcilerOption {
	return func(r *Reconciler) {
		r.composite.CRDRenderer = c
	}
}

// WithClientApplicator specifies how the Reconciler should interact with the
// Kubernetes API.
func WithClientApplicator(ca resource.ClientApplicator) ReconcilerOption {
	return func(r *Reconciler) {
		r.client = ca
	}
}

type definition struct {
	CRDRenderer
	ControllerEngine
	resource.Finalizer
}

// NewReconciler returns a Reconciler of CompositeResourceDefinitions.
func NewReconciler(mgr manager.Manager, opts ...ReconcilerOption) *Reconciler {
	kube := unstructured.NewClient(mgr.GetClient())

	r := &Reconciler{
		mgr: mgr,

		client: resource.ClientApplicator{
			Client:     kube,
			Applicator: resource.NewAPIUpdatingApplicator(kube),
		},

		composite: definition{
			CRDRenderer:      CRDRenderFn(xcrd.ForCompositeResource),
			ControllerEngine: controller.NewEngine(mgr),
			Finalizer:        resource.NewAPIFinalizer(kube, finalizer),
		},

		log:    logging.NewNopLogger(),
		record: event.NewNopRecorder(),

		options: controller.DefaultOptions(),
	}

	for _, f := range opts {
		f(r)
	}
	return r
}

// A Reconciler reconciles CompositeResourceDefinitions.
type Reconciler struct {
	client resource.ClientApplicator
	mgr    manager.Manager

	composite definition

	log    logging.Logger
	record event.Recorder

	options controller.Options
}

// Reconcile a CompositeResourceDefinition by defining a new kind of composite
// resource and starting a controller to reconcile it.
func (r *Reconciler) Reconcile(ctx context.Context, req reconcile.Request) (reconcile.Result, error) { // nolint:gocyclo
	// NOTE(negz): Like most Reconcile methods, this one is over our cyclomatic
	// complexity goal. Be wary when adding branches, and look for functionality
	// that could be reasonably moved into an injected dependency.

	log := r.log.WithValues("request", req)
	log.Debug("Reconciling")

	ctx, cancel := context.WithTimeout(ctx, timeout)
	defer cancel()

	d := &v1.CompositeResourceDefinition{}
	if err := r.client.Get(ctx, req.NamespacedName, d); err != nil {
		// In case object is not found, most likely the object was deleted and
		// then disappeared while the event was in the processing queue. We
		// don't need to take any action in that case.
		log.Debug(errGetXRD, "error", err)
		return reconcile.Result{}, errors.Wrap(resource.IgnoreNotFound(err), errGetXRD)
	}

	log = log.WithValues(
		"uid", d.GetUID(),
		"version", d.GetResourceVersion(),
		"name", d.GetName(),
	)

	crd, err := r.composite.Render(d)
	if err != nil {
		log.Debug(errRenderCRD, "error", err)
		err = errors.Wrap(err, errRenderCRD)
		r.record.Event(d, event.Warning(reasonRenderCRD, err))
		return reconcile.Result{}, err
	}

	r.record.Event(d, event.Normal(reasonRenderCRD, "Rendered composite resource CustomResourceDefinition"))

	if meta.WasDeleted(d) {
		d.Status.SetConditions(v1.TerminatingComposite())
		if err := r.client.Status().Update(ctx, d); err != nil {
			log.Debug(errUpdateStatus, "error", err)
			err = errors.Wrap(err, errUpdateStatus)
			return reconcile.Result{}, err
		}

		nn := types.NamespacedName{Name: crd.GetName()}
		if err := r.client.Get(ctx, nn, crd); resource.IgnoreNotFound(err) != nil {
			log.Debug(errGetCRD, "error", err)
			err = errors.Wrap(err, errGetCRD)
			r.record.Event(d, event.Warning(reasonTerminateXR, err))
			return reconcile.Result{}, err
		}

		// The CRD has no creation timestamp, or we don't control it.
		// Most likely we successfully deleted it on a previous
		// reconcile. It's also possible that we're being asked to
		// delete it before we got around to creating it, or that we
		// lost control of it around the same time we were deleted. In
		// the (presumably exceedingly rare) latter case we'll orphan
		// the CRD.
		if !meta.WasCreated(crd) || !metav1.IsControlledBy(crd, d) {
			// It's likely that we've already stopped this
			// controller on a previous reconcile, but we try again
			// just in case. This is a no-op if the controller was
			// already stopped.
			r.composite.Stop(composite.ControllerName(d.GetName()))
			log.Debug("Stopped composite resource controller")
			r.record.Event(d, event.Normal(reasonTerminateXR, "Stopped composite resource controller"))

			if err := r.composite.RemoveFinalizer(ctx, d); err != nil {
				log.Debug(errRemoveFinalizer, "error", err)
				err = errors.Wrap(err, errRemoveFinalizer)
				r.record.Event(d, event.Warning(reasonTerminateXR, err))
				return reconcile.Result{}, err
			}

			// We're all done deleting and have removed our
			// finalizer. There's no need to requeue because there's
			// nothing left to do.
			return reconcile.Result{Requeue: false}, nil
		}

		// NOTE(muvaf): When user deletes CompositeResourceDefinition
		// object the deletion signal does not cascade to the owned
		// resource until owner is gone. But owner has its own finalizer
		// that depends on having no instance of the CRD because it
		// cannot go away before stopping the controller. So, we need to
		// delete all defined custom resources manually here.
		o := &kunstructured.Unstructured{}
		o.SetGroupVersionKind(d.GetCompositeGroupVersionKind())
		if err := r.client.DeleteAllOf(ctx, o); err != nil && !kmeta.IsNoMatchError(err) && !kerrors.IsNotFound(err) {
			log.Debug(errDeleteCRs, "error", err)
			err = errors.Wrap(err, errDeleteCRs)
			r.record.Event(d, event.Warning(reasonTerminateXR, err))
			return reconcile.Result{}, err
		}

		l := &kunstructured.UnstructuredList{}
		l.SetGroupVersionKind(d.GetCompositeGroupVersionKind())
		if err := r.client.List(ctx, l); resource.Ignore(kmeta.IsNoMatchError, err) != nil {
			log.Debug(errListCRs, "error", err)
			err = errors.Wrap(err, errListCRs)
			r.record.Event(d, event.Warning(reasonTerminateXR, err))
			return reconcile.Result{}, err
		}

		// Controller should be stopped only after all instances are
		// gone so that deletion logic of the instances are processed by
		// the controller.
		if len(l.Items) > 0 {
			log.Debug(waitCRDelete)
			r.record.Event(d, event.Normal(reasonTerminateXR, waitCRDelete))
			return reconcile.Result{Requeue: true}, nil
		}

		// The controller should be stopped before the deletion of CRD
		// so that it doesn't crash.
		r.composite.Stop(composite.ControllerName(d.GetName()))
		log.Debug("Stopped composite resource controller")
		r.record.Event(d, event.Normal(reasonTerminateXR, "Stopped composite resource controller"))

		if err := r.client.Delete(ctx, crd); resource.IgnoreNotFound(err) != nil {
			log.Debug(errDeleteCRD, "error", err)
			err = errors.Wrap(err, errDeleteCRD)
			r.record.Event(d, event.Warning(reasonTerminateXR, err))
			return reconcile.Result{}, err
		}
		log.Debug("Deleted composite resource CustomResourceDefinition")
		r.record.Event(d, event.Normal(reasonTerminateXR, "Deleted composite resource CustomResourceDefinition"))

		// We should be requeued implicitly because we're watching the
		// CustomResourceDefinition that we just deleted, but we requeue
		// just in case the CRD isn't gone after the first requeue.
		return reconcile.Result{Requeue: true}, nil
	}

	if err := r.composite.AddFinalizer(ctx, d); err != nil {
		log.Debug(errAddFinalizer, "error", err)
		err = errors.Wrap(err, errAddFinalizer)
		r.record.Event(d, event.Warning(reasonEstablishXR, err))
		return reconcile.Result{}, err
	}

	if err := r.client.Apply(ctx, crd, resource.MustBeControllableBy(d.GetUID())); err != nil {
		log.Debug(errApplyCRD, "error", err)
		err = errors.Wrap(err, errApplyCRD)
		r.record.Event(d, event.Warning(reasonEstablishXR, err))
		return reconcile.Result{}, err
	}
	r.record.Event(d, event.Normal(reasonEstablishXR, "Applied composite resource CustomResourceDefinition"))

	if !xcrd.IsEstablished(crd.Status) {
		log.Debug(waitCRDEstablish)
		r.record.Event(d, event.Normal(reasonEstablishXR, waitCRDEstablish))
		return reconcile.Result{Requeue: true}, nil
	}

	if err := r.composite.Err(composite.ControllerName(d.GetName())); err != nil {
		log.Debug("Composite resource controller encountered an error", "error", err)
	}

	observed := d.Status.Controllers.CompositeResourceTypeRef
	desired := v1.TypeReferenceTo(d.GetCompositeGroupVersionKind())
	if observed.APIVersion != "" && observed != desired {
		r.composite.Stop(composite.ControllerName(d.GetName()))
		log.Debug("Referenceable version changed; stopped composite resource controller",
			"observed-version", observed.APIVersion,
			"desired-version", desired.APIVersion)
		r.record.Event(d, event.Normal(reasonEstablishXR, "Referenceable version changed; stopped composite resource controller",
			"observed-version", observed.APIVersion,
			"desired-version", desired.APIVersion))
	}

	recorder := r.record.WithAnnotations("controller", composite.ControllerName(d.GetName()))

	o := []composite.ReconcilerOption{
		composite.WithConnectionPublishers(composite.NewAPIFilteredSecretPublisher(r.client, d.GetConnectionSecretKeys())),
		composite.WithCompositionSelector(composite.NewCompositionSelectorChain(
			composite.NewEnforcedCompositionSelector(*d, recorder),
			composite.NewAPIDefaultCompositionSelector(r.client, *meta.ReferenceTo(d, v1.CompositeResourceDefinitionGroupVersionKind), recorder),
			composite.NewAPILabelSelectorResolver(r.client),
		)),
		composite.WithLogger(log.WithValues("controller", composite.ControllerName(d.GetName()))),
		composite.WithRecorder(recorder),
	}

	// We only want to enable CompositionRevision support if the relevant
	// feature flag is enabled. Otherwise we start the XR Reconciler with
	// its default CompositionFetcher.
	if r.options.Features.Enabled(features.EnableAlphaCompositionRevisions) {
		a := resource.ClientApplicator{Client: r.client, Applicator: resource.NewAPIPatchingApplicator(r.client)}
		o = append(o, composite.WithCompositionFetcher(composite.NewAPIRevisionFetcher(a)))
	}

	// We only want to enable ExternalSecretStore support if the relevant
	// feature flag is enabled. Otherwise, we start the XR reconcilers with
	// their default ConnectionPublisher and ConnectionDetailsFetcher.
	// We also add a new Configurator for ExternalSecretStore which basically
	// reflects PublishConnectionDetailsWithStoreConfigRef in Composition to
	// the composite resource.
	if r.options.Features.Enabled(features.EnableAlphaExternalSecretStores) {
		pc := []managed.ConnectionPublisher{
			composite.NewAPIFilteredSecretPublisher(r.client, d.GetConnectionSecretKeys()),
			composite.NewSecretStoreConnectionPublisher(connection.NewDetailsManager(r.client, v1alpha1.StoreConfigGroupVersionKind), d.GetConnectionSecretKeys()),
		}
		o = append(o, composite.WithConnectionPublishers(pc...))

		fc := composite.ConnectionDetailsFetcherChain{
			composite.NewAPIConnectionDetailsFetcher(r.client),
			composite.NewSecretStoreConnectionDetailsFetcher(connection.NewDetailsManager(r.client, v1alpha1.StoreConfigGroupVersionKind)),
		}
		o = append(o, composite.WithConnectionDetailsFetcher(fc))

		cc := composite.NewConfiguratorChain(
			composite.NewAPINamingConfigurator(r.client),
			composite.NewAPIConfigurator(r.client),
			composite.NewSecretStoreConnectionDetailsConfigurator(r.client),
		)
		o = append(o, composite.WithConfigurator(cc))
	}

	cr := composite.NewReconciler(r.mgr, resource.CompositeKind(d.GetCompositeGroupVersionKind()), o...)
	ko := r.options.ForControllerRuntime()
	ko.Reconciler = ratelimiter.NewReconciler(composite.ControllerName(d.GetName()), cr, r.options.GlobalRateLimiter)

	u := &kunstructured.Unstructured{}
	u.SetGroupVersionKind(d.GetCompositeGroupVersionKind())

	if err := r.composite.Start(composite.ControllerName(d.GetName()), ko, controller.For(u, &handler.EnqueueRequestForObject{})); err != nil {
		log.Debug(errStartController, "error", err)
		err = errors.Wrap(err, errStartController)
		r.record.Event(d, event.Warning(reasonEstablishXR, err))
		return reconcile.Result{}, err
	}

	d.Status.Controllers.CompositeResourceTypeRef = v1.TypeReferenceTo(d.GetCompositeGroupVersionKind())
	d.Status.SetConditions(v1.WatchingComposite())
	r.record.Event(d, event.Normal(reasonEstablishXR, "(Re)started composite resource controller"))
	return reconcile.Result{Requeue: false}, errors.Wrap(r.client.Status().Update(ctx, d), errUpdateStatus)
}

repository: pdettori/crossplane

repo_name: pdettori/crossplane


text:
// Package link will find and return information for link from json file
package link

// ObjectLink describe multiple applications
type ObjectLink struct {
	Applications []Application `json:"applications"`
}

// Application describe an application
type Application struct {
	Shortname string  `json:"shortname"`
	Desc      appdesc `json:"appdesc"`
}

type appdesc struct {
	Longname string `json:"longname"`
	Link     string `json:"link"`
	Env      string `json:"env"`
}


text:
package license

import (
	"fmt"
	"strconv"

	"github.com/beatlabs/gomodctl/internal"
	"github.com/beatlabs/gomodctl/internal/printer"
)

// ResultPrinter implements Printer interface for License command.
type ResultPrinter struct {
	licenseResults map[string]internal.LicenseResult
}

// NewResultPrinter creates a new instance of ResultPrinter.
func NewResultPrinter(m map[string]internal.LicenseResult) *ResultPrinter {
	return &ResultPrinter{licenseResults: m}
}

// TableData returns table friendly result.
func (r *ResultPrinter) TableData() *printer.TableData {
	var data [][]string

	for name, result := range r.licenseResults {
		r := []string{
			name,
			result.LocalVersion.Original(),
		}

		if result.Error != nil {
			r = append(r, fmt.Sprintf("failed because of: %s", result.Error.Error()))
		} else {
			r = append(r, result.Type)
		}

		data = append(data, r)
	}

	td := &printer.TableData{
		Header:       []string{"Module", "Version", "License"},
		Footer:       []string{"", "number of modules", strconv.Itoa(len(r.licenseResults))},
		RowSeparator: "-",
		ShowBorder:   false,
		ShowRowLine:  false,
		Data:         data,
	}

	return td
}

// JSONData returns JSON friendly result.
func (r *ResultPrinter) JSONData() interface{} {
	return r.licenseResults
}

repository: beatlabs/gomodctl

repo_name: beatlabs/gomodctl


text:
/**
 * Copyright 2014 @ Ops.
 * name :
 * author : newmin
 * date : 2013-11-20 19:27
 * description :
 * history :
 */

package main

import (
	"github.com/atnet/gof/net/jsv"
)

func main() {
	jsv.InShell()
}


text:
package app

import (
	"encoding/json"
	"io/ioutil"
	"time"
)

// Data - the structure of file with the data
type Data struct {
	CurrentIP string    `json:"current_ip"`
	PrevIP    string    `json:"previous_ip"`
	ChangedAt time.Time `json:"changed_at"`
}

// GetData returns a data from file
func GetData(dataPath string) (Data, error) {
	content, err := ioutil.ReadFile(dataPath)

	if err != nil {
		return Data{}, err
	}

	var d Data

	if err := json.Unmarshal(content, &d); err != nil {
		return Data{}, err
	}

	return d, nil
}

// SaveData saves the data into the file
func (d *Data) SaveData(dataPath string) (*Data, error) {
	jsonData, err := json.Marshal(d)

	if err != nil {
		return d, err
	}

	if err := ioutil.WriteFile(dataPath, jsonData, 0644); err != nil {
		return d, err
	}

	return d, nil
}

repository: Wojteek/dynhost

repo_name: Wojteek/dynhost


text:
@booklet{AppleAutomator,
        Author = {Apple},
        Date-Added = {2008-09-24 15:12:07 -0700},
        Date-Modified = {2008-10-14 22:00:43 +0200},
        Lastchecked = {25. Juni 2007},
        Note = {as of Sep 23 2008, \url{http://automator.us}},
        Organization = {Apple Inc.},
        Title = {{Automator: Doing Things Over and Over is Over}},
        Url = {http://automator.us},
        Year = 2007,
        Bdsk-Url-1 = {http://automator.us}}

@article{Baroth1995VPR,
        Address = {Greenwich, CT, USA},
        Author = {Ed Baroth and Chris Hartsough},
        Book = {Visual object-oriented programming: concepts and environments},
        Date-Added = {2008-09-25 16:46:53 -0700},
        Date-Modified = {2008-10-14 22:00:55 +0200},
        Isbn = {0-13-172397-9},
        Pages = {21--42},
        Publisher = {Manning Publications Co.},
        Title = {{Visual Programming in the Real World}},
        Year = {1995}}

@book{Bitter2006LAP,
        Author = {Bitter, R. and Mohiuddin, T. and Nawrocki, M.},
        Date-Added = {2008-09-24 15:12:07 -0700},
        Date-Modified = {2008-09-24 15:12:07 -0700},
        Keywords = {EUD},
        Publisher = {CRC Press},
        Title = {{LabVIEW: Advanced Programming Techniques}},
        Year = {2006}}

@inproceedings{Cook2007AS,
        Address = {New York, NY, USA},
        Author = {William R. Cook},
        Booktitle = {HOPL III: Proceedings of the third ACM SIGPLAN conference on History of programming languages},
        Date-Added = {2008-12-10 16:59:55 +0100},
        Date-Modified = {2008-12-10 17:00:29 +0100},
        Doi = {http://doi.acm.org/10.1145/1238844.1238845},
        Isbn = {978-1-59593-766-X},
        Location = {San Diego, California},
        Pages = {1-1--1-21},
        Publisher = {ACM},
        Title = {AppleScript},
        Year = {2007},
        Bdsk-Url-1 = {http://doi.acm.org/10.1145/1238844.1238845}}

@article{Ingalls1988FVP,
        Address = {New York, NY, USA},
        Author = {Dan Ingalls and Scott Wallace and Yu-Ying Chow and Frank Ludolph and Ken Doyle},
        Date-Added = {2008-09-24 17:31:07 -0700},
        Date-Modified = {2008-10-14 22:01:34 +0200},
        Doi = {http://doi.acm.org/10.1145/62084.62100},
        Issn = {0362-1340},
        Journal = {SIGPLAN Not.},
        Number = {11},
        Pages = {176--190},
        Publisher = {ACM},
        Title = {{Fabrik: a visual programming environment}},
        Volume = {23},
        Year = {1988},
        Bdsk-Url-1 = {http://doi.acm.org/10.1145/62084.62100}}

@article{Ingalls1997BTF,
        Author = {Dan Ingalls and Ted Kaehler and John Maloney and Scott Wallace and Alan Kay},
        Date-Added = {2008-09-24 15:12:07 -0700},
        Date-Modified = {2008-09-24 17:03:31 -0700},
        Doi = {http://doi.acm.org/10.1145/263700.263754},
        Journal = {ACM SIGPLAN Notices},
        Number = 10,
        Pages = {318--326},
        Publisher = {ACM Press New York, NY, USA},
        Rating = {5},
        Read = {Yes},
        Title = {{Back to the Future: The Story of Squeak, a Practical Smalltalk Written in Itself}},
        Volume = 32,
        Year = 1997,
        Bdsk-Url-1 = {http://doi.acm.org/10.1145/263700.263754},
        Bdsk-Url-2 = {http://portal.acm.org/ft_gateway.cfm?id=263754&type=pdf&coll=GUIDE&dl=GUIDE&CFID=29478890&CFTOKEN=43963651}}

@booklet{Ingalls2007SLL,
        Author = {Dan Ingalls and Tommi Mikkonen and Krzysztof Palacz and Antero Taivalsaari},
        Date-Added = {2008-05-26 10:34:13 +0200},
        Date-Modified = {2008-10-14 22:01:48 +0200},
        Lastchecked = {12. Oktober 2007},
        Note = {as of Oct 12, 2007, \url{http://research.sun.com/projects/lively/}},
        Title = {{Sun Labs Lively Kernel}},
        Year = {2007}}

@inproceedings{Ingalls2008TLK,
        Author = {Daniel Ingalls and Krzysztof Palacz and Stephen Uhler and Antero Taivalsaari and Tommi Mikkonen},
        Booktitle = {S3 2008},
        Date-Added = {2008-09-25 15:55:55 -0700},
        Date-Modified = {2008-10-14 22:02:10 +0200},
        Editor = {Robert Hirschfeld and Kim Rose},
        Publisher = {Springer-Verlag Berlin Heidelberg},
        Series = {LNCS 5146},
        Title = {{The Lively Kernel A Self-Supporting System on a Web Page}},
        Year = {2008}}

@article{Johnston2004ADP,
        Address = {New York, NY, USA},
        Author = {Wesley M. Johnston and J. R. Paul Hanna and Richard J. Millar},
        Date-Added = {2008-09-24 15:12:07 -0700},
        Date-Modified = {2008-10-14 22:02:31 +0200},
        Doi = {http://doi.acm.org/10.1145/1013208.1013209},
        Issn = {0360-0300},
        Journal = {ACM Comput. Surv.},
        Number = {1},
        Pages = {1--34},
        Publisher = {ACM},
        Title = {{Advances in Dataflow Programming Languages}},
        Volume = {36},
        Year = {2004},
        Bdsk-Url-1 = {http://doi.acm.org/10.1145/1013208.1013209}}

@booklet{Kay2005SEA,
        Author = {Alan Kay},
        Date-Added = {2008-05-26 10:34:13 +0200},
        Date-Modified = {2008-10-14 22:02:39 +0200},
        Note = {as of Aug 01, 2005, \url{http://www.squeakland.org/pdf/etoys_n_authoring.pdf}},
        Title = {{Squeak Etoys Authoring and Media}},
        Url = {http://www.squeakland.org/pdf/etoys_n_authoring.pdf},
        Year = {2005},
        Bdsk-Url-1 = {http://www.squeakland.org/pdf/etoys_n_authoring.pdf}}

@article{Lieberman2006EUD,
        Abstract = {We think that over the next few years, the goal of interactive systems and services will evolve from just making systems easy to use (even though that goal has not yet been completely achieved) to making systems that are easy to develop by end users. By now, most people have become familiar with the basic functionality and interfaces of computers, but they are not able to manage any programming language. Therefore, they cannot develop new applications or modify current ones according to their needs.  In order to address such challenges it is necessary a new paradigm, based on a multidisciplinary approach involving several types of expertise, such as software engineering, human-computer interaction, CSCW, which are now rather fragmented and with little interaction. The resulting methods and tools can provide results useful across many application domains, such as ERP, multi-device services (accessible through both mobile and stationary devices), and professional applications.    Key words. tailorability, end user programming, flexibility, usability  },
        Annote = { },
        Author = {Henry  Lieberman  and Fabio Patern{\`o} and Markus Klann  and Volker Wulf},
        Date-Added = {2008-09-24 18:13:01 -0700},
        Date-Modified = {2008-10-14 22:02:55 +0200},
        Journal = {End User Development},
        M3 = {10.1007/1-4020-5386-X{\_}1},
        Pages = {1--8},
        Title = {{End-User Development: An Emerging Paradigm}},
        Ty = {CHAPTER},
        Url = {http://dx.doi.org/10.1007/1-4020-5386-X_1},
        Year = {2006},
        Bdsk-Url-1 = {http://dx.doi.org/10.1007/1-4020-5386-X_1}}

@article{Ludolph1988FPE,
        Author = {Ludolph, F. and Chow, Y.-Y. and Ingalls, D. and Wallace, S. and Doyle, K.},
        Date-Added = {2008-09-24 17:37:04 -0700},
        Date-Modified = {2008-10-14 22:03:03 +0200},
        Doi = {10.1109/WVL.1988.18032},
        Journal = {Visual Languages, 1988., IEEE Workshop on},
        Keywords = {computer graphics, programming environments, user interfacesFabrik programming environment, application-specific operations, bidirectional data-flow model, environmental languages, graphical elements, interactive graphical programming environment, modifiable examples, programmer language, representation, user interface},
        Month = {Oct},
        Pages = {222-230},
        Title = {{The Fabrik Programming Environment}},
        Year = {1988},
        Bdsk-Url-1 = {http://dx.doi.org/10.1109/WVL.1988.18032}}

@inproceedings{Maloney1995DLM,
        Address = {New York, NY, USA},
        Author = {John H. Maloney and Randall B. Smith},
        Booktitle = {UIST '95: Proceedings of the 8th annual ACM symposium on User interface and software technology},
        Date-Added = {2008-09-24 15:12:07 -0700},
        Date-Modified = {2008-09-24 15:19:15 -0700},
        Doi = {http://doi.acm.org/10.1145/215585.215636},
        Isbn = {0-89791-709-X},
        Location = {Pittsburgh, Pennsylvania, United States},
        Pages = {21--28},
        Publisher = {ACM},
        Title = {Directness and Liveness in the Morphic User Interface Construction Environment},
        Year = {1995},
        Bdsk-Url-1 = {http://doi.acm.org/10.1145/215585.215636}}

@inproceedings{Maloney2004SSP,
        Address = {Washington, DC, USA},
        Author = {John Maloney and Leo Burd and Yasmin Kafai and Natalie Rusk and Brian Silverman and Mitchel Resnick},
        Booktitle = {C5 '04: Proceedings of the Second International Conference on Creating, Connecting and Collaborating through Computing},
        Date-Added = {2008-09-24 18:06:51 -0700},
        Date-Modified = {2008-10-14 22:03:52 +0200},
        Doi = {http://dx.doi.org/10.1109/C5.2004.33},
        Isbn = {0-7695-2166-5},
        Pages = {104--109},
        Publisher = {IEEE Computer Society},
        Title = {{Scratch: A Sneak Preview}},
        Year = {2004},
        Bdsk-Url-1 = {http://dx.doi.org/10.1109/C5.2004.33}}

@article{Merrill2006MNB,
        Author = {Merrill, D.},
        Date-Added = {2008-09-24 18:32:47 -0700},
        Date-Modified = {2008-09-24 18:33:51 -0700},
        Journal = {IBM Web Architecture Technical Library},
        Title = {{Mashups: The new breed of Web app}},
        Year = {2006}}

@booklet{MicrosoftPopfly,
        Author = {Microsoft},
        Date-Added = {2008-09-24 15:12:07 -0700},
        Date-Modified = {2008-10-14 22:04:04 +0200},
        Lastchecked = {Sep 23 2008},
        Note = {as of Sep 23 2008, \url{http://www.popfly.com}},
        Organization = {Microsoft},
        Title = {{Popfly}},
        Url = {http://www.popﬂy.com},
        Year = 2008,
        Bdsk-Url-1 = {http://www.pop%EF%AC%82y.com}}

@book{Morgan2008PMR,
        Address = {Redmond, WA, USA},
        Author = {Sara Morgan},
        Date-Added = {2008-09-24 15:12:07 -0700},
        Date-Modified = {2008-10-14 22:04:12 +0200},
        Isbn = {9780735624320},
        Keywords = {EUD},
        Publisher = {Microsoft Press},
        Title = {{Programming Microsoft Robotics Studio}},
        Year = {2008}}

@inproceedings{Ohshima2007TLW,
        Address = {Washington, DC, USA},
        Author = {Yoshiki Ohshima and Takashi Yamamiya and Scott Wallace and Andreas Raab},
        Booktitle = {C5 '07: Proceedings of the Fifth International Conference on Creating, Connecting and Collaborating through Computing},
        Date-Added = {2008-09-24 15:12:07 -0700},
        Date-Modified = {2008-10-14 22:04:21 +0200},
        Doi = {10.1109/C5.2007.30},
        Isbn = {0-7695-2806-6},
        Pages = {36--46},
        Publisher = {IEEE Computer Society},
        Title = {{TinLizzie WysiWiki and WikiPhone: Alternative approaches to asynchronous and synchronous collaboration on the Web}},
        Year = 2007,
        Bdsk-Url-1 = {http://dx.doi.org/10.1109/C5.2007.30}}

@article{Quan2003HPA,
        Author = {Quan, D. and Huynh, D. and Karger, D.R.},
        Date-Added = {2008-09-24 15:49:55 -0700},
        Date-Modified = {2008-09-24 15:50:23 -0700},
        Journal = {LECTURE NOTES IN COMPUTER SCIENCE},
        Pages = {738--753},
        Publisher = {Springer},
        Title = {{Haystack: A Platform for Authoring End User Semantic Web Applications}},
        Year = {2003}}

@techreport{Renggli2008PMD,
        Author = {Lukas Renggli},
        Date-Added = {2008-09-24 17:09:07 -0700},
        Date-Modified = {2008-09-24 17:17:46 -0700},
        Institution = {University of Bern},
        Month = {Mar},
        Title = {{Pier--The Meta-Described Content Management System ESUG Innovation Technology Awards 2007}},
        Year = {2008},
        Bdsk-Url-1 = {http://www.iam.unibe.ch/~scg/Archive/Reports/Reng07c.pdf}}

@article{Rode2003PRR,
        Author = {Rode, J. and Rosson, M.B.},
        Date-Added = {2008-09-24 15:55:54 -0700},
        Date-Modified = {2008-09-24 15:56:23 -0700},
        Journal = {IEEE Symposium on Human-Centric Computing Languages and Environments},
        Keywords = {EUD},
        Title = {{Programming at Runtime: Requirements and Paradigms for Nonprogrammer Web Application Development}},
        Year = {2003}}

@incollection{Rode2006EUD,
        Author = {Jochen Rode and Marry Beth Rosson and Manuel A. P{\'e}rez Qui{\~n}ones},
        Booktitle = {End User Development},
        Date-Added = {2008-09-24 15:04:53 -0700},
        Date-Modified = {2008-09-24 17:25:47 -0700},
        Editor = {Henry Lieberman, Fabio Patern{\`o} and Volker Wulf},
        Pages = {161--182},
        Publisher = {Springer},
        Series = {Human-Computer Interaction Series},
        Title = {{End User Development of Web Applications}},
        Volume = {9},
        Year = {2006}}

@techreport{Taivalsaari2008TLKE,
        Abstract = {For better or worse, thewebbrowser hasbecomeawidely-usedtarget platformfor software
applications. Desktop-styleapplicationssuchaswordprocessors, spreadsheets, calendars,
gamesandinstantmessagingsystemsthatwerewrittenearlierforspecificoperatingsystems,
CPUarchitecturesordevicesarenowwrittenfortheWorldWideWeb, tobeusedfromaweb
browser by anyone, anywhere, anytime.
Theoriginal designof thewebbrowser datesbacktotheearly1990s. Giventhat theweb
browser wasoriginallytargetedat displayingstatic, page-structureddocuments, it isnot sur-
prisingthat thewebbrowser isnot anideal executionenvironment for desktop-styleapplica-
tions. Inthispaper wesummarizeour experiencesinusingthewebbrowser asatarget
platformforreal applications. Asaconcreteexample, weusetheSun{\texttrademark}LabsLivelyKernel, a
systemthatpushesthelimitsofthewebbrowserbyimplementingahighlyinteractivewebpro-
grammingenvironment that runsinawebbrowserwithout installationorplug-incomponents.
Basedonthiswork, weanalyzethelimitations, challengesandopportunitiesrelatedtothe
webbrowserasanapplicationplatform.Wealsoproviderecommendationsforpossiblefuture
improvements.
},
        Author = {Antero Taivalsaari and Tommi Mikkonen and Dan Ingalls and Krzysztof Palacz},
        Date-Added = {2008-05-26 13:11:30 +0200},
        Date-Modified = {2008-10-14 22:04:43 +0200},
        Institution = {Sun Microsystems},
        Keywords = {EUD, JavaScript, LivelyKernel},
        Month = {January},
        Number = {SMLI TR-2008-175},
        Title = {{Web Browser as an Application Platform: The Lively Kernel Experience}},
        Url = {\url{http://research.sun.com/techrep/2007/smli_tr-2007-168.pdf}},
        Year = {2008},
        Bdsk-File-1 = {YnBsaXN0MDDUAQIDBAUGCQpYJHZlcnNpb25UJHRvcFkkYXJjaGl2ZXJYJG9iamVjdHMSAAGGoNE
HCFRyb290gAFfEA9OU0tleWVkQXJjaGl2ZXKoCwwXGBkdJCVVJG51bGzTDQ4PEBEUViRjbGFzc1
dOUy5rZXlzWk5TLm9iamVjdHOAB6ISE4ACgAOiFRaABIAGWWFsaWFzRGF0YVxyZWxhdGl2ZVBhd
GjSDRobHFdOUy5kYXRhgAVPEQKoAAAAAAKoAAIAAAlCbGFja2Jvb2sAAAAAAAAAAAAAAAAAAAAA
AADFBvQzSCsAAAAbmQEfVGFpdmFsc2FhcmlNaWtrb25lbkkjMUI5OTQ3LnBkZgAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAABuZR8RgZpgAAAAAAAAAAAADAAUAAAkgAAAAAAAAAAAAAA
AAAAAAA0VVRAAAEAAIAADFBtgTAAAAEQAIAADEYEp4AAAAAQAYABuZAQAblsUAG4RIABuERgAR8
PUAEe/FAAIATkJsYWNrYm9vazpVc2VyczpqZW5zOm1hdGVyaWFsOmJvb2tzOlBhcGVyczpFVUQ6
VGFpdmFsc2FhcmlNaWtrb25lbkkjMUI5OTQ3LnBkZgAOAMoAZABUAGEAaQB2AGEAbABzAGEAYQB
yAGkATQBpAGsAawBvAG4AZQBuAEkAbgBnAGEAbABsAHMAUABhAGwAYQBjAHoAXwAyADAAMAA4AF
8AVwBlAGIAQgByAG8AdwBzAGUAcgBBAHMAQQBuAEEAcABwAGwAaQBjAGEAdABpAG8AbgBQAGwAY
QB0AGYAbwByAG0AVABoAGUATABpAHYAZQBsAHkASwBlAHIAbgBlAGwARQB4AHAAZQByAGkAZQBu
AGMAZQAuAHAAZABmAA8AFAAJAEIAbABhAGMAawBiAG8AbwBrABIAiVVzZXJzL2plbnMvbWF0ZXJ
pYWwvYm9va3MvUGFwZXJzL0VVRC9UYWl2YWxzYWFyaU1pa2tvbmVuSW5nYWxsc1BhbGFjel8yMD
A4X1dlYkJyb3dzZXJBc0FuQXBwbGljYXRpb25QbGF0Zm9ybVRoZUxpdmVseUtlcm5lbEV4cGVya
WVuY2UucGRmAAATAAEvAAAVAAIAC///AADSHh8gIVgkY2xhc3Nlc1okY2xhc3NuYW1loyEiI11O
U011dGFibGVEYXRhVk5TRGF0YVhOU09iamVjdF8Qhy4uLy4uLy4uL21hdGVyaWFsL2Jvb2tzL1B
hcGVycy9FVUQvVGFpdmFsc2FhcmlNaWtrb25lbkluZ2FsbHNQYWxhY3pfMjAwOF9XZWJCcm93c2
VyQXNBbkFwcGxpY2F0aW9uUGxhdGZvcm1UaGVMaXZlbHlLZXJuZWxFeHBlcmllbmNlLnBkZtIeH
yYnoicjXE5TRGljdGlvbmFyeQAIABEAGgAfACkAMgA3ADoAPwBBAFMAXABiAGkAcAB4AIMAhQCI
AIoAjACPAJEAkwCdAKoArwC3ALkDZQNqA3MDfgOCA5ADlwOgBCoELwQyAAAAAAAAAgEAAAAAAAA
AKAAAAAAAAAAAAAAAAAAABD8=}}

@article{Warth2008TMS,
        Abstract = {End-user scripting languages are relatively easy to learn, but have limited expressive power. Tile-based scripting systems are particularly accessible to beginners, but usually are very limited in scope and usually lack extensibility, and for some tasks the tile idiom becomes cumbersome. Conventional programming languages used by computer professionals are far more powerful, but at the cost of additional complexity and limited environmental support, which place them out of the casual programmer's reach. This paper presents TileScript, an attempt to combine the accessibility of a tile-based programming interface with the leverage of a full textual programming language and with a simple means of extension, making it potentially an appealing tool for the novice programmer without sacrificing any expressiveness. All TileScript programs, whether built originally with tiles or textually, can always be edited both graphically via a drag-and-drop tile interface and textually, and the user can freely switch back and forth between tile and textual representations at any time. Additionally TileScript's simple yet powerful extensibility mechanisms allow the language to be used to tackle problems that would normally be out of the scope of an end-user scripting language.},
        Author = {Alessandro Warth and Takashi Yamamiya and Yoshiki Ohshima and Scott Wallace},
        Date-Added = {2008-09-24 17:57:26 -0700},
        Date-Modified = {2008-10-14 22:04:51 +0200},
        Doi = {10.1109/C5.2008.33},
        Journal = {Creating, Connecting and Collaborating through Computing, 2008. C5 2008. Sixth International Conference on},
        Keywords = {authoring languages, user interfacesdrag-and-drop tile interface, end-user scripting language, textual programming language, tile-based scripting systems},
        Month = {Jan.},
        Pages = {172-178},
        Title = {{Toward A More Scalable End-User Scripting Language}},
        Year = {2008},
        Bdsk-Url-1 = {http://dx.doi.org/10.1109/C5.2008.33}}

@booklet{WeaselEssay,
        Author = {Alan Kay},
        Date-Added = {2008-09-24 15:12:07 -0700},
        Date-Modified = {2008-10-14 22:04:58 +0200},
        Key = WeaselEssay,
        Lastchecked = {06. August 2007},
        Note = {as of Aug 06 2007, \url{http://www.squeakland.org/whatis/a_essays.html}},
        Title = {{Active Essay about Evolution}},
        Url = {http://www.squeakland.org/whatis/a_essays.html},
        Bdsk-Url-1 = {http://www.squeakland.org/whatis/a_essays.html}}

@booklet{YahooPipes,
        Author = {Yahoo},
        Date-Added = {2008-09-24 15:12:07 -0700},
        Date-Modified = {2008-10-14 22:05:06 +0200},
        Lastchecked = {Sep 23 2008},
        Note = {as of Sep 23 2008, \url{http://pipes.yahoo.com/pipes/}},
        Organization = {Yahoo! Inc.},
        Title = {{Pipes}},
        Url = {http://pipes.yahoo.com/pipes/},
        Year = 2008,
        Bdsk-Url-1 = {http://pipes.yahoo.com/pipes/}}

repository: LivelyKernel/sunlabs-kernel

repo_name: LivelyKernel/sunlabs-kernel


text:
@ARTICLE{maps1,
  AUTHOR	    = {John Doe},
  YEAR		    = {1995}
}

@ARTICLE{maps2,
  AUTHOR	    = {Bill Bran},
  YEAR		    = {1996}
}

@COLLECTION{maps3,
  AUTHOR	    = {Marvin Map},
  YEAR		    = {1945}
}

@BOOK{maps4,
  AUTHOR	    = {Alan Allele},
  YEAR		    = {1995}
}

repository: FlamingTempura/bibtex-tidy

repo_name: FlamingTempura/bibtex-tidy

gha_license_id: MIT

gha_language: TeX


text:
// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License"). You may
// not use this file except in compliance with the License. A copy of the
// License is located at
//
//     http://aws.amazon.com/apache2.0/
//
// or in the "license" file accompanying this file. This file 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.

// Code generated by ack-generate. DO NOT EDIT.

package grant

import (
	"context"
	"strings"

	ackv1alpha1 "github.com/aws-controllers-k8s/runtime/apis/core/v1alpha1"
	ackcompare "github.com/aws-controllers-k8s/runtime/pkg/compare"
	ackcondition "github.com/aws-controllers-k8s/runtime/pkg/condition"
	ackerr "github.com/aws-controllers-k8s/runtime/pkg/errors"
	ackrtlog "github.com/aws-controllers-k8s/runtime/pkg/runtime/log"
	"github.com/aws/aws-sdk-go/aws"
	svcsdk "github.com/aws/aws-sdk-go/service/kms"
	corev1 "k8s.io/api/core/v1"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

	svcapitypes "github.com/aws-controllers-k8s/kms-controller/apis/v1alpha1"
)

// Hack to avoid import errors during build...
var (
	_ = &metav1.Time{}
	_ = strings.ToLower("")
	_ = &aws.JSONValue{}
	_ = &svcsdk.KMS{}
	_ = &svcapitypes.Grant{}
	_ = ackv1alpha1.AWSAccountID("")
	_ = &ackerr.NotFound
	_ = &ackcondition.NotManagedMessage
)

// sdkFind returns SDK-specific information about a supplied resource
func (rm *resourceManager) sdkFind(
	ctx context.Context,
	r *resource,
) (latest *resource, err error) {
	rlog := ackrtlog.FromContext(ctx)
	exit := rlog.Trace("rm.sdkFind")
	defer exit(err)
	// If any required fields in the input shape are missing, AWS resource is
	// not created yet. Return NotFound here to indicate to callers that the
	// resource isn't yet created.
	if rm.requiredFieldsMissingFromReadManyInput(r) {
		return nil, ackerr.NotFound
	}

	input, err := rm.newListRequestPayload(r)
	if err != nil {
		return nil, err
	}
	var resp *svcsdk.ListGrantsResponse
	resp, err = rm.sdkapi.ListGrantsWithContext(ctx, input)
	rm.metrics.RecordAPICall("READ_MANY", "ListGrants", err)
	if err != nil {
		if awsErr, ok := ackerr.AWSError(err); ok && awsErr.Code() == "UNKNOWN" {
			return nil, ackerr.NotFound
		}
		return nil, err
	}

	// Merge in the information we read from the API call above to the copy of
	// the original Kubernetes object we passed to the function
	ko := r.ko.DeepCopy()

	found := false
	for _, elem := range resp.Grants {
		if elem.Constraints != nil {
			f0 := &svcapitypes.GrantConstraints{}
			if elem.Constraints.EncryptionContextEquals != nil {
				f0f0 := map[string]*string{}
				for f0f0key, f0f0valiter := range elem.Constraints.EncryptionContextEquals {
					var f0f0val string
					f0f0val = *f0f0valiter
					f0f0[f0f0key] = &f0f0val
				}
				f0.EncryptionContextEquals = f0f0
			}
			if elem.Constraints.EncryptionContextSubset != nil {
				f0f1 := map[string]*string{}
				for f0f1key, f0f1valiter := range elem.Constraints.EncryptionContextSubset {
					var f0f1val string
					f0f1val = *f0f1valiter
					f0f1[f0f1key] = &f0f1val
				}
				f0.EncryptionContextSubset = f0f1
			}
			ko.Spec.Constraints = f0
		} else {
			ko.Spec.Constraints = nil
		}
		if elem.GrantId != nil {
			ko.Status.GrantID = elem.GrantId
		} else {
			ko.Status.GrantID = nil
		}
		if elem.GranteePrincipal != nil {
			ko.Spec.GranteePrincipal = elem.GranteePrincipal
		} else {
			ko.Spec.GranteePrincipal = nil
		}
		if elem.KeyId != nil {
			ko.Spec.KeyID = elem.KeyId
		} else {
			ko.Spec.KeyID = nil
		}
		if elem.Name != nil {
			ko.Spec.Name = elem.Name
		} else {
			ko.Spec.Name = nil
		}
		if elem.Operations != nil {
			f7 := []*string{}
			for _, f7iter := range elem.Operations {
				var f7elem string
				f7elem = *f7iter
				f7 = append(f7, &f7elem)
			}
			ko.Spec.Operations = f7
		} else {
			ko.Spec.Operations = nil
		}
		if elem.RetiringPrincipal != nil {
			ko.Spec.RetiringPrincipal = elem.RetiringPrincipal
		} else {
			ko.Spec.RetiringPrincipal = nil
		}
		found = true
		break
	}
	if !found {
		return nil, ackerr.NotFound
	}

	rm.setStatusDefaults(ko)
	return &resource{ko}, nil
}

// requiredFieldsMissingFromReadManyInput returns true if there are any fields
// for the ReadMany Input shape that are required but not present in the
// resource's Spec or Status
func (rm *resourceManager) requiredFieldsMissingFromReadManyInput(
	r *resource,
) bool {
	return r.ko.Status.GrantID == nil

}

// newListRequestPayload returns SDK-specific struct for the HTTP request
// payload of the List API call for the resource
func (rm *resourceManager) newListRequestPayload(
	r *resource,
) (*svcsdk.ListGrantsInput, error) {
	res := &svcsdk.ListGrantsInput{}

	if r.ko.Status.GrantID != nil {
		res.SetGrantId(*r.ko.Status.GrantID)
	}
	if r.ko.Spec.GranteePrincipal != nil {
		res.SetGranteePrincipal(*r.ko.Spec.GranteePrincipal)
	}
	if r.ko.Spec.KeyID != nil {
		res.SetKeyId(*r.ko.Spec.KeyID)
	}

	return res, nil
}

// sdkCreate creates the supplied resource in the backend AWS service API and
// returns a copy of the resource with resource fields (in both Spec and
// Status) filled in with values from the CREATE API operation's Output shape.
func (rm *resourceManager) sdkCreate(
	ctx context.Context,
	desired *resource,
) (created *resource, err error) {
	rlog := ackrtlog.FromContext(ctx)
	exit := rlog.Trace("rm.sdkCreate")
	defer exit(err)
	input, err := rm.newCreateRequestPayload(ctx, desired)
	if err != nil {
		return nil, err
	}

	var resp *svcsdk.CreateGrantOutput
	_ = resp
	resp, err = rm.sdkapi.CreateGrantWithContext(ctx, input)
	rm.metrics.RecordAPICall("CREATE", "CreateGrant", err)
	if err != nil {
		return nil, err
	}
	// Merge in the information we read from the API call above to the copy of
	// the original Kubernetes object we passed to the function
	ko := desired.ko.DeepCopy()

	if resp.GrantId != nil {
		ko.Status.GrantID = resp.GrantId
	} else {
		ko.Status.GrantID = nil
	}
	if resp.GrantToken != nil {
		ko.Status.GrantToken = resp.GrantToken
	} else {
		ko.Status.GrantToken = nil
	}

	rm.setStatusDefaults(ko)
	return &resource{ko}, nil
}

// newCreateRequestPayload returns an SDK-specific struct for the HTTP request
// payload of the Create API call for the resource
func (rm *resourceManager) newCreateRequestPayload(
	ctx context.Context,
	r *resource,
) (*svcsdk.CreateGrantInput, error) {
	res := &svcsdk.CreateGrantInput{}

	if r.ko.Spec.Constraints != nil {
		f0 := &svcsdk.GrantConstraints{}
		if r.ko.Spec.Constraints.EncryptionContextEquals != nil {
			f0f0 := map[string]*string{}
			for f0f0key, f0f0valiter := range r.ko.Spec.Constraints.EncryptionContextEquals {
				var f0f0val string
				f0f0val = *f0f0valiter
				f0f0[f0f0key] = &f0f0val
			}
			f0.SetEncryptionContextEquals(f0f0)
		}
		if r.ko.Spec.Constraints.EncryptionContextSubset != nil {
			f0f1 := map[string]*string{}
			for f0f1key, f0f1valiter := range r.ko.Spec.Constraints.EncryptionContextSubset {
				var f0f1val string
				f0f1val = *f0f1valiter
				f0f1[f0f1key] = &f0f1val
			}
			f0.SetEncryptionContextSubset(f0f1)
		}
		res.SetConstraints(f0)
	}
	if r.ko.Spec.GrantTokens != nil {
		f1 := []*string{}
		for _, f1iter := range r.ko.Spec.GrantTokens {
			var f1elem string
			f1elem = *f1iter
			f1 = append(f1, &f1elem)
		}
		res.SetGrantTokens(f1)
	}
	if r.ko.Spec.GranteePrincipal != nil {
		res.SetGranteePrincipal(*r.ko.Spec.GranteePrincipal)
	}
	if r.ko.Spec.KeyID != nil {
		res.SetKeyId(*r.ko.Spec.KeyID)
	}
	if r.ko.Spec.Name != nil {
		res.SetName(*r.ko.Spec.Name)
	}
	if r.ko.Spec.Operations != nil {
		f5 := []*string{}
		for _, f5iter := range r.ko.Spec.Operations {
			var f5elem string
			f5elem = *f5iter
			f5 = append(f5, &f5elem)
		}
		res.SetOperations(f5)
	}
	if r.ko.Spec.RetiringPrincipal != nil {
		res.SetRetiringPrincipal(*r.ko.Spec.RetiringPrincipal)
	}

	return res, nil
}

// sdkUpdate patches the supplied resource in the backend AWS service API and
// returns a new resource with updated fields.
func (rm *resourceManager) sdkUpdate(
	ctx context.Context,
	desired *resource,
	latest *resource,
	delta *ackcompare.Delta,
) (*resource, error) {
	// TODO(jaypipes): Figure this out...
	return nil, ackerr.NotImplemented
}

// sdkDelete deletes the supplied resource in the backend AWS service API
func (rm *resourceManager) sdkDelete(
	ctx context.Context,
	r *resource,
) (latest *resource, err error) {
	rlog := ackrtlog.FromContext(ctx)
	exit := rlog.Trace("rm.sdkDelete")
	defer exit(err)
	// TODO(jaypipes): Figure this out...
	return nil, nil

}

// setStatusDefaults sets default properties into supplied custom resource
func (rm *resourceManager) setStatusDefaults(
	ko *svcapitypes.Grant,
) {
	if ko.Status.ACKResourceMetadata == nil {
		ko.Status.ACKResourceMetadata = &ackv1alpha1.ResourceMetadata{}
	}
	if ko.Status.ACKResourceMetadata.OwnerAccountID == nil {
		ko.Status.ACKResourceMetadata.OwnerAccountID = &rm.awsAccountID
	}
	if ko.Status.Conditions == nil {
		ko.Status.Conditions = []*ackv1alpha1.Condition{}
	}
}

// updateConditions returns updated resource, true; if conditions were updated
// else it returns nil, false
func (rm *resourceManager) updateConditions(
	r *resource,
	onSuccess bool,
	err error,
) (*resource, bool) {
	ko := r.ko.DeepCopy()
	rm.setStatusDefaults(ko)

	// Terminal condition
	var terminalCondition *ackv1alpha1.Condition = nil
	var recoverableCondition *ackv1alpha1.Condition = nil
	var syncCondition *ackv1alpha1.Condition = nil
	for _, condition := range ko.Status.Conditions {
		if condition.Type == ackv1alpha1.ConditionTypeTerminal {
			terminalCondition = condition
		}
		if condition.Type == ackv1alpha1.ConditionTypeRecoverable {
			recoverableCondition = condition
		}
		if condition.Type == ackv1alpha1.ConditionTypeResourceSynced {
			syncCondition = condition
		}
	}

	if rm.terminalAWSError(err) || err == ackerr.SecretTypeNotSupported || err == ackerr.SecretNotFound {
		if terminalCondition == nil {
			terminalCondition = &ackv1alpha1.Condition{
				Type: ackv1alpha1.ConditionTypeTerminal,
			}
			ko.Status.Conditions = append(ko.Status.Conditions, terminalCondition)
		}
		var errorMessage = ""
		if err == ackerr.SecretTypeNotSupported || err == ackerr.SecretNotFound {
			errorMessage = err.Error()
		} else {
			awsErr, _ := ackerr.AWSError(err)
			errorMessage = awsErr.Error()
		}
		terminalCondition.Status = corev1.ConditionTrue
		terminalCondition.Message = &errorMessage
	} else {
		// Clear the terminal condition if no longer present
		if terminalCondition != nil {
			terminalCondition.Status = corev1.ConditionFalse
			terminalCondition.Message = nil
		}
		// Handling Recoverable Conditions
		if err != nil {
			if recoverableCondition == nil {
				// Add a new Condition containing a non-terminal error
				recoverableCondition = &ackv1alpha1.Condition{
					Type: ackv1alpha1.ConditionTypeRecoverable,
				}
				ko.Status.Conditions = append(ko.Status.Conditions, recoverableCondition)
			}
			recoverableCondition.Status = corev1.ConditionTrue
			awsErr, _ := ackerr.AWSError(err)
			errorMessage := err.Error()
			if awsErr != nil {
				errorMessage = awsErr.Error()
			}
			recoverableCondition.Message = &errorMessage
		} else if recoverableCondition != nil {
			recoverableCondition.Status = corev1.ConditionFalse
			recoverableCondition.Message = nil
		}
	}
	// Required to avoid the "declared but not used" error in the default case
	_ = syncCondition
	if terminalCondition != nil || recoverableCondition != nil || syncCondition != nil {
		return &resource{ko}, true // updated
	}
	return nil, false // not updated
}

// terminalAWSError returns awserr, true; if the supplied error is an aws Error type
// and if the exception indicates that it is a Terminal exception
// 'Terminal' exception are specified in generator configuration
func (rm *resourceManager) terminalAWSError(err error) bool {
	// No terminal_errors specified for this resource in generator config
	return false
}

repository: johnko/kms-controller

repo_name: johnko/kms-controller